Top |
A SnapdMarkdownParser parses text formatted in markdown; for example the text returned by snapd_snap_get_description()
.
Snap supports the following subset of CommonMark (https://commonmark.org):
Indented Code Blocks
Paragraphs
Blank Lines
Unordered Lists
Backslash escapes
Code spans
In addition text that contains URLs are converted into links.
Use snapd_markdown_parser_parse()
to convert text into a tree of
SnapdMarkdownNode that you can then process to display in your client.
SnapdMarkdownParser *
snapd_markdown_parser_new (SnapdMarkdownVersion version
);
Create an object to parse markdown text.
Since: 1.48
gboolean
snapd_markdown_parser_get_preserve_whitespace
(SnapdMarkdownParser *parser
);
Check if paragraph whitespace will be kept intact.
Since: 1.48
void snapd_markdown_parser_set_preserve_whitespace (SnapdMarkdownParser *parser
,gboolean preserve_whitespace
);
Consecutive paragraph whitespace (space, tabs, newlines) is automatically
combined into a single space character. This renders the paragraphs in the
form that HTML uses. If you need the original whitespace that the markdown
author wrote then set this to FALSE
.
Since: 1.48
GPtrArray * snapd_markdown_parser_parse (SnapdMarkdownParser *parser
,const gchar *text
);
Convert text in snapd markdown format to markup.
Since: 1.48
typedef struct _SnapdMarkdownParser SnapdMarkdownParser;
SnapdMarkdownParser is an opaque data structure and can only be accessed using the provided functions.
Since: 1.48
Version of markdown to parse. Picking a version will ensure only nodes of the expected type are decoded.
Since: 1.48