Skip to content

Commit

Permalink
fix toc cropped, fix heading not hidden in zen mode
Browse files Browse the repository at this point in the history
  • Loading branch information
nobkd committed Feb 2, 2025
1 parent f7963f0 commit 971bbf2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/nuemark/src/parse-inline.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const PARSERS = [
// parse tag
const tag = parseTag(str.slice(1, i).trim())
const { name } = tag
const is_footnote = name[0] == '^'
const is_footnote = name && name[0] == '^'
const end = i + 1

// footnote?
Expand All @@ -89,6 +89,8 @@ const PARSERS = [

// normal tag
if (name == '!' || isValidName(name)) return { is_tag: true, ...tag, end }
// span
if (!name) return { is_span: true, ...tag, end }

return { text: c }
}
Expand Down
1 change: 1 addition & 0 deletions packages/nuemark/src/render-inline.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export function renderToken(token, opts = {}) {
const { text } = token

return text ? text :
token.is_span ? elem('span', token.attr, renderInline(token.data?._)) :
token.is_format ? formatText(token, opts) :
token.is_var ? renderVariable(token.name, data) :
token.is_image ? renderImage(token) :
Expand Down

0 comments on commit 971bbf2

Please sign in to comment.