Verified Owner
Top Inners Fields Constructors Methods
org.jabref.gui.util.component

public Class MarkdownTextFlow

extends SelectableTextFlow
Class Inheritance
Imports
java.util.ArrayDeque, .Deque, .StringJoiner, java.util.function.Consumer, java.util.regex.Pattern, javafx.beans.property.ObjectProperty, .SimpleObjectProperty, javafx.geometry.NodeOrientation, javafx.scene.control.Hyperlink, javafx.scene.layout.Pane, javafx.scene.text.Text, org.jabref.gui.DialogService, org.jabref.gui.clipboard.ClipBoardManager, org.jabref.gui.edit.OpenBrowserAction, org.jabref.gui.preferences.GuiPreferences, org.jabref.gui.util.SelectableTextFlow, com.airhacks.afterburner.injection.Injector, com.vladsch.flexmark.ast.BlockQuote, .BulletList, .BulletListItem, .Code, .Emphasis, .FencedCodeBlock, .Heading, .HtmlBlock, .HtmlInline, .IndentedCodeBlock, .Link, .LinkRef, .ListBlock, .ListItem, .OrderedList, .OrderedListItem, .Paragraph, .StrongEmphasis, com.vladsch.flexmark.html.HtmlRenderer, com.vladsch.flexmark.parser.Parser, com.vladsch.flexmark.util.ast.DelimitedNode, .Document, .Node, .NodeVisitor, .VisitHandler, com.vladsch.flexmark.util.data.MutableDataSet, org.jspecify.annotations.NonNull, .Nullable

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class
private class

Field Summary

Modifier and TypeField and Description
private static final String
private static final Pattern
private final HtmlRenderer
private final ObjectProperty<Consumer<String>>
private static final Pattern
private final Parser
private boolean
plainText

Whether the current content was set via setPlainText rather than setMarkdown.

private static final String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private void
addHyperlinkNode(String text, String url, Node astNode, String... styleClasses)

private void
addTextNode(@Nullable String content, Node astNode, String... styleClasses)

public void
public static void
public Consumer<String>
private String
getMarkdownRepresentation(Node astNode, String renderedText)

public ObjectProperty<Consumer<String>>
public void
setHyperlinkHandler(Consumer<String> hyperlinkHandler)

public void
setMarkdown(@NonNull String markdownText)

public void
setPlainText(@NonNull String text)

Displays the given text as-is, without interpreting any Markdown syntax.

Inherited from org.jabref.gui.util.SelectableTextFlow:
clearSelectiongetSelectionEndIndexgetSelectionStartIndexisSelectionActiveselectAll

Field Detail

BLOCKQUOTE_MARKERback to summary
private static final String BLOCKQUOTE_MARKER
BULLET_LIST_PATTERNback to summary
private static final Pattern BULLET_LIST_PATTERN
htmlRendererback to summary
private final HtmlRenderer htmlRenderer
hyperlinkHandlerback to summary
private final ObjectProperty<Consumer<String>> hyperlinkHandler
NUMBERED_LIST_PATTERNback to summary
private static final Pattern NUMBERED_LIST_PATTERN
parserback to summary
private final Parser parser
plainTextback to summary
private boolean plainText

Whether the current content was set via setPlainText rather than setMarkdown. Governs whether copying reproduces Markdown markup or the displayed text verbatim.

UNICODE_BULLETback to summary
private static final String UNICODE_BULLET

Constructor Detail

MarkdownTextFlowback to summary
public MarkdownTextFlow(Pane parent)

Method Detail

addHyperlinkNodeback to summary
private void addHyperlinkNode(String text, String url, Node astNode, String... styleClasses)
addTextNodeback to summary
private void addTextNode(@Nullable String content, Node astNode, String... styleClasses)
copySelectedTextback to summary
public void copySelectedText()

Overrides org.jabref.gui.util.SelectableTextFlow.copySelectedText.

Annotations
@Override
defaultHyperlinkHandlerback to summary
public static void defaultHyperlinkHandler(String url)
getHyperlinkHandlerback to summary
public Consumer<String> getHyperlinkHandler()
getMarkdownRepresentationback to summary
private String getMarkdownRepresentation(Node astNode, String renderedText)
hyperlinkHandlerPropertyback to summary
public ObjectProperty<Consumer<String>> hyperlinkHandlerProperty()
setHyperlinkHandlerback to summary
public void setHyperlinkHandler(Consumer<String> hyperlinkHandler)
setMarkdownback to summary
public void setMarkdown(@NonNull String markdownText)
setPlainTextback to summary
public void setPlainText(@NonNull String text)

