Class FlexmarkHtmlConverter.MainHtmlConverter.SubHtmlNodeConverter
java.lang.Object
com.vladsch.flexmark.html2md.converter.HtmlNodeConverterSubContext
com.vladsch.flexmark.html2md.converter.FlexmarkHtmlConverter.MainHtmlConverter.SubHtmlNodeConverter
- All Implemented Interfaces:
HtmlNodeConverterContext
,NodeContext<org.jsoup.nodes.Node,
HtmlNodeConverterContext>
- Enclosing class:
FlexmarkHtmlConverter.MainHtmlConverter
private class FlexmarkHtmlConverter.MainHtmlConverter.SubHtmlNodeConverter
extends HtmlNodeConverterSubContext
implements HtmlNodeConverterContext
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final FlexmarkHtmlConverter.MainHtmlConverter
private final DataHolder
Fields inherited from class com.vladsch.flexmark.html2md.converter.HtmlNodeConverterSubContext
markdown, myRenderingNode, renderingHandlerWrapper
-
Constructor Summary
ConstructorsConstructorDescriptionSubHtmlNodeConverter
(@NotNull FlexmarkHtmlConverter.MainHtmlConverter mainNodeRenderer, @NotNull HtmlMarkdownWriter out, @Nullable DataHolder options) -
Method Summary
Modifier and TypeMethodDescriptionvoid
appendOuterHtml
(@NotNull org.jsoup.nodes.Node node) void
@NotNull String
escapeSpecialChars
(@NotNull String text) void
excludeAttributes
(String... excludes) 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) 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.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) @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
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.vladsch.flexmark.html2md.converter.HtmlNodeConverterContext
getMarkdown
-
Field Details
-
myMainNodeRenderer
-
myOptions
-
-
Constructor Details
-
SubHtmlNodeConverter
SubHtmlNodeConverter(@NotNull @NotNull FlexmarkHtmlConverter.MainHtmlConverter mainNodeRenderer, @NotNull @NotNull HtmlMarkdownWriter out, @Nullable @Nullable DataHolder options)
-
-
Method Details
-
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.- Specified by:
getOptions
in interfaceHtmlNodeConverterContext
- Specified by:
getOptions
in interfaceNodeContext<org.jsoup.nodes.Node,
HtmlNodeConverterContext> - Returns:
- the current renderer options
DataHolder
-
getHtmlConverterOptions
- Specified by:
getHtmlConverterOptions
in interfaceHtmlNodeConverterContext
- Returns:
- the
HtmlConverterOptions
for the context.
-
getDocument
@NotNull public @NotNull org.jsoup.nodes.Document getDocument()- Specified by:
getDocument
in interfaceHtmlNodeConverterContext
- Returns:
- the
Document
node of the current context
-
getFormattingPhase
- Specified by:
getFormattingPhase
in interfaceHtmlNodeConverterContext
- 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.- Specified by:
render
in interfaceHtmlNodeConverterContext
- Parameters:
node
- the node to render
-
getCurrentNode
public org.jsoup.nodes.Node getCurrentNode()- Specified by:
getCurrentNode
in interfaceHtmlNodeConverterContext
- Specified by:
getCurrentNode
in interfaceNodeContext<org.jsoup.nodes.Node,
HtmlNodeConverterContext> - Returns:
- the current node being rendered
-
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.- Specified by:
getSubContext
in interfaceHtmlNodeConverterContext
- Specified by:
getSubContext
in interfaceNodeContext<org.jsoup.nodes.Node,
HtmlNodeConverterContext> - 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.- Specified by:
getSubContext
in interfaceHtmlNodeConverterContext
- Specified by:
getSubContext
in interfaceNodeContext<org.jsoup.nodes.Node,
HtmlNodeConverterContext> - 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.- Specified by:
getSubContext
in interfaceHtmlNodeConverterContext
- Specified by:
getSubContext
in interfaceNodeContext<org.jsoup.nodes.Node,
HtmlNodeConverterContext> - 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
-
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- Specified by:
renderChildren
in interfaceHtmlNodeConverterContext
- Parameters:
parent
- node the children of which are to be renderedoutputAttributes
- true if attributes should be outputprePopAction
- runnable to run before popping state
-
getForDocument
- Specified by:
getForDocument
in interfaceHtmlNodeConverterContext
- Returns:
- the
Document
node of the current context
-
resolveLink
@NotNull public @NotNull ResolvedLink resolveLink(@NotNull @NotNull LinkType linkType, @NotNull @NotNull CharSequence url, Boolean urlEncode) - Specified by:
resolveLink
in interfaceHtmlNodeConverterContext
-
resolveLink
@NotNull public @NotNull ResolvedLink resolveLink(@NotNull @NotNull LinkType linkType, @NotNull @NotNull CharSequence url, Attributes attributes, Boolean urlEncode) - Specified by:
resolveLink
in interfaceHtmlNodeConverterContext
-
pushState
public void pushState(@NotNull @NotNull org.jsoup.nodes.Node parent) - Specified by:
pushState
in interfaceHtmlNodeConverterContext
-
popState
- Specified by:
popState
in interfaceHtmlNodeConverterContext
-
processAttributes
public void processAttributes(@NotNull @NotNull org.jsoup.nodes.Node node) - Specified by:
processAttributes
in interfaceHtmlNodeConverterContext
-
outputAttributes
public int outputAttributes(@NotNull @NotNull LineAppendable out, @NotNull @NotNull String initialSep) - Specified by:
outputAttributes
in interfaceHtmlNodeConverterContext
-
transferIdToParent
public void transferIdToParent()- Specified by:
transferIdToParent
in interfaceHtmlNodeConverterContext
-
transferToParentExcept
- Specified by:
transferToParentExcept
in interfaceHtmlNodeConverterContext
-
transferToParentOnly
- Specified by:
transferToParentOnly
in interfaceHtmlNodeConverterContext
-
peek
@Nullable public @Nullable org.jsoup.nodes.Node peek()- Specified by:
peek
in interfaceHtmlNodeConverterContext
-
peek
@Nullable public @Nullable org.jsoup.nodes.Node peek(int skip) - Specified by:
peek
in interfaceHtmlNodeConverterContext
-
next
@Nullable public @Nullable org.jsoup.nodes.Node next()- Specified by:
next
in interfaceHtmlNodeConverterContext
-
skip
public void skip()- Specified by:
skip
in interfaceHtmlNodeConverterContext
-
next
@Nullable public @Nullable org.jsoup.nodes.Node next(int skip) - Specified by:
next
in interfaceHtmlNodeConverterContext
-
skip
public void skip(int skip) - Specified by:
skip
in interfaceHtmlNodeConverterContext
-
delegateRender
public void delegateRender()- Specified by:
delegateRender
in interfaceHtmlNodeConverterContext
-
getReferenceUrlToReferenceMap
- Specified by:
getReferenceUrlToReferenceMap
in interfaceHtmlNodeConverterContext
-
getExternalReferences
- Specified by:
getExternalReferences
in interfaceHtmlNodeConverterContext
-
getOrCreateReference
public Reference getOrCreateReference(@NotNull @NotNull String url, @NotNull @NotNull String text, @Nullable @Nullable String title) - Specified by:
getOrCreateReference
in interfaceHtmlNodeConverterContext
-
parseMarkdown
- Specified by:
parseMarkdown
in interfaceHtmlNodeConverterContext
-
processUnwrapped
public void processUnwrapped(@NotNull @NotNull org.jsoup.nodes.Node element) - Specified by:
processUnwrapped
in interfaceHtmlNodeConverterContext
-
processWrapped
public void processWrapped(@NotNull @NotNull org.jsoup.nodes.Node node, @Nullable @Nullable Boolean isBlock, boolean escapeMarkdown) - Specified by:
processWrapped
in interfaceHtmlNodeConverterContext
-
appendOuterHtml
public void appendOuterHtml(@NotNull @NotNull org.jsoup.nodes.Node node) - Specified by:
appendOuterHtml
in interfaceHtmlNodeConverterContext
-
isInlineCode
public boolean isInlineCode()- Specified by:
isInlineCode
in interfaceHtmlNodeConverterContext
-
setInlineCode
public void setInlineCode(boolean inlineCode) - Specified by:
setInlineCode
in interfaceHtmlNodeConverterContext
-
inlineCode
- Specified by:
inlineCode
in interfaceHtmlNodeConverterContext
-
escapeSpecialChars
- Specified by:
escapeSpecialChars
in interfaceHtmlNodeConverterContext
-
prepareText
- Specified by:
prepareText
in interfaceHtmlNodeConverterContext
-
prepareText
- Specified by:
prepareText
in interfaceHtmlNodeConverterContext
-
processTextNodes
- Specified by:
processTextNodes
in interfaceHtmlNodeConverterContext
-
excludeAttributes
- Specified by:
excludeAttributes
in interfaceHtmlNodeConverterContext
-
processTextNodes
public void processTextNodes(@NotNull @NotNull org.jsoup.nodes.Node node, boolean stripIdAttribute) - Specified by:
processTextNodes
in interfaceHtmlNodeConverterContext
-
processTextNodes
public void processTextNodes(@NotNull @NotNull org.jsoup.nodes.Node node, boolean stripIdAttribute, @NotNull @NotNull CharSequence wrapText) - Specified by:
processTextNodes
in interfaceHtmlNodeConverterContext
-
processTextNodes
public void processTextNodes(@NotNull @NotNull org.jsoup.nodes.Node node, boolean stripIdAttribute, @Nullable @Nullable CharSequence textPrefix, @Nullable @Nullable CharSequence textSuffix) - Specified by:
processTextNodes
in interfaceHtmlNodeConverterContext
-
wrapTextNodes
public void wrapTextNodes(@NotNull @NotNull org.jsoup.nodes.Node node, @NotNull @NotNull CharSequence wrapText, boolean needSpaceAround) - Specified by:
wrapTextNodes
in interfaceHtmlNodeConverterContext
-
processConditional
public void processConditional(@NotNull @NotNull ExtensionConversion extensionConversion, @NotNull @NotNull org.jsoup.nodes.Node node, @NotNull @NotNull Runnable processNode) - Specified by:
processConditional
in interfaceHtmlNodeConverterContext
-
renderDefault
public void renderDefault(@NotNull @NotNull org.jsoup.nodes.Node node) - Specified by:
renderDefault
in interfaceHtmlNodeConverterContext
-
getState
- Specified by:
getState
in interfaceHtmlNodeConverterContext
-
isTrace
public boolean isTrace()- Specified by:
isTrace
in interfaceHtmlNodeConverterContext
-
setTrace
public void setTrace(boolean trace) - Specified by:
setTrace
in interfaceHtmlNodeConverterContext
-
getStateStack
- Specified by:
getStateStack
in interfaceHtmlNodeConverterContext
-