#markdown #html #latex #highlight #math-jax

bin+lib markdown2html-converter

A tool for converting a Markdown file to a single HTML file with built-in CSS and JS

25 stable releases

1.1.9 May 24, 2022
1.1.8 Mar 18, 2022
1.1.6 Sep 19, 2021
1.1.5 May 5, 2021
1.0.4 Oct 17, 2018

#721 in Command line utilities

Download history 5/week @ 2022-12-08 27/week @ 2022-12-15 9/week @ 2022-12-22 4/week @ 2022-12-29 7/week @ 2023-01-05 1/week @ 2023-01-12 9/week @ 2023-01-19 13/week @ 2023-01-26 3/week @ 2023-02-02 61/week @ 2023-02-09 76/week @ 2023-02-16 9/week @ 2023-02-23 4/week @ 2023-03-02 2/week @ 2023-03-09 54/week @ 2023-03-16 1/week @ 2023-03-23

61 downloads per month

MIT license

1.5MB
1.5K SLoC

JavaScript 1.5K SLoC // 0.0% comments Rust 286 SLoC

Markdown to HTML Converter

CI

Markdown to HTML Converter is a free tool for converting a Markdown file to a single HTML file with built-in CSS and JS.

Help

EXAMPLES:
markdown2html-converter /path/to/file.md                            # Convert /path/to/file.md to /path/to/file.html, titled "file"
markdown2html-converter /path/to/file.md -o /path/to/output.html    # Convert /path/to/file.md to /path/to/output.html, titled "output"
markdown2html-converter /path/to/file.md -t 'Hello World!'          # Convert /path/to/file.md to /path/to/file.html, titled "Hello World!"

USAGE:
    markdown2html-converter [OPTIONS] <MARKDOWN_PATH>

ARGS:
    <MARKDOWN_PATH>    Specify the path of your Markdown file

OPTIONS:
    -t, --title <TITLE>                              Specify the title of your HTML file
    -o, --html-path <HTML_PATH>                      Specify the path of your HTML file
        --no-safe                                    Allow raw HTML and dangerous URLs
        --no-highlight                               Not allow to use highlight.js
        --no-mathjax                                 Not allow to use mathjax.js
        --no-cjk-fonts                               Not allow to use CJK fonts
        --css-path <CSS_PATH>                        Specify the path of your custom CSS file
        --highlight-js-path <HIGHLIGHT_JS_PATH>      Specify the path of your custom highlight.js file
        --highlight-css-path <HIGHLIGHT_CSS_PATH>    Specify the path of your custom CSS file for highlight.js code blocks
        --mathjax-path-path <MATHJAX_JS_PATH>        Specify the path of your custom single MATH_JAX.js file
    -f, --force                                      Force to output if the HTML file exists
    -h, --help                                       Print help information
    -V, --version                                    Print version information

Dependency

Markdown is converted to HTML by the comrak crate. The default stylesheet (the CSS file) is from sindresorhus/github-markdown-css.

If ``` is used in the input Markdown file, the highlight.js will be automatically embedded in the output HTML file. The preset supported languages are listed below.

  • Apache
  • Bash
  • C
  • C#
  • C++
  • CSS
  • Diff
  • Dockerfile
  • Go
  • HTML, XML
  • JSON
  • Java
  • JavaScript
  • Kotlin
  • Less
  • Lua
  • Makefile
  • Markdown
  • Nginx
  • Objective-C
  • PHP
  • PHP Template
  • Perl
  • Python
  • Python REPL
  • R
  • Ruby
  • Rust
  • SCSS
  • SQL
  • Shell Session
  • Swift
  • TOML, INI
  • TypeScript
  • Visual Basic .NET
  • YAML

If #{{ - }}# or #{{{ - }}}# is used in the input Markdown file, the mathjax.js will be automatically embedded in the output HTML file. #{{ and }}# are inlineMath delimiters. #{{{ and }}}# are displayMath delimiters. The default mathjax.js are using the tex-mml-chtml configuration file.

A Markdown Example

The Markdown File

The HTML File

License

MIT

Dependencies

~12MB
~241K SLoC