The ngx_markdown_filter_module module is a filter that transforms markdown files to html format.
This module utilizes the cmark library.
location ~ \.md {
markdown_filter on;
markdown_template html/template.html;
}
This works on proxy locations as well.
Syntax: markdown_filter on|off;
Context: location
Syntax: markdown_template html/template.html;
Context: location
# enable `unsafe` mode for cmark
Syntax: markdown_unsafe on|off;
Context: location;
# enable `tagfilter` extension for cmark-gfm
Syntax: markdown_gfm_tagfilter on|off;
Context: location;
# enable `tasklist` extension for cmark-gfm
Syntax: markdown_gfm_tasklist on|off;
Context: location;
# enable `strikethrough` extension for cmark-gfm
Syntax: markdown_gfm_strikethrough on|off;
Context: location;
# enable `autolink` extension for cmark-gfm
Syntax: markdown_gfm_autolink on|off;
Context: location;
-
Clone this repo
-
Install
cmarklib with development headers
dnf install cmark-devel
-
Download nginx src archive and unpack it
-
Run
configurescript (see nginx src) and build nginx
> ./configure --add-module=/path/to/ngx_markdown_filter_module
> make
- Apply markdown directives to nginx conf and run it
Original cmark library doesn't support tables. But there is cmark-gfm fork with table extension, supported by Github.
-
Clone this repo
-
Rename
config_gfmtoconfig -
Install
cmark-gfmlib -
Download nginx src archive and unpack it
-
Run
configurescript (see nginx src) and build nginx
> ./configure --add-module=/path/to/ngx_markdown_filter_module --with-cc-opt=-DWITH_CMARK_GFM=1
> make
- Apply markdown directives to nginx conf and run it