npm react-syntax-highlighter 13.0.0

latest releases: 15.5.0, 15.4.5, 15.4.4...
3 years ago

Updates

  • latest highlight ^10.1.1 and lowlight ^1.14.0 dependencies
  • latest refractor ^3.0.0 and prism ^1.20.0 dependencies
  • updated/fixed tests
  • updated demos
  • CircleCi v2 config added

New API features

showInlineLineNumbers prop

<SyntaxHighlighter
  showLineNumbers={true} // required to show line numbers, whether inline or not
  showInlineLineNumbers={true} // render them inside wrapped lines, instead of as a separate <code> block
  renderer={virtualizedRenderer({
    rowHeight: 20
  })}
>
  {code}
</SyntaxHighlighter>

When paired with showLineNumbers={true}, showInlineLineNumbers={true} injects line numbers into each wrapped line of code, instead of creating a separate <code></code> block for the numbers. This allows line numbering to work with virtualized renderers such as react-syntax-highlighter-virtualized-renderer.

Inline line numbers are styled so that they're not selected when drag-selecting multiple lines of highlighted text, preserving expected behavior.

Breaking changes

  • If you rely on the darkula theme from highlight.js, highlight v10 has renamed that style to darcula.

Highlight v10 introduced some breaking changes for us here which we've worked around, but shouldn't cause breakage for most people relying on react-syntax-highlighter and not consuming highlight.js directly.

Supported languages

Note: react-syntax-highlighter provides an automated build wrapper around styles and languages provided by highlight.js (via lowlight) and prism (via refractor). Changes here are simply describing what's changed in those libraries. If you'd like to see another language or style added, please contribute to those libraries.

New highlight.js languages

  • cLike (c-like)
  • c
  • latex
  • phpTemplate (php-template)
  • pythonRepl (python-repl)

Renamed/removed highlight.js languages

  • cs (renamed to csharp)
  • nimrod (renamed to nim)
  • tex (removed)

New prism.js languages

  • antlr4
  • aql
  • bbcode
  • brightscript
  • concurnas
  • dax
  • etlua
  • excelFormula (excel-formula)
  • factor
  • firestoreSecurityRules (firestore-security-rules)
  • ftl
  • gdscript
  • latte
  • llvm
  • moonscript
  • neon
  • powerquery
  • qml
  • robotframework
  • solidity
  • solutionFile (solution-file)
  • sparql
  • sqf
  • turtle
  • zig

Don't miss a new react-syntax-highlighter release

NewReleases is sending notifications on new releases.