Class SyntaxHighlighter
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.react.ReactAdapterComponent
com.flowingcode.vaadin.addons.syntaxhighlighter.BaseSyntaxHighlighter
com.flowingcode.vaadin.addons.syntaxhighlighter.SyntaxHighlighter
- 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
@NpmPackage(value="react-syntax-highlighter",
version="npm:@fengkx/react-syntax-highlighter@15.6.1")
@JsModule("./react-syntax-highlighter.tsx")
@Tag("syntax-highlighter")
public class SyntaxHighlighter
extends BaseSyntaxHighlighter
A Vaadin component that wraps the react-syntax-highlighter library to provide syntax highlighting for code snippets.
- Since:
- 1.0.0
- Author:
- mlopezFC
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new SyntaxHighlighter for Java language with empty contentSyntaxHighlighter(ShLanguage language, String content) Constructs a new SyntaxHighlighter with the specified language and content using a11yDark theme. -
Method Summary
Modifier and TypeMethodDescriptionObtains the current SyntaxHighlighter LanguageObtains the current SyntaxHighlighter StylevoidsetShLanguage(ShLanguage language) Sets the SyntaxHighlighter LanguagevoidsetShStyle(ShStyle style) Sets the SyntaxHighlighter StyleMethods inherited from class com.flowingcode.vaadin.addons.syntaxhighlighter.BaseSyntaxHighlighter
getContent, isShowLineNumbers, isWrapLongLines, setContent, setHeight, setShowLineNumbers, setWidth, setWrapLongLinesMethods inherited from class com.vaadin.flow.component.react.ReactAdapterComponent
addStateChangeListener, addStateChangeListener, getState, getState, readFromJson, readFromJson, setState, writeAsJsonMethods inherited from class com.vaadin.flow.component.Component
addListener, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setVisibleMethods 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
getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidthFullMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
-
Constructor Details
-
SyntaxHighlighter
public SyntaxHighlighter()Constructs a new SyntaxHighlighter for Java language with empty content -
SyntaxHighlighter
Constructs a new SyntaxHighlighter with the specified language and content using a11yDark theme.- Parameters:
language- The programming language to highlight.content- The code content to highlight.
-
-
Method Details
-
getShLanguage
Obtains the current SyntaxHighlighter Language- Returns:
- current language
-
setShLanguage
Sets the SyntaxHighlighter Language- Parameters:
language-
-
getShStyle
Obtains the current SyntaxHighlighter Style- Returns:
- style
-
setShStyle
Sets the SyntaxHighlighter Style- Parameters:
style-
-