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

    Constructors
    Constructor
    Description
    Constructs a new SyntaxHighlighter for Java language with empty content
    SyntaxHighlighter(ShLanguage language, String content)
    Constructs a new SyntaxHighlighter with the specified language and content using a11yDark theme.
  • Method Summary

    Modifier and Type
    Method
    Description
    Obtains the current SyntaxHighlighter Language
    Obtains the current SyntaxHighlighter Style
    void
    Sets the SyntaxHighlighter Language
    void
    Sets the SyntaxHighlighter Style

    Methods inherited from class com.flowingcode.vaadin.addons.syntaxhighlighter.BaseSyntaxHighlighter

    getContent, isShowLineNumbers, isWrapLongLines, setContent, setHeight, setShowLineNumbers, setWidth, setWrapLongLines

    Methods inherited from class com.vaadin.flow.component.react.ReactAdapterComponent

    addStateChangeListener, addStateChangeListener, getState, getState, readFromJson, readFromJson, setState, writeAsJson

    Methods 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, setVisible

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.vaadin.flow.component.AttachNotifier

    addAttachListener

    Methods inherited from interface com.vaadin.flow.component.DetachNotifier

    addDetachListener

    Methods inherited from interface com.vaadin.flow.component.HasElement

    getElement

    Methods 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, setWidthFull

    Methods 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

      public SyntaxHighlighter(ShLanguage language, String content)
      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

      public ShLanguage getShLanguage()
      Obtains the current SyntaxHighlighter Language
      Returns:
      current language
    • setShLanguage

      public void setShLanguage(ShLanguage language)
      Sets the SyntaxHighlighter Language
      Parameters:
      language -
    • getShStyle

      public ShStyle getShStyle()
      Obtains the current SyntaxHighlighter Style
      Returns:
      style
    • setShStyle

      public void setShStyle(ShStyle style)
      Sets the SyntaxHighlighter Style
      Parameters:
      style -