ukarim / ngx_markdown_filter_module

Markdown-to-html nginx module

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

  1. Clone this repo

  2. Install cmark lib with development headers

dnf install cmark-devel
  1. Download nginx src archive and unpack it

  2. Run configure script (see nginx src) and build nginx

> ./configure --add-module=/path/to/ngx_markdown_filter_module
> make
  1. 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.

  1. Clone this repo

  2. Rename config_gfm to config

  3. Install cmark-gfm lib

  4. Download nginx src archive and unpack it

  5. Run configure script (see nginx src) and build nginx

> ./configure --add-module=/path/to/ngx_markdown_filter_module --with-cc-opt=-DWITH_CMARK_GFM=1
> make
  1. Apply markdown directives to nginx conf and run it

About

Markdown-to-html nginx module

License:MIT License


Languages

Language:C 94.4%Language:HTML 5.6%