Skip to content

Commit 9f8fa59

Browse files
authored
markdown example improvements (#1360)
1 parent 0c69ff7 commit 9f8fa59

File tree

7 files changed

+99
-8
lines changed

7 files changed

+99
-8
lines changed

examples/markdown-it-container/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[Framework examples →](../)
22

3-
# Framework + markdown-it-container
3+
# markdown-it-container
44

55
View live: <https://observablehq.observablehq.cloud/framework-example-markdown-it-container/>
66

+38-1
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,50 @@
1-
# Framework + markdown-it-container
1+
# markdown-it-container
22

3+
This Framework example demonstrates how to use [`markdown-it-container`](https://github.com/markdown-it/markdown-it-container), which extends Markdown to allow `:::` syntax for styled containers.
4+
5+
First, install `markdown-it-container` with your preferred package manager such as npm or Yarn. Then, register the plugin using the **markdownIt** config option in your `observablehq.config.js` file. Declare as many custom containers as you like; below, we register three (`card`, `tip`, and `warning` — each corresponding to classes that are built-in to Framework).
6+
7+
```js run=false
8+
import MarkdownItContainer from "markdown-it-container";
9+
10+
export default {
11+
root: "src",
12+
markdownIt: (md) =>
13+
md
14+
.use(MarkdownItContainer, "card") // ::: card
15+
.use(MarkdownItContainer, "tip") // ::: tip
16+
.use(MarkdownItContainer, "warning") // ::: warning
17+
};
18+
```
19+
20+
Below are some examples.
21+
22+
::: card
23+
That’s a _nice_ card, ain’t it?
24+
:::
25+
26+
```md run=false
327
::: card
428
That’s a _nice_ card, ain’t it?
529
:::
30+
```
631

732
::: tip
833
That’s a _nice_ **tip**, ain’t it?
934
:::
1035

36+
```md run=false
37+
::: tip
38+
That’s a _nice_ **tip**, ain’t it?
39+
:::
40+
```
41+
42+
::: warning
43+
That’s a _nice_ **warning**, ain’t it?
44+
:::
45+
46+
```md run=false
1147
::: warning
1248
That’s a _nice_ **warning**, ain’t it?
1349
:::
50+
```

examples/markdown-it-footnote/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[Framework examples →](../)
22

3-
# Framework + markdown-it-footnote
3+
# markdown-it-footnote
44

55
View live: <https://observablehq.observablehq.cloud/framework-example-markdown-it-footnote/>
66

+37-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,46 @@
1-
# Framework + markdown-it-footnote
1+
# markdown-it-footnote
2+
3+
This Framework example demonstrates how to use [`markdown-it-footnote`](https://github.com/markdown-it/markdown-it-footnote) to create footnotes in Markdown.
4+
5+
First, install `markdown-it-footnote` with your preferred package manager such as npm or Yarn. Then, register the plugin using the **markdownIt** config option in your `observablehq.config.js` file.
6+
7+
```js run=false
8+
import MarkdownItFootnote from "markdown-it-footnote";
9+
10+
export default {
11+
root: "src",
12+
markdownIt: (md) => md.use(MarkdownItFootnote)
13+
};
14+
```
15+
16+
Below is an example of referencing a footnote.
217

318
Here is a footnote reference,[^1] and another.[^longnote]
419

20+
```md run=false
21+
Here is a footnote reference,[^1] and another.[^longnote]
22+
```
23+
24+
And here is how you can define the footnotes.
25+
526
[^1]: Here is the footnote.
627
[^longnote]: Here's one with multiple blocks.
728

829
Subsequent paragraphs are indented to show that they
930
belong to the previous footnote.
1031

11-
For more, see <https://observablehq.com/framework/getting-started>.
32+
```md run=false
33+
[^1]: Here is the footnote.
34+
[^longnote]: Here's one with multiple blocks.
35+
36+
Subsequent paragraphs are indented to show that they
37+
belong to the previous footnote.
38+
```
39+
40+
Footnotes always appear at the bottom of the page, regardless of where they are defined. The remaining text is gibberish so that the page is taller, allowing you to try clicking on the footnote references to scroll down and then clicking on ther return link to scroll back up again.
41+
42+
Aliquam porta accumsan eros, ut posuere lorem congue at. Cras lobortis metus sit amet ex ullamcorper lobortis. Donec vitae nulla dictum, cursus nunc auctor, facilisis tellus. Morbi iaculis ex sed nisi tristique, a auctor elit suscipit. Vestibulum varius, massa in laoreet facilisis, quam arcu dictum metus, sit amet ultricies erat metus non elit. Quisque fringilla gravida sapien non facilisis. Aliquam a ligula vitae tellus rutrum tincidunt. Integer mattis suscipit ex vel egestas. Aenean pharetra sit amet tellus ac tempus.
43+
44+
Cras dapibus porta posuere. Aenean tempus nulla eget sem auctor, eget interdum urna sodales. Mauris ullamcorper nec ipsum in tempor. Pellentesque eleifend rutrum nunc eu aliquam. Aliquam quis tellus ligula. Mauris mattis quis nibh vel tincidunt. Aliquam aliquam scelerisque nisl, ac aliquam arcu accumsan et. Nunc tempor condimentum quam a ullamcorper. Aliquam imperdiet ac neque in maximus. Proin urna urna, feugiat sed placerat vitae, fringilla ac diam. Morbi ac ipsum nunc.
45+
46+
Morbi placerat sodales ex, a eleifend quam interdum a. Nullam tellus sem, convallis a finibus a, placerat sed ante. Nullam sit amet dictum mauris. In sed mattis risus, et pulvinar eros. Pellentesque commodo urna ipsum, vitae euismod erat mollis a. Sed ornare, turpis in maximus dapibus, urna nibh dictum leo, suscipit mattis diam tellus ac ante. Vestibulum placerat, justo sit amet ultricies ultricies, orci massa aliquam purus, id ullamcorper odio urna nec leo.

examples/markdown-it-wikilinks/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[Framework examples →](../)
22

3-
# Hello, markdown-it-wikilinks
3+
# markdown-it-wikilinks
44

55
View live: <https://observablehq.observablehq.cloud/framework-example-markdown-it-wikilinks/>
66

examples/markdown-it-wikilinks/observablehq.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
root: "src",
55

66
// Register the markdown-it-wikilinks plugin.
7-
markdownIt: (md) => md.use(MarkdownItWikilinks({})),
7+
markdownIt: (md) => md.use(MarkdownItWikilinks()),
88

99
// Shared Observable example configuration; feel free to remove this.
1010
title: "Observable Framework",
+20-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1-
# Hello, markdown-it-wikilinks
1+
# markdown-it-wikilinks
22

3+
This Framework example demonstrates how to use [`markdown-it-wikilinks`](https://github.com/jsepia/markdown-it-wikilinks) to create Wikimedia-style links in Markdown.
4+
5+
First, install `markdown-it-wikilinks` with your preferred package manager such as npm or Yarn. Then, register the plugin using the **markdownIt** config option in your `observablehq.config.js` file.
6+
7+
```js run=false
8+
import MarkdownItWikilinks from "markdown-it-wikilinks";
9+
10+
export default {
11+
root: "src",
12+
markdownIt: (md) => md.use(MarkdownItWikilinks())
13+
};
14+
```
15+
16+
Below is an example of a wikilink.
17+
18+
Click [[Wiki Links|here]] to learn about [[/Wiki]] links.
19+
20+
```md run=false
321
Click [[Wiki Links|here]] to learn about [[/Wiki]] links.
22+
```

0 commit comments

Comments
 (0)