func¶
markdown_to_html¶
- cmarkwrapper.func.markdown_to_html(text, breaks=False, safe=True, sourcepos=False, smart=Option.OPT_SMART)¶
Convert markup to HTML.
- 参数
text (str) -- Text marked up with CommonMark.
breaks (Union[bool, cmarkwrapper.types.LineBreaks]) -- bool or LineBreaks How line breaks in text will be rendered. If
True,"soft", orLineBreaks.soft-- as newlines (\n). IfFalse-- as spaces. If"hard"orLineBreaks.hard-- as<br />s.safe (bool) -- When
True, replace raw HTML (that was present intext)with HTML comment.sourcepos (bool) -- If
True, adddata-sourceposattribute to block elements(that is, useCMARK_OPT_SOURCEPOS).smart (cmarkwrapper.types.Option) -- Use
OPT_SMART.
- 返回
HTML string.
- 返回类型
str
markdown_to_xml¶
- cmarkwrapper.func.markdown_to_xml(text, sourcepos=False, smart=Option.OPT_SMART)¶
Convert markup to XML.
- 参数
text (str) --
Text marked up with CommonMark.
sourcepos (bool) -- If
True, addsourceposattribute to all block elements(that is, useCMARK_OPT_SOURCEPOS).smart (cmarkwrapper.types.Option) -- Use
OPT_SMART.
- 返回
XML string.
- 返回类型
str
markdown_to_commonmark¶
- cmarkwrapper.func.markdown_to_commonmark(text, breaks=False, width=0, smart=Option.OPT_SMART)¶
Convert markup to CommonMark.
- 参数
text (str) --
Text marked up with CommonMark.
breaks (Union[bool, cmarkwrapper.types.LineBreaks]) -- bool or LineBreaks How line breaks will be rendered. If
True,"soft", orLineBreaks.soft-- as newlines (\n). IfFalse-- as spaces. If"hard"orLineBreaks.hard-- “soft break nodes” (single newlines) are rendered as two spaces and\n.width (int) -- Wrap width of output by inserting line breaks (default is``0``—no wrapping). Has no effect if
breaksare set to be``"hard"`` (e.g. withLineBreaks.hard).smart (cmarkwrapper.types.Option) -- Use
OPT_SMART.
- 返回
CommonMark string.
- 返回类型
str
markdown_to_man¶
- cmarkwrapper.func.markdown_to_man(text, breaks=False, width=0, smart=Option.OPT_SMART)¶
Convert markup to groff man page.
- 参数
text (str) --
Text marked up with CommonMark.
breaks (Union[bool, cmarkwrapper.types.LineBreaks]) -- bool or LineBreaks How line breaks will be rendered. If
True,"soft", orLineBreaks.soft-- “soft break nodes” (single newlines) are rendered as newlines (\n). IfFalse-- “soft break nodes” are rendered as spaces. If"hard"orLineBreaks.hard-- “soft break nodes” are rendered as.PD 0\n.P\n.PD\n.width (int) -- Wrap width of output by inserting line breaks (default is``0``—no wrapping). Has no effect if
breaksareFalse.smart (cmarkwrapper.types.Option) -- Use
OPT_SMART.
- 返回
Page without the header.
- 返回类型
str
markdown_to_latex¶
- cmarkwrapper.func.markdown_to_latex(text, breaks=False, width=0, smart=Option.OPT_SMART)¶
Convert markup to LaTeX.
- 参数
text (str) --
Text marked up with CommonMark.
breaks (Union[bool, cmarkwrapper.types.LineBreaks]) -- bool or LineBreaks How line breaks will be rendered. If
True,"soft", orLineBreaks.soft-- as newlines. IfFalse-- “soft break nodes” (single newlines) are rendered as spaces. If"hard"orLineBreaks.hard-- “soft break nodes” are rendered as\\\n.width (int) -- Wrap width of output by inserting line breaks (default is
0—no wrapping). Has no effect ifbreaksareFalse.smart (cmarkwrapper.types.Option) -- Use
OPT_SMART.
- 返回
LaTeX document.
- 返回类型
str