Class Markdown
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.markdown.Markdown
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasSize,com.vaadin.flow.component.HasStyle,Serializable
@Tag("vaadin-markdown")
@NpmPackage(value="@vaadin/markdown",
version="25.3.0-alpha14")
@JsModule("@vaadin/markdown/src/vaadin-markdown.js")
public class Markdown
extends com.vaadin.flow.component.Component
implements com.vaadin.flow.component.HasSize
Markdown is a component for rendering Markdown content. It takes Markdown
source as input and renders the corresponding HTML.
- Since:
- 24.8
- Author:
- Vaadin Ltd
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidappendContent(String content) Appends the markdown content.com.vaadin.flow.dom.SignalBinding<String> bindContent(com.vaadin.flow.signals.Signal<String> contentSignal) Binds the markdown content to the given signal.com.vaadin.flow.dom.SignalBinding<Boolean> bindLineBreaks(com.vaadin.flow.signals.Signal<Boolean> lineBreaksSignal) Binds the line breaks state to the given signal.Gets the markdown content.booleanGets whether single line breaks ("soft breaks") within a paragraph are rendered as line breaks.protected voidonAttach(com.vaadin.flow.component.AttachEvent attachEvent) voidsetContent(String content) Sets the markdown content.voidsetLineBreaks(boolean lineBreaks) Sets whether single line breaks ("soft breaks") within a paragraph are rendered as line breaks, the same way chat and message-style Markdown behaves.Methods inherited from class com.vaadin.flow.component.Component
addListener, bindVisible, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTestId, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setTestId, setVisible, whenAttachedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.HasSize
bindHeight, bindWidth, getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFullMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, bindClassName, bindClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
-
Constructor Details
-
Markdown
public Markdown()Default constructor. Creates an empty Markdown. -
Markdown
Creates a Markdown with content.- Parameters:
content- the markdown content- See Also:
-
Markdown
Creates a Markdown with content bound to a signal.- Parameters:
contentSignal- the signal providing the markdown content- Since:
- 25.3
- See Also:
-
-
Method Details
-
setContent
Sets the markdown content.- Parameters:
content- the markdown content
-
appendContent
Appends the markdown content.- Parameters:
content- the markdown content to append
-
getContent
Gets the markdown content.- Returns:
- the markdown content
-
bindContent
public com.vaadin.flow.dom.SignalBinding<String> bindContent(com.vaadin.flow.signals.Signal<String> contentSignal) Binds the markdown content to the given signal. While the binding is active, callingsetContent(String)orappendContent(String)will throw aBindingActiveException.- Parameters:
contentSignal- the signal providing the markdown content- Returns:
- a
SignalBindingthat can be used to registeronChangecallbacks - Since:
- 25.3
-
setLineBreaks
public void setLineBreaks(boolean lineBreaks) Sets whether single line breaks ("soft breaks") within a paragraph are rendered as line breaks, the same way chat and message-style Markdown behaves.By default, this is
false, following the original Markdown specification where single line breaks are ignored and a blank line is required to start a new paragraph.- Parameters:
lineBreaks-trueto render single line breaks as line breaks,falseotherwise- Since:
- 25.3
-
isLineBreaks
public boolean isLineBreaks()Gets whether single line breaks ("soft breaks") within a paragraph are rendered as line breaks.- Returns:
trueif single line breaks are rendered as line breaks,falseotherwise- Since:
- 25.3
-
bindLineBreaks
public com.vaadin.flow.dom.SignalBinding<Boolean> bindLineBreaks(com.vaadin.flow.signals.Signal<Boolean> lineBreaksSignal) Binds the line breaks state to the given signal. While the binding is active, callingsetLineBreaks(boolean)will throw aBindingActiveException. Anullsignal value is treated asfalse.- Parameters:
lineBreaksSignal- the signal providing the line breaks state, notnull- Returns:
- a
SignalBindingthat can be used to registeronChangecallbacks - Since:
- 25.3
-
onAttach
protected void onAttach(com.vaadin.flow.component.AttachEvent attachEvent) - Overrides:
onAttachin classcom.vaadin.flow.component.Component
-