ngx_markdown_filter_module
ngx_markdown_filter_module copied to clipboard
Markdown-to-html nginx module
ngx_markdown_filter_module
The ngx_markdown_filter_module module is a filter that transforms markdown files to html format.
This module utilizes the cmark library.
Example configuration
location ~ \.md {
markdown_filter on;
markdown_template html/template.html;
}
This works on proxy locations as well.
Directives
Syntax: markdown_filter on;
Context: location
Syntax: markdown_template html/template.html;
Context: location
Build
-
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
Build with cmark-gfm (tables support)
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