docsify/docs/helpers.md

163 lines
2.7 KiB
Markdown
Raw Normal View History

2017-02-13 22:43:58 +08:00
# Doc helper
docsify extends Markdown syntax to make your documents more readable.
> Note: For the special code syntax cases, it's better to put them within code backticks to avoid any conflict from configurations or emojis.
## Important content
2017-02-13 22:43:58 +08:00
2017-03-10 05:19:07 +08:00
Important content like:
2017-02-13 22:43:58 +08:00
```markdown
!> **Time** is money, my friend!
```
2017-03-10 05:19:07 +08:00
is rendered as:
2017-02-13 22:43:58 +08:00
2017-03-10 05:19:07 +08:00
!> **Time** is money, my friend!
2017-02-13 22:43:58 +08:00
## General tips
2017-03-10 05:19:07 +08:00
General tips like:
2017-02-13 22:43:58 +08:00
```markdown
2018-02-11 20:50:48 +08:00
?> _TODO_ unit test
2017-02-13 22:43:58 +08:00
```
2017-03-10 05:19:07 +08:00
are rendered as:
2017-02-13 22:43:58 +08:00
2018-02-11 20:50:48 +08:00
?> _TODO_ unit test
## Ignore to compile link
Sometimes we will use some other relative path for the link, and we have to tell docsify that we don't need to compile this link. For example:
```md
[link](/demo/)
```
It will be compiled to `<a href="/#/demo/">link</a>` and will load `/demo/README.md`. Maybe you want to jump to `/demo/index.html`.
Now you can do that
```md
2018-02-11 20:50:48 +08:00
[link](/demo/ ':ignore')
```
2018-02-11 20:50:48 +08:00
You will get `<a href="/demo/">link</a>`html. Do not worry, you can still set the title for the link.
```md
2018-02-11 20:50:48 +08:00
[link](/demo/ ':ignore title')
<a href="/demo/" title="title">link</a>
```
## Set target attribute for link
```md
2018-02-11 20:50:48 +08:00
[link](/demo ':target=_blank')
[link](/demo2 ':target=_self')
```
## Disable link
```md
2018-02-11 20:50:48 +08:00
[link](/demo ':disabled')
```
## GitHub Task Lists
```md
- [ ] foo
- bar
- [x] baz
- [] bam <~ not working
- [ ] bim
- [ ] lim
```
- [ ] foo
- bar
- [x] baz
- [] bam <~ not working
- [ ] bim
- [ ] lim
## Image
### Resizing
```md
![logo](https://docsify.js.org/_media/icon.svg ':size=WIDTHxHEIGHT')
![logo](https://docsify.js.org/_media/icon.svg ':size=50x100')
![logo](https://docsify.js.org/_media/icon.svg ':size=100')
2018-07-05 16:50:21 +08:00
<!-- Support percentage -->
2018-07-05 16:50:21 +08:00
![logo](https://docsify.js.org/_media/icon.svg ':size=10%')
```
![logo](https://docsify.js.org/_media/icon.svg ':size=50x100')
![logo](https://docsify.js.org/_media/icon.svg ':size=100')
2018-07-05 16:50:21 +08:00
![logo](https://docsify.js.org/_media/icon.svg ':size=10%')
2018-11-01 08:07:10 +08:00
### Customise class
```md
![logo](https://docsify.js.org/_media/icon.svg ':class=someCssClass')
```
### Customise ID
```md
![logo](https://docsify.js.org/_media/icon.svg ':id=someCssId')
```
2018-11-01 08:07:10 +08:00
## Customise ID for headings
```md
### Hello, world! :id=hello-world
```
## Markdown in html tag
You need to insert a space between the html and markdown content.
This is useful for rendering markdown content in the details element.
```markdown
<details>
<summary>Self-assessment (Click to expand)</summary>
- Abc
- Abc
</details>
```
<details>
<summary>Self-assessment (Click to expand)</summary>
- Abc
- Abc
</details>
Markdown content can also be wrapped in html tags.
```markdown
<div style='color: red'>
- listitem
- listitem
- listitem
</div>
```
<div style='color: red'>
- Abc
- Abc
</div>