-
Notifications
You must be signed in to change notification settings - Fork 285
Markdown Formatter
The flexmark-formatter
module renders the AST as markdown with various formatting options to
clean up and make the source consistent. This also comes with an API to allow extensions to
provide formatting options and and handle rendering of markdown for custom nodes.
The Formatter
class is a renderer that outputs markdown and formats it to specified options.
Use it in place of HtmlRenderer
to get formatted markdown.
-
FORMATTER_EMULATION_PROFILE
: defaultParser.PARSER_EMULATION_PROFILE
, emulation profile to use for formatting. Can be used to change indenting rules from the ones used by the parser. -
MAX_BLANK_LINES
: default2
, maximum number of blank lines to keep in the file -
MAX_TRAILING_BLANK_LINES
: default1
, maximum trailing blank lines in file -
SPACE_AFTER_ATX_MARKER
: defaultDiscretionaryText.ADD
, handling of space after atx marker -
SETEXT_HEADER_EQUALIZE_MARKER
: defaulttrue
, when true equalizes the setext marker to header text length -
ATX_HEADER_TRAILING_MARKER
: defaultEqualizeTrailingMarker.AS_IS
, trailing atx#
markers:-
AS_IS
: do nothing -
ADD
: add the same number of#
as opening marker -
EQUALIZE
: add the same number of#
as opening marker -
REMOVE
: remove
-
-
THEMATIC_BREAK
: default(String)null
, string to use for thematic break.null
means leave as is. -
BLOCK_QUOTE_MARKERS
: defaultBlockQuoteMarker.AS_IS
-
AS_IS
: no change, first line marker is propagated to full block quote content -
ADD_COMPACT
: use>
and>>..>>
for nested block quotes -
ADD_COMPACT_WITH_SPACE
: use>
and>>..>>
for nested block quotes -
ADD_SPACED
: use>
and> > ..> >
for nested block quotes
-
-
INDENTED_CODE_MINIMIZE_INDENT
: defaultfalse
, when true will remove extra indent common to all content lines -
FENCED_CODE_MINIMIZE_INDENT
: defaultfalse
, when true will remove extra indent common to all content lines -
FENCED_CODE_MATCH_CLOSING_MARKER
: defaultfalse
, when true opening marker will be used for closing marker -
FENCED_CODE_SPACE_BEFORE_INFO
: defaultfalse
, when true a space will be added between open marker and info string -
FENCED_CODE_MARKER_LENGTH
: default3
, minimum code fence marker length -
FENCED_CODE_MARKER_TYPE
: defaultCodeFenceMarker.ANY
,-
ANY
: no change, whatever is used -
BACK_TICK
: change to back ticks -
TILDE
: change to~
-
-
LIST_ADD_BLANK_LINE_BEFORE
: defaultfalse
, whentrue
will add a blank line before the first list item if it follows a paragraph -
LIST_RENUMBER_ITEMS
: defaulttrue
, whentrue
renumbers the ordered list items -
LIST_BULLET_MARKER
: defaultListBulletMarker.ANY
,-
ANY
: no change -
DASH
: change all to-
-
ASTERISK
: change all to*
-
PLUS
: change all to+
-
-
LIST_NUMBERED_MARKER
: defaultListNumberedMarker.ANY
,-
ANY
: no change -
DOT
: change all to.
-
PAREN
: change all to)
-
-
LIST_SPACING
: defaultListSpacing.AS_IS
,-
AS_IS
: no change -
LOOSEN
: loose if has loose item -
TIGHTEN
: tight if has tight item -
LOOSE
: always loose -
TIGHT
: always tight
-
-
REFERENCE_PLACEMENT
: defaultElementPlacement.AS_IS
,-
AS_IS
: no change -
DOCUMENT_TOP
: put all references at top of document -
GROUP_WITH_FIRST
: group all with first reference -
GROUP_WITH_LAST
: group all with last reference -
DOCUMENT_BOTTOM
: document bottom
-
-
REFERENCE_SORT
: defaultElementPlacementSort.AS_IS
,-
AS_IS
: no change -
SORT
: sort in alphabetical order by reference text -
SORT_UNUSED_LAST
: sort in alphabetical order by reference text, put unreferenced ones last
-
-
KEEP_IMAGE_LINKS_AT_START
: defaultfalse
, whentrue
image links will always be wrapped to be the first non space on the line -
KEEP_EXPLICIT_LINKS_AT_START
: defaultfalse
, whentrue
image links will always be wrapped to be the first non space on the line