Code
Toolbar 付きコード:code-enhance
行番号、ファイル名バー、行ハイライト、copy button を確認できます。
ソース
```ts title="hello.ts"
export function hello(name: string): string {
return `こんにちは、${name}`;
}
```
実行例
export function hello(name: string): string {
return `こんにちは、${name}`;
}
Code tabs:code-tabs
隣り合った tab="..." 付き code fence が 1 つの tab group になります。
ソース
```ts tab="React"
const greeting = "Hello from React";
```
```js tab="Vanilla"
console.log("Hello from JavaScript");
```
実行例
const greeting = "Hello from React";console.log("Hello from JavaScript");Code annotations:code-annotations
diff フェンスに対象言語を指定すると、追加行と削除行が表示されます。
ソース
```diff js
const kept = true;
+ const added = "new line";
- const removed = false;
```
実行例
const kept = true;
const added = "new line";
const removed = false;
Source Files:source-files
対象のテキストファイルをページとして公開し、ファイル全体や行範囲を埋め込めます。
ソース
[[source-file-example.ts]]
![[source-file-example.ts]]
![[source-file-example.ts#L3-L5]]
実行例
export const greeting = "Hello from a source file";
export function greet(name: string): string {
return `${greeting}, ${name}!`;
}
export function greet(name: string): string {
return `${greeting}, ${name}!`;
}
Powered by Riebeckite