Skip to content

Commit ea144fa

Browse files
committed
Add shortcodes to the README
1 parent 7be2585 commit ea144fa

File tree

1 file changed

+40
-39
lines changed

1 file changed

+40
-39
lines changed

README.md

Lines changed: 40 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ Collective](https://opencollective.com/comrak/all/badge.svg?label=financial+cont
88

99
Rust port of [github's `cmark-gfm`](https://github.com/github/cmark).
1010

11-
- [Installation](#installation)
12-
- [Usage](#usage)
13-
- [Security](#security)
14-
- [Extensions](#extensions)
15-
- [Related projects](#related-projects)
16-
- [Contributing](#contributing)
17-
- [Legal](#legal)
11+
- [Installation](#installation)
12+
- [Usage](#usage)
13+
- [Security](#security)
14+
- [Extensions](#extensions)
15+
- [Related projects](#related-projects)
16+
- [Contributing](#contributing)
17+
- [Legal](#legal)
1818

1919
## Installation
2020

2121
Specify it as a requirement in `Cargo.toml`:
2222

23-
``` toml
23+
```toml
2424
[dependencies]
2525
comrak = "0.15"
2626
```
@@ -29,19 +29,19 @@ Comrak supports Rust stable.
2929

3030
### Mac & Linux Binaries
3131

32-
``` bash
32+
```bash
3333
curl https://webinstall.dev/comrak | bash
3434
```
3535

3636
### Windows 10 Binaries
3737

38-
``` powershell
38+
```powershell
3939
curl.exe -A "MS" https://webinstall.dev/comrak | powershell
4040
```
4141

4242
## Usage
4343

44-
``` console
44+
```console
4545
$ comrak --help
4646
A 100% CommonMark-compatible GitHub Flavored Markdown parser and formatter
4747

@@ -54,7 +54,7 @@ Arguments:
5454
Options:
5555
-c, --config-file <PATH>
5656
Path to config file containing command-line arguments, or 'none'
57-
57+
5858
[default: /Users/kivikakk/.config/comrak/config]
5959

6060
--hardbreaks
@@ -81,15 +81,15 @@ Options:
8181

8282
-e, --extension <EXTENSION>
8383
Specify extension name(s) to use
84-
84+
8585
Multiple extensions can be delimited with ",", e.g. --extension strikethrough,table
86-
86+
8787
[possible values: strikethrough, tagfilter, table, autolink, tasklist, superscript,
88-
footnotes, description-lists]
88+
footnotes, description-lists, shortcodes]
8989

9090
-t, --to <FORMAT>
9191
Specify output format
92-
92+
9393
[default: html]
9494
[possible values: html, commonmark]
9595

@@ -98,7 +98,7 @@ Options:
9898

9999
--width <WIDTH>
100100
Specify wrap width (0 = nowrap)
101-
101+
102102
[default: 0]
103103

104104
--header-ids <PREFIX>
@@ -109,12 +109,12 @@ Options:
109109

110110
--syntax-highlighting <THEME>
111111
Syntax highlighting for codefence blocks. Choose a theme or 'none' for disabling
112-
112+
113113
[default: base16-ocean.dark]
114114

115115
--list-style <LIST_STYLE>
116116
Specify bullet character for lists (-, +, *) in CommonMark ouput
117-
117+
118118
[default: dash]
119119
[possible values: dash, plus, star]
120120

@@ -131,15 +131,15 @@ the file does not exist.
131131

132132
And there's a Rust interface. You can use `comrak::markdown_to_html` directly:
133133

134-
``` rust
134+
```rust
135135
use comrak::{markdown_to_html, ComrakOptions};
136136
assert_eq!(markdown_to_html("Hello, **世界**!", &ComrakOptions::default()),
137137
"<p>Hello, <strong>世界</strong>!</p>\n");
138138
```
139139

140140
Or you can parse the input into an AST yourself, manipulate it, and then use your desired formatter:
141141

142-
``` rust
142+
```rust
143143
extern crate comrak;
144144
use comrak::{parse_document, format_html, Arena, ComrakOptions};
145145
use comrak::nodes::{AstNode, NodeValue};
@@ -196,19 +196,20 @@ use of a sanitisation library like [`ammonia`](https://github.com/notriddle/ammo
196196
Comrak supports the five extensions to CommonMark defined in the [GitHub Flavored Markdown
197197
Spec](https://github.github.com/gfm/):
198198

199-
- [Tables](https://github.github.com/gfm/#tables-extension-)
200-
- [Task list items](https://github.github.com/gfm/#task-list-items-extension-)
201-
- [Strikethrough](https://github.github.com/gfm/#strikethrough-extension-)
202-
- [Autolinks](https://github.github.com/gfm/#autolinks-extension-)
203-
- [Disallowed Raw HTML](https://github.github.com/gfm/#disallowed-raw-html-extension-)
199+
- [Tables](https://github.github.com/gfm/#tables-extension-)
200+
- [Task list items](https://github.github.com/gfm/#task-list-items-extension-)
201+
- [Strikethrough](https://github.github.com/gfm/#strikethrough-extension-)
202+
- [Autolinks](https://github.github.com/gfm/#autolinks-extension-)
203+
- [Disallowed Raw HTML](https://github.github.com/gfm/#disallowed-raw-html-extension-)
204204

205205
Comrak additionally supports its own extensions, which are yet to be specced out (PRs welcome\!):
206206

207-
- Superscript
208-
- Header IDs
209-
- Footnotes
210-
- Description lists
211-
- Front matter
207+
- Superscript
208+
- Header IDs
209+
- Footnotes
210+
- Description lists
211+
- Front matter
212+
- Shortcodes
212213

213214
By default none are enabled; they are individually enabled with each parse by setting the appropriate values in the
214215
[`ComrakOptions` struct](https://docs.rs/comrak/newest/comrak/struct.ComrakOptions.html).
@@ -238,17 +239,17 @@ in terms of code structure. The upside of this is that a change in `cmark-gfm` h
238239
Likewise, any bug in `cmark-gfm` is likely to be reproduced in Comrak. This could be considered a pro or a con,
239240
depending on your use case.
240241

241-
The downside, of course, is that the code is not what I'd call idiomatic Rust (*so many `RefCell`s*), and while
242+
The downside, of course, is that the code is not what I'd call idiomatic Rust (_so many `RefCell`s_), and while
242243
contributors and I have made it as fast as possible, it simply won't be as fast as some other CommonMark parsers
243244
depending on your use-case. Here are some other projects to consider:
244245

245-
- [Raph Levien](https://github.com/raphlinus)'s [`pulldown-cmark`](https://github.com/google/pulldown-cmark). It's
246-
very fast, uses a novel parsing algorithm, and doesn't construct an AST (but you can use it to make one if you
247-
want). `cargo doc` uses this, as do many other projects in the ecosystem.
248-
- [Ben Navetta](https://github.com/bnavetta)'s [`rcmark`](https://github.com/bnavetta/rcmark) is a set of bindings to
249-
`libcmark`. It hasn't been updated in a while, though there's an [open pull
250-
request](https://github.com/bnavetta/rcmark/pull/2).
251-
- Know of another library? Please open a PR to add it\!
246+
- [Raph Levien](https://github.com/raphlinus)'s [`pulldown-cmark`](https://github.com/google/pulldown-cmark). It's
247+
very fast, uses a novel parsing algorithm, and doesn't construct an AST (but you can use it to make one if you
248+
want). `cargo doc` uses this, as do many other projects in the ecosystem.
249+
- [Ben Navetta](https://github.com/bnavetta)'s [`rcmark`](https://github.com/bnavetta/rcmark) is a set of bindings to
250+
`libcmark`. It hasn't been updated in a while, though there's an [open pull
251+
request](https://github.com/bnavetta/rcmark/pull/2).
252+
- Know of another library? Please open a PR to add it\!
252253

253254
As far as I know, Comrak is the only library to implement all of the [GitHub Flavored Markdown
254255
extensions](https://github.github.com/gfm) to the spec, but this tends to only be important if you want to reproduce

0 commit comments

Comments
 (0)