diff --git a/README.md b/README.md index 9df5cd8..2cb5bbc 100644 --- a/README.md +++ b/README.md @@ -169,12 +169,39 @@ async function version(): Promise { The hash `#` portion of the file URL is used to set injection options. Each option is separated by a `&`. -| Option | Description | -| --------- | --------------------------------------------------------- | -| `heading` | Used to extract a section from a markdown file. | -| `lang` | Used to set the language of the code block | -| `quote` | Used to inject the file as a block quote | -| `L1-L10` | Used to inject only specified lines from the source file. | +| Option | Code | Markdown | Description | +| --------- | ---- | -------- | --------------------------------------------------------- | +| `heading` | ❌ | ✅ | Used to extract a section from a markdown file. | +| `code` | ❌ | ✅ | Convert the injected markdown into a Code Block. | +| `lang` | ✅ | ✅ | Used to set the language of the code block. | +| `quote` | ✅ | ✅ | Used to inject the file as a block quote. | +| `L1-L10` | ✅ | ✅ | Used to inject only specified lines from the source file. | + +### Example 1 + +Extract a few lines from a Markdown files and quote them. + +```markdown + +``` + +> - first +> - second +> - third + +### Example 2 + +Extract some lines from a code block in the source. + +```markdown + +``` + +> ```js +> export function sayGoodbye(name) { +> return `Goodbye ${name}`; +> } +> ``` diff --git a/content/README.md b/content/README.md index e79f749..625e44b 100644 --- a/content/README.md +++ b/content/README.md @@ -64,7 +64,7 @@ It is also possible to inject markdown: ``` - + ```markdown # Example @@ -76,7 +76,7 @@ This is an example bit of markdown. - third ``` - + ## Import a section from a Markdown file @@ -130,9 +130,44 @@ async function version(): Promise { The hash `#` portion of the file URL is used to set injection options. Each option is separated by a `&`. -| Option | Description | -| --------- | --------------------------------------------------------- | -| `heading` | Used to extract a section from a markdown file. | -| `lang` | Used to set the language of the code block | -| `quote` | Used to inject the file as a block quote | -| `L1-L10` | Used to inject only specified lines from the source file. | +| Option | Code | Markdown | Description | +| --------- | ---- | -------- | --------------------------------------------------------- | +| `heading` | ❌ | ✅ | Used to extract a section from a markdown file. | +| `code` | ❌ | ✅ | Convert the injected markdown into a Code Block. | +| `lang` | ✅ | ✅ | Used to set the language of the code block. | +| `quote` | ✅ | ✅ | Used to inject the file as a block quote. | +| `L1-L10` | ✅ | ✅ | Used to inject only specified lines from the source file. | + +### Example 1 + +Extract a few lines from a Markdown files and quote them. + +```markdown + +``` + + + +> - first +> - second +> - third + + + +### Example 2 + +Extract some lines from a code block in the source. + +```markdown + +``` + + + +> ```js +> export function sayGoodbye(name) { +> return `Goodbye ${name}`; +> } +> ``` + + diff --git a/content/code.js b/content/code.js new file mode 100644 index 0000000..e14a3f6 --- /dev/null +++ b/content/code.js @@ -0,0 +1,7 @@ +export function sayHello(name) { + return `Hello ${name}`; +} + +export function sayGoodbye(name) { + return `Goodbye ${name}`; +} diff --git a/content/code.md b/content/code.md new file mode 100644 index 0000000..2c85301 --- /dev/null +++ b/content/code.md @@ -0,0 +1,29 @@ +# Example with embedded code + +## TypeScript + + + +```ts +export function sayHello(name: string): string { + return `Hello ${name}`; +} +``` + + + +## JavaScript + + + +```js +export function sayHello(name) { + return `Hello ${name}`; +} + +export function sayGoodbye(name) { + return `Goodbye ${name}`; +} +``` + +