Displays the given text as-is, without interpreting any Markdown syntax.

org.jabref.gui.util.component back to summary

private Class MarkdownTextFlow.MarkdownAwareText

extends Text
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final Node

Constructor Summary

AccessConstructor and Description
public
MarkdownAwareText(String text, Node astNode)

Method Summary

Inherited from javafx.scene.text.Text:
baselineOffsetPropertyboundsTypePropertycaretBiasPropertycaretPositionPropertycaretShapecaretShapePropertyfontPropertyfontSmoothingTypePropertygetBaselineOffsetgetBoundsTypegetCaretPositiongetCaretShapegetClassCssMetaDatagetCssMetaDatagetFontgetFontSmoothingTypegetLayoutInfogetLineSpacinggetRangeShapegetSelectionEndgetSelectionFillgetSelectionShapegetSelectionStartgetStrikeThroughShapegetTabSizegetTextgetTextAlignmentgetTextOrigingetWrappingWidthgetXgetYhitTestisCaretBiasisStrikethroughisUnderlinelineSpacingPropertyqueryAccessibleAttributerangeShapeselectionEndPropertyselectionFillPropertyselectionShapePropertyselectionStartPropertysetBoundsTypesetCaretBiassetCaretPositionsetFontsetFontSmoothingTypesetLineSpacingsetSelectionEndsetSelectionFillsetSelectionStartsetStrikethroughsetTabSizesetTextsetTextAlignmentsetTextOriginsetUnderlinesetWrappingWidthsetXsetYstrikethroughPropertytabSizePropertytextAlignmentPropertytextOriginPropertytextPropertytoStringunderlinePropertyunderlineShapeusesMirroringwrappingWidthPropertyxPropertyyProperty

Field Detail

astNodeback to summary
private final Node astNode

Constructor Detail

MarkdownAwareTextback to summary
public MarkdownAwareText(String text, Node astNode)
org.jabref.gui.util.component back to summary

private Class MarkdownTextFlow.MarkdownRenderer

extends Object
Class Inheritance
  • java.lang.Object
  • org.jabref.gui.util.component.MarkdownTextFlow.MarkdownRenderer

Field Summary

Modifier and TypeField and Description
private boolean
private int
private final Deque<Integer>
private Node
private final NodeVisitor

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
private void
private boolean
private void
pack-priv void
render(Node node)

private void
visit(Document document)

private void
visit(Heading heading)

private void
visit(Paragraph paragraph)

private void
visit(Text text)

private void
visit(Emphasis emphasis)

private void
private void
visit(Code code)

private void
private void
private void
private void
private void
private void
private void
private void
private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

isFirstBlockElementback to summary
private boolean isFirstBlockElement
listIndentationLevelback to summary
private int listIndentationLevel
orderedListCountersback to summary
private final Deque<Integer> orderedListCounters
previousBlockback to summary
private Node previousBlock
visitorback to summary
private final NodeVisitor visitor

Constructor Detail

MarkdownRendererback to summary
pack-priv MarkdownRenderer()

Method Detail

addNewlinesBetweenBlocksback to summary
private void addNewlinesBetweenBlocks(Node currentBlock)
isInsideListItemback to summary
private boolean isInsideListItem(Node node)
processQuoteParagraphback to summary
private void processQuoteParagraph(BlockQuote quote, Node child)
renderback to summary
pack-priv void render(Node node)
visitback to summary
private void visit(Document document)
visitback to summary
private void visit(Heading heading)
visitback to summary
private void visit(Paragraph paragraph)
visitback to summary
private void visit(Text text)
visitback to summary
private void visit(Emphasis emphasis)
visitback to summary
private void visit(StrongEmphasis strong)
visitback to summary
private void visit(Code code)
visitback to summary
private void visit(FencedCodeBlock codeBlock)
visitback to summary
private void visit(IndentedCodeBlock codeBlock)
visitback to summary
private void visit(BulletList list)
visitback to summary
private void visit(OrderedList list)
visitback to summary
private void visit(BulletListItem item)
visitback to summary
private void visit(OrderedListItem item)
visitback to summary
private void visit(BlockQuote quote)
visitback to summary
private void visit(HtmlInline html)
visitback to summary
private void visit(HtmlBlock html)