9 releases

0.7.8 Jun 26, 2024
0.7.7 Jun 26, 2024
0.7.4 Jul 18, 2022
0.7.3 Jun 27, 2022
0.1.0 Apr 3, 2022

#75 in Template engine

Download history 9/week @ 2024-09-16 21/week @ 2024-09-23 15/week @ 2024-09-30

377 downloads per month

MIT license

70KB
2K SLoC

🧲 unidoc: Unite all Markdown.

crates.io Build Status

Install & Usage

$ cargo install unidoc

$ cat example.md | unidoc
$ unidoc example.md -o output.md
$ unidoc input1.md input2.md input3.md -o output.md

$ unidoc --help  # for more detail

Syntax

Text

*emphasis*
_emphasis_
**strong**
__strong__
***Emphasis and Strong***
~~deleted~~

![alt](image-link-Path-or-URL)

[text](link)

`inline code`

<!-- this is hidden comment -->

Headings

% h1
# h1
## h2
### h3
...
###### h6

List

- one
- two
- three

- any bullet is ok
    + plus
        * astersk

1. ordered with numbers
2. hgoehoge

a. with alphabets
a. hogehoge

- task list
    - [ ] not yet
    - [x] already done

Paragraph, Quoting

Text blocks separated with empty lines are paragraphs.

this is paragraph1.
this is paragraph1.
this is paragraph1.

this is paragraph2.  this is paragraph2.
this is paragraph2.

> This is quoted.  This is quoted.
> This is quoted.

Code block

```
def code():
    return code
```

```python
def code():
    return code
```

Prism.js will be used for Syntax highlight. Please check this to see language support.

Table

| A | B |   C   |   D |
|---|:--| :----:| --: |
| a | b |   c   |  d  |
| 1 | 2 |   3   |  4  |

Hr

---

Extended Syntax

MathJax Support

MathJax@3 works for

$inline-math-tex$
$$display-math-tex$$

Import Another Markdown

@(./relative/another.md)

Import Code

@[rust](./sample.rs)
This is inline hyperlink: [[http://example.com]].
Hyperlink as a block generates Blogcard:

{{ https://cympfh.cc/ }}

😂 Emojis

:(emoji-shortcode):
:joy: :cry: :+1:

Github style shortcodes are available. Awesome cheatsheet is here.

Template

unidoc uses Handlebars for rendering. --template can specify your customized template file (.hbs) and -V passes free variables.

Variable (crate::template::Context)

  • title
    • PageTtitle
  • body
    • body HTML
  • headers
    • Vec of files
    • --include-in-header, -H
  • befores
    • Vec of files
    • --include-before-body, -B
  • afters
    • Vec of files
    • --include-after-body, -A
  • css
    • Vec of files
    • --css, -C
  • variables
    • HashMap<String, String>
    • --variable, -V
      • -V KEY:VALUE in CLI
      • {{variable.KEY}} in Handlebars

Dependencies

~16–30MB
~466K SLoC