Class FlexmarkHtmlConverter.MainHtmlConverter
java.lang.Object
com.vladsch.flexmark.html2md.converter.HtmlNodeConverterSubContext
com.vladsch.flexmark.html2md.converter.FlexmarkHtmlConverter.MainHtmlConverter
- All Implemented Interfaces:
HtmlNodeConverterContext
,NodeContext<org.jsoup.nodes.Node,
HtmlNodeConverterContext>
- Enclosing class:
FlexmarkHtmlConverter
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final @NotNull org.jsoup.nodes.Document
private final Document
private final @NotNull HtmlConverterOptions
private final @NotNull HtmlLinkResolver[]
private boolean
private final @NotNull DataHolder
private @Nullable Parser
private @Nullable HtmlConverterState
private final @NotNull Stack
<HtmlConverterState> private boolean
private HtmlConverterPhase
private final @NotNull List
<PhasedHtmlNodeRenderer> private final @NotNull Map
<String, HtmlNodeRendererHandler<?>> private final @NotNull Set
<HtmlConverterPhase> private final @Nullable Pattern
Fields inherited from class com.vladsch.flexmark.html2md.converter.HtmlNodeConverterSubContext
markdown, myRenderingNode, renderingHandlerWrapper
-
Constructor Summary
ConstructorsConstructorDescriptionMainHtmlConverter
(@NotNull DataHolder options, @NotNull HtmlMarkdownWriter out, @NotNull org.jsoup.nodes.Document document, @Nullable DataHolder parentOptions) -
Method Summary
Modifier and TypeMethodDescriptionvoid
appendOuterHtml
(@NotNull org.jsoup.nodes.Node node) void
private String
@NotNull String
escapeSpecialChars
(@NotNull String text) void
excludeAttributes
(String... excludes) @Nullable org.jsoup.nodes.Node
@NotNull org.jsoup.nodes.Document
@NotNull HtmlConverterOptions
@NotNull DataHolder
Get the current rendering contextDataHolder
.getOrCreateReference
(@NotNull String url, @NotNull String text, @Nullable String title) getState()
@NotNull Stack
<HtmlConverterState> @NotNull HtmlNodeConverterContext
Creates a child rendering context that can be used to collect rendered html text.@NotNull HtmlNodeConverterContext
getSubContext
(@Nullable DataHolder options) Creates a child rendering context that can be used to collect rendered html text.@NotNull HtmlNodeConverterContext
getSubContext
(@Nullable DataHolder options, @NotNull ISequenceBuilder<?, ?> builder) Creates a child rendering context that can be used to collect rendered html text.void
inlineCode
(@NotNull Runnable inlineRunnable) boolean
boolean
isTrace()
@Nullable org.jsoup.nodes.Node
next()
@Nullable org.jsoup.nodes.Node
next
(int skip) int
outputAttributes
(@NotNull LineAppendable out, @NotNull String initialSep) @NotNull Node
parseMarkdown
(@NotNull String markdown) @Nullable org.jsoup.nodes.Node
peek()
@Nullable org.jsoup.nodes.Node
peek
(int skip) void
popState
(@Nullable LineAppendable out) @NotNull String
prepareText
(@NotNull String text) @NotNull String
prepareText
(@NotNull String text, boolean inCode) void
processAttributes
(@NotNull org.jsoup.nodes.Node node) void
processConditional
(@NotNull ExtensionConversion extensionConversion, @NotNull org.jsoup.nodes.Node node, @NotNull Runnable processNode) @NotNull String
processTextNodes
(@NotNull org.jsoup.nodes.Node node) void
processTextNodes
(@NotNull org.jsoup.nodes.Node node, boolean stripIdAttribute) void
processTextNodes
(@NotNull org.jsoup.nodes.Node node, boolean stripIdAttribute, @NotNull CharSequence wrapText) void
processTextNodes
(@NotNull org.jsoup.nodes.Node node, boolean stripIdAttribute, @Nullable CharSequence textPrefix, @Nullable CharSequence textSuffix) (package private) void
processUnwrapped
(HtmlNodeConverterSubContext context, org.jsoup.nodes.Node element) void
processUnwrapped
(@NotNull org.jsoup.nodes.Node element) void
processWrapped
(@NotNull org.jsoup.nodes.Node node, @Nullable Boolean isBlock, boolean escapeMarkdown) void
pushState
(@NotNull org.jsoup.nodes.Node parent) void
render
(@NotNull org.jsoup.nodes.Node node) Render the specified node and its children using the configured renderers.(package private) void
renderByPreviousHandler
(HtmlNodeConverterSubContext subContext) void
renderChildren
(@NotNull org.jsoup.nodes.Node parent, boolean outputAttributes, Runnable prePopAction) Render the children of the node, used by custom renderersvoid
renderDefault
(@NotNull org.jsoup.nodes.Node node) (package private) void
renderNode
(org.jsoup.nodes.Node node, HtmlNodeConverterSubContext subContext) @NotNull ResolvedLink
resolveLink
(@NotNull LinkType linkType, @NotNull CharSequence url, Attributes attributes, Boolean urlEncode) @NotNull ResolvedLink
resolveLink
(@NotNull LinkType linkType, @NotNull CharSequence url, Boolean urlEncode) void
setInlineCode
(boolean inlineCode) void
setTrace
(boolean trace) void
skip()
void
skip
(int skip) void
void
transferToParentExcept
(String... excludes) void
transferToParentOnly
(String... includes) void
wrapTextNodes
(@NotNull org.jsoup.nodes.Node node, @NotNull CharSequence wrapText, boolean needSpaceAround) Methods inherited from class com.vladsch.flexmark.html2md.converter.HtmlNodeConverterSubContext
flushTo, flushTo, getMarkdown, getRenderingNode, setRenderingNode
-
Field Details
-
document
@NotNull private final @NotNull org.jsoup.nodes.Document document -
myForDocument
-
renderers
-
phasedFormatters
-
renderingPhases
-
myOptions
-
phase
-
myHtmlConverterOptions
-
specialCharsPattern
-
myStateStack
-
mySpecialCharsMap
-
myState
-
myTrace
private boolean myTrace -
myInlineCode
private boolean myInlineCode -
myParser
-
myHtmlLinkResolvers
-
myReferenceUrlToReferenceMap
-
myExternalReferences
-
-
Constructor Details
-
MainHtmlConverter
MainHtmlConverter(@NotNull @NotNull DataHolder options, @NotNull @NotNull HtmlMarkdownWriter out, @NotNull @NotNull org.jsoup.nodes.Document document, @Nullable @Nullable DataHolder parentOptions)
-
-
Method Details
-
getState
-
getReferenceUrlToReferenceMap
-
getExternalReferences
-
isTrace
public boolean isTrace() -
getStateStack
-
setTrace
public void setTrace(boolean trace) -
parseMarkdown
-
getOrCreateReference
-
resolveLink
@NotNull public @NotNull ResolvedLink resolveLink(@NotNull @NotNull LinkType linkType, @NotNull @NotNull CharSequence url, Boolean urlEncode) -
resolveLink
@NotNull public @NotNull ResolvedLink resolveLink(@NotNull @NotNull LinkType linkType, @NotNull @NotNull CharSequence url, Attributes attributes, Boolean urlEncode) -
getCurrentNode
@Nullable public @Nullable org.jsoup.nodes.Node getCurrentNode()- Returns:
- the current node being rendered
-
getOptions
Description copied from interface:HtmlNodeConverterContext
Get the current rendering contextDataHolder
. These are the options passed or set on theFlexmarkHtmlConverter.builder()
or passed toFlexmarkHtmlConverter.builder(DataHolder)
. To get the document options you should useHtmlNodeConverterContext.getDocument()
as the data holder.- Returns:
- the current renderer options
DataHolder
-
getHtmlConverterOptions
- Returns:
- the
HtmlConverterOptions
for the context.
-
getDocument
@NotNull public @NotNull org.jsoup.nodes.Document getDocument()- Returns:
- the
Document
node of the current context
-
getForDocument
- Returns:
- the
Document
node of the current context
-
getFormattingPhase
- Returns:
- current rendering phase
-
render
public void render(@NotNull @NotNull org.jsoup.nodes.Node node) Description copied from interface:HtmlNodeConverterContext
Render the specified node and its children using the configured renderers. This should be used to render child nodes; be careful not to pass the node that is being rendered, that would result in an endless loop.- Parameters:
node
- the node to render
-
delegateRender
public void delegateRender() -
renderByPreviousHandler
-
getSubContext
Description copied from interface:HtmlNodeConverterContext
Creates a child rendering context that can be used to collect rendered html text. The child context inherits everything but the HtmlRenderer and doNotRenderLinksNesting from the parent.- Returns:
- a new rendering context with a given appendable for its output
-
getSubContext
@NotNull public @NotNull HtmlNodeConverterContext getSubContext(@Nullable @Nullable DataHolder options) Description copied from interface:HtmlNodeConverterContext
Creates a child rendering context that can be used to collect rendered html text. The child context inherits everything but the HtmlRenderer and doNotRenderLinksNesting from the parent.- Parameters:
options
- options to use for the context (only options which do not affect the context construction will be used)- Returns:
- a new rendering context with a given appendable for its output
-
getSubContext
@NotNull public @NotNull HtmlNodeConverterContext getSubContext(@Nullable @Nullable DataHolder options, @NotNull @NotNull ISequenceBuilder<?, ?> builder) Description copied from interface:HtmlNodeConverterContext
Creates a child rendering context that can be used to collect rendered html text. The child context inherits everything but the HtmlRenderer and doNotRenderLinksNesting from the parent.- Parameters:
options
- options to use for the context (only options which do not affect the context construction will be used)builder
- sequence builder to user for appended text for tracking original base offsets- Returns:
- a new rendering context with a given appendable for its output
-
renderNode
-
renderChildren
public void renderChildren(@NotNull @NotNull org.jsoup.nodes.Node parent, boolean outputAttributes, Runnable prePopAction) Description copied from interface:HtmlNodeConverterContext
Render the children of the node, used by custom renderers- Parameters:
parent
- node the children of which are to be renderedoutputAttributes
- true if attributes should be outputprePopAction
- runnable to run before popping state
-
pushState
public void pushState(@NotNull @NotNull org.jsoup.nodes.Node parent) -
excludeAttributes
-
processAttributes
public void processAttributes(@NotNull @NotNull org.jsoup.nodes.Node node) -
outputAttributes
public int outputAttributes(@NotNull @NotNull LineAppendable out, @NotNull @NotNull String initialSep) -
transferIdToParent
public void transferIdToParent() -
transferToParentExcept
-
transferToParentOnly
-
popState
-
peek
@Nullable public @Nullable org.jsoup.nodes.Node peek() -
peek
@Nullable public @Nullable org.jsoup.nodes.Node peek(int skip) -
next
@Nullable public @Nullable org.jsoup.nodes.Node next() -
skip
public void skip() -
next
@Nullable public @Nullable org.jsoup.nodes.Node next(int skip) -
skip
public void skip(int skip) -
dumpState
-
processUnwrapped
public void processUnwrapped(@NotNull @NotNull org.jsoup.nodes.Node element) -
processUnwrapped
-
processWrapped
public void processWrapped(@NotNull @NotNull org.jsoup.nodes.Node node, @Nullable @Nullable Boolean isBlock, boolean escapeMarkdown) -
processTextNodes
public void processTextNodes(@NotNull @NotNull org.jsoup.nodes.Node node, boolean stripIdAttribute) -
processTextNodes
public void processTextNodes(@NotNull @NotNull org.jsoup.nodes.Node node, boolean stripIdAttribute, @NotNull @NotNull CharSequence wrapText) -
processTextNodes
public void processTextNodes(@NotNull @NotNull org.jsoup.nodes.Node node, boolean stripIdAttribute, @Nullable @Nullable CharSequence textPrefix, @Nullable @Nullable CharSequence textSuffix) -
wrapTextNodes
public void wrapTextNodes(@NotNull @NotNull org.jsoup.nodes.Node node, @NotNull @NotNull CharSequence wrapText, boolean needSpaceAround) -
processTextNodes
-
appendOuterHtml
public void appendOuterHtml(@NotNull @NotNull org.jsoup.nodes.Node node) -
isInlineCode
public boolean isInlineCode() -
setInlineCode
public void setInlineCode(boolean inlineCode) -
inlineCode
-
prepareText
-
prepareText
-
escapeSpecialChars
-
processConditional
public void processConditional(@NotNull @NotNull ExtensionConversion extensionConversion, @NotNull @NotNull org.jsoup.nodes.Node node, @NotNull @NotNull Runnable processNode) -
renderDefault
public void renderDefault(@NotNull @NotNull org.jsoup.nodes.Node node)
-