refactor: simplify line filling a bit

pull/3439/head
Divyansh Singh 11 months ago
parent 862549d068
commit 5dab5e3ced

@ -162,24 +162,20 @@ export async function highlight(
},
{
name: 'vitepress:empty-line',
pre(hast) {
hast.children.forEach((code) => {
if (code.type === 'element' && code.tagName === 'code') {
code.children.forEach((span) => {
if (
span.type === 'element' &&
span.tagName === 'span' &&
Array.isArray(span.properties.class) &&
span.properties.class.includes('line') &&
span.children.length === 0
) {
span.children.push({
type: 'element',
tagName: 'wbr',
properties: {},
children: []
})
}
code(hast) {
hast.children.forEach((span) => {
if (
span.type === 'element' &&
span.tagName === 'span' &&
Array.isArray(span.properties.class) &&
span.properties.class.includes('line') &&
span.children.length === 0
) {
span.children.push({
type: 'element',
tagName: 'wbr',
properties: {},
children: []
})
}
})

Loading…
Cancel
Save