Class SyntaxHighlighterPrism

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.SyntaxHighlighterPrism
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-prism.tsx") @Tag("syntax-highlighter-prism") public class SyntaxHighlighterPrism extends BaseSyntaxHighlighter
A Vaadin component that wraps the react-syntax-highlighter library to provide syntax highlighting for code snippets. This implementation is based on Prism.js (more information here: https://github.com/react-syntax-highlighter/react-syntax-highlighter?tab=readme-ov-file#prism)
Since:
1.0.0
Author:
mlopezFC
See Also:
  • Constructor Summary

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

    Modifier and Type
    Method
    Description
    Obtains the current SyntaxHighlighterPrism Language
    Obtains the current SyntaxHighlighterPrism Style
    void
    Sets the SyntaxHighlighterPrism 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

    • SyntaxHighlighterPrism

      public SyntaxHighlighterPrism()
      Constructs a new SyntaxHighlighter for Java language with empty content
    • SyntaxHighlighterPrism

      public SyntaxHighlighterPrism(ShLanguagePrism 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 ShLanguagePrism getShLanguage()
      Obtains the current SyntaxHighlighterPrism Language
      Returns:
    • setShLanguage

      public void setShLanguage(ShLanguagePrism language)
      Sets the SyntaxHighlighterPrism Language
      Parameters:
      language -
    • getShStyle

      public ShStylePrism getShStyle()
      Obtains the current SyntaxHighlighterPrism Style
      Returns:
    • setShStyle

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