Updates
- latest
highlight ^10.1.1
andlowlight ^1.14.0
dependencies - latest
refractor ^3.0.0
andprism ^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 fromhighlight.js
, highlight v10 has renamed that style todarcula
.
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 byhighlight.js
(vialowlight
) andprism
(viarefractor
). 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 tocsharp
)nimrod
(renamed tonim
)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