kc3-lang/md4c/README.md

Download

Build status (travis-ci.com) Build status (appveyor.com) Coverity Scan Build Status Codecov

MD4C Readme

MD4C stands for “Markdown for C” and, unsurprisingly, it is a C Markdown parser implementation.

What is Markdown

In short, Markdown is the markup language this README.md file is written in.

The following resources can explain more if you are unfamiliar with it:

What is MD4C

MD4C is C Markdown parser with the following features:

Using MD4C

Application has to include the header md4c.h and link against MD4C library; or alternatively it may include md4c.h and md4c.c directly into its source base as the parser is only implemented in the single C source file.

The main provided function is md_parse(). It takes a text in Markdown syntax as an input and a pointer to a structure which holds pointers to several callback functions.

As md_parse() processes the input, and it calls the appropriate callbacks (when entering or leaving any Markdown block or span; and when outputting any textual content of the document), allowing application to convert it into another format or render it onto the screen.

More comprehensive guide can be found in the header md4c.h and also on MD4C wiki.

Example implementation of simple renderer is available in the md2html directory which implements a conversion utility from Markdown to HTML.

Markdown Extensions

The default behavior is to recognize only elements defined by the CommonMark specification.

However with appropriate flags, the behavior can be tuned to enable some extensions:

The syntax of the extensions is described on MD4C wiki.

Few features (those some people see as mis-features) of CommonMark specification may be disabled:

Input/Output Encoding

The CommonMark specification generally assumes UTF-8 input, but under closer inspection, Unicode plays any role in few very specific situations when parsing Markdown documents:

MD4C relies on this property of the CommonMark and the implementation is, to a large degree, encoding-agnostic. Most of MD4C code only assumes that the encoding of your choice is compatible with ASCII, i.e. that the codepoints below 128 have the same numeric values as ASCII.

Any input MD4C does not understand is simply seen as part of the document text and sent to the renderer’s callback functions unchanged.

The two situations where MD4C has to understand Unicode are handled accordingly to the following preprocessor macros:

(Adding support for yet another encodings should be relatively simple due the isolation of the respective code.)

License

MD4C is covered with MIT license, see the file LICENSE.md.

Reporting Bugs

If you encounter any bug, please be so kind and report it. Unheard bugs cannot get fixed. You can submit bug reports here:


Source

Download