This is an example site of satro: https://github.com/sakkyoi/satro
Back
Authoring Example of MDX
Published at Sep 16, 2024
example

huan-gîng! fonˊngiangˇ! 你好! Hello! Willkommen! ようこそ! 🌏

This is an example of authoring an MDX file for your blog post.

Heading

Headings are created by prefixing a line with one or more # characters. The number of # characters at the beginning of the line indicates the level of the heading.

Note: table of contents is automatically generated based on the headings. You should start the heading level from H1, or the table of contents will not be generated. In addition, only H1 and H2 are displayed in the table of contents.

1
# H1
2
## H2
3
### H3
4
#### H4
5
##### H5
6
###### H6

H1

H2

H3

H4

H5
H6

Texts

Text is written in paragraphs. Paragraphs are separated by one or more blank lines. You can use bold, italic, and strikethrough text. Also, you can use inline code.

And something special like:

MDX

H2O

(X - h)2 / a2 + (Y - k)2 / b2 = 1, or in LaTeX: (Xh)2a2+(Yk)2b2=1\frac{(X - h)^2}{a^2} + \frac{(Y - k)^2}{b^2} = 1

Press ALT + F4 to get something special.

highlight text

Icons

1
<iconify-icon icon="f7:cat" width="24"></iconify-icon>

You can use icons from Iconify hello by using the <iconify-icon> component.

Footnotes

Footnotes are created by wrapping the footnote text in square brackets [] and the footnote in parentheses (). The footnote will be displayed at the bottom of the page.

1
This is an example of a footnote[^1].
2
3
[^1]: This is the footnote.

This is an example of a footnote 1 .

Links

Links are created by wrapping the link text in square brackets [] and the URL in parentheses ().

1
[Satro](https://github.com/sakkyoi/satro)

If the link is a reference to another site, it will open in a new tab. And will be have a icon next to it: Satro hello .

1
[Readme](/article/readme)

If the link is a reference to another page on the site, it will open in the same tab: Readme .

Note: internal links must be prefixed with /.

1
[Jump to Heading](#heading)

If the link is a reference to another section on the same page, it will jump to that section: Jump to Heading .

Lists

Lists are created by prefixing lines with -, *, or 1..

Unordered List

1
- Unordered list item 1
2
- Unordered list item 2
3
* Unordered list item 2.1
4
* Unordered list item 2.2
5
* Unordered list item 2.3
6
- Unordered list item 3
  • Unordered list item 1
  • Unordered list item 2
    • Unordered list item 2.1
    • Unordered list item 2.2
    • Unordered list item 2.3
  • Unordered list item 3

Ordered List

1
1. Ordered list item 1
2
2. Ordered list item 2
3
3. Ordered list item 3
  1. Ordered list item 1
  2. Ordered list item 2
  3. Ordered list item 3

Images

Images are created by wrapping the image text in square brackets [], the URL in parentheses () and start with an exclamation mark !.

1
![Example](/example.png)

Example

Note: images must start with /. And the image file must be in the image directory. Subdirectories are allowed.

Tables

Tables are created by using pipes | to separate columns and hyphens - to separate the header from the body.

1
| Header 1 | Header 2 | Header 3 |
2
| -------- | -------- | -------- |
3
| Row 1 | Row 1 | Row 1 |
4
| Row 2 | Row 2 | Row 2 |
5
| Row 3 | Row 3 | Row 3 |
Header 1Header 2Header 3
Row 1Row 1Row 1
Row 2Row 2Row 2
Row 3Row 3Row 3

Code Blocks

Code blocks are generated by Expressive Code hello . They are created by wrapping the code in triple backticks ```.

With title

example-script.js
1
$(window).on('keypress', (e) => {
2
if (e.key == 'r') {
3
alert('You pressed the "r" key!');
4
const a = document.createElement('a');
5
a.target = '_blank';
6
a.href = 'https://www.youtube.com/watch?v=dQw4w9WgXcQ';
7
a.click();
8
}
9
});

Line Marking

$(window).on('keypress', (e) => {
if (e.key == 'r') {
alert('You pressed the "r" key!');
if (e.key == 'a') {
console.log('You pressed the "a" key!');
const a = document.createElement('a');
a.target = '_blank';
a.href = 'https://www.youtube.com/watch?v=dQw4w9WgXcQ';
a.click();
}
});

Marking Individually

4
const a = document.createElement('a');
5
a.target = '_blank';
6
a.href = 'https://www.youtube.com/watch?v=dQw4w9WgXcQ';
7
a.click();
8
}
9
});

More information about code blocks can be found in the Expressive Code documentation hello , there are so many features that you can use.

Footnotes

  1. This is the footnote.

authoring mdx example