fix(build): handle `-` in title of code blocks with line highlighting (#1743)

pull/1747/head
Divyansh Singh 2 years ago committed by GitHub
parent e72998b68b
commit ce9467e389
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -20,7 +20,7 @@ import type { ThemeOptions } from '../markdown'
* [{ line: number, classes: string[] }] * [{ line: number, classes: string[] }]
*/ */
const attrsToLines = (attrs: string): HtmlRendererOptions['lineOptions'] => { const attrsToLines = (attrs: string): HtmlRendererOptions['lineOptions'] => {
attrs = attrs.replace(/.*?([\d,-]+).*/, '$1').trim() attrs = attrs.replace(/^(?:\[.*?\])?.*?([\d,-]+).*/, '$1').trim()
const result: number[] = [] const result: number[] = []
if (!attrs) { if (!attrs) {
return [] return []

Loading…
Cancel
Save