Help language development. Donate to The Perl Foundation

cmark::Simple zef:jjmerelo last updated on 2022-12-19


cmark::Simple Test Raku

A straightforward wrapper for commonmark library


You need to install libcommonmark first, either from source or installing libcmark-dev from Debian repositories.

In the case of Ubuntu, you will need to manually copy the library to /usr/lib

sudo cp /usr/local/lib/ /usr/lib/

Latest version is 0.30.2. Use whatever version you've installed in your system.


use cmark::Simple;

say commonmark-to-html(q:to/EOC/);
# Header

## Another header

These symbols are also exported:

constant \CMARK_OPT_DEFAULT is export = 0;
constant \CMARK_OPT_SOURCEPOS  is export = 2;
constant \CMARK_OPT_HARDBREAKS  is export = 4;
constant \CMARK_OPT_SAFE  is export = 8;
constant \CMARK_OPT_UNSAFE is export = 131072;
constant \CMARK_OPT_NOBREAKS = 16;
constant \CMARK_OPT_NORMALIZE = 256;
constant \CMARK_OPT_VALIDATE_UTF8 = 512;
constant \CMARK_OPT_SMART = 1024;

sub cmark_markdown_to_html(Str $text,
                           int32 $len, int8 $options
                            --> Str )

Use them directly in case you need to have mrore flexibility, or options such as validating UTF8. Check the manual page for instructions.

See also

See the commonmark page for additional information; also the excellent Cmark module by Khalid Elboray an alternative, more flexible, complete port.


This module will be licensed, by default, under the Artistic 2.0 License (the same as Raku itself)