2个版本
0.1.1 | 2024年2月3日 |
---|---|
0.1.0 | 2024年2月3日 |
#1093 in Web编程
15KB
155 行
mx
带有额外🚀力量的markdown!
这是什么
mx是一个markdown渲染器,它通过一些额外功能扩展了原始markdown语法。
它使markdown更强大、更具表现力,同时仍然与原始markdown语法兼容。
Markdown
如预期,mx支持原始markdown语法及其所有功能。它将渲染所有内容,就像预期的那样。但此外,它还可以生成带有自定义CSS和JS的导出文件。
基本语法
标题
# Heading 1
## Heading 2
### Heading 3
#### Heading 4
##### Heading 5
###### Heading 6
这是一个标题:# 标题
,不要这样做: #标题
强调
Emphasis, aka italics, with *asterisks* or _underscores_.
Strong emphasis, aka bold, with **asterisks** or __underscores__.
Combined emphasis with **asterisks and _underscores_**.
Strikethrough uses two tildes. ~~Scratch this.~~
换行
First line with two spaces after.
And the next line.
列表
有序列表
1. First item
2. Second item
3. Third item
无序列表
- First item
- Second item
- Third item
链接
Link with text: [link-text](https://www.google.com)
图像
Image with alt text: 
Image without alt text: 
代码块
内联代码块
Inline `code` has `back-ticks around` it.
代码块
```javascript var s = "JavaScript syntax highlighting"; alert(s); ``` ```python s = "Python syntax highlighting" print s ``` ``` No language indicated, so no syntax highlighting. But let's throw in a tag. ```
表格
每个标题单元格之间必须有至少三个短横线。外部的管道(|)是可选的,您不需要让原始Markdown对齐整齐。
| Heading 1 | Heading 2 | Heading 3 |
|---|---|---|
| col1 | col2 | col3 |
| col1 | col2 | col3 |
任务列表
要创建任务列表,请从空方括号和空格开始行。例如:[ ] 并添加任务文本。要检查任务,请将方括号之间的空格替换为“x”。
[x] Write the post
[ ] Update the website
[ ] Contact the user
参考
链接: markdown指南
额外功能
除了原始markdown语法之外,mx还支持一些额外功能,使其更强大、更具表现力。让我们看看它们的效果。
自定义CSS和JS
您可以通过直接在markdown文件中添加它们来向markdown文件添加自定义CSS和JS。例如,您可以添加自定义CSS文件如下
/* custom.css */
body {
background-color: #f0f0f0;
}
h1 {
color: red;
}
一个普通的markdown渲染器将只将其显示为代码块,但mx会智能地排除代码块输出,并将其作为标题级别样式包含。
自定义HTML
您可以通过直接在markdown文件中添加它们来向markdown文件添加自定义HTML。例如,您可以添加自定义HTML如下
依赖关系
~8–18MB
~256K SLoC