fix(v2): add support for interleaving Markdown in code blocks (#3749)

* fix(v2): add support for interleaving Markdown in code blocks

* Improve check for array
This commit is contained in:
Alexey Pyltsyn 2020-11-17 02:18:45 +03:00 committed by GitHub
parent 30d7408815
commit 1dac7e33f7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -112,6 +112,11 @@ export default ({
const prismTheme = usePrismTheme();
// In case interleaved Markdown (e.g. when using CodeBlock as standalone component).
if (Array.isArray(children)) {
children = children.join('');
}
if (metastring && highlightLinesRangeRegex.test(metastring)) {
// Tested above
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion