CommonMark.available_columns
— MethodGiven the current indent of the renderer we check to see how much space is left on the current line.
CommonMark.literal_width
— MethodWhat is the width of the literal text stored in node
and all of it's child nodes. Used to determine alignment for rendering nodes such as centered.
CommonMark.print_literal
— MethodLiteral printing of a of parts
. Behaviour depends on when .wrap
is active at the moment, which is set in Paragraph
rendering.
CommonMark.print_margin
— MethodPrint out all the current segments present in the margin buffer.
Each time a segment gets printed it's count is reduced. When a segment has a count of zero it won't be printed and instead spaces equal to it's width are printed. For persistent printing a count of -1 should be used.
CommonMark.push_margin!
— FunctionAdds a new segment to the margin buffer, but will only print out for the given number of count
calls to print_margin
. After count
calls it will instead print out spaces equal to the width of text
.
CommonMark.push_margin!
— FunctionAdds a new segment to the margin buffer. This segment is persistent and thus will print on every margin print.
CommonMark.push_margin!
— MethodAdds new segmant to the margin buffer. count
determines how many time initial
is printed. After that, the width of rest
is printed instead.
CommonMark.@cm_str
— Macrocm""
A string macro for markdown text that implements standard string interpolation. Returns a parsed markdown AST with the values of the interpolation expressions embedded in the AST.
value = "interpolated"
cm"Some *$(value)* text."
The default syntax rules used for parsing are:
AdmonitionRule
AttributeRule
AutoIdentifierRule
CitationRule
FootnoteRule
MathRule
RawContentRule
TableRule
TypographyRule
which matches closely with the default syntax supported in Markdown.@md_str
.
The DollarMathRule
is not enabled since it conflicts with the interpolation syntax. Use double backticks and math
language literal blocks for maths that is provided by the MathRule
.
A custom Parser
can be invoked when using cm""
by providing a suffix to the macro call, for example:
more = "more"
cm"Some **$(uppercase(more))** text."none
where the suffixed none
will invoke a basic Parser
with no additional syntax rules enabled!
. To use your own custom parser, for example to only enable the TypographyRule
, you can suffix the call with a named function from the current module's global scope that returns the Parser
object with the required rules enabled:
custom() = enable!(Parser(), TypographyRule())
It can then be used as
str = "custom"
cm"A '$(titlecase(str))' parser..."custom