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 Jan 31, 2025
1 parent f650086 commit cdc2c25
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/nuejs.org/docs/css/doc-navi.css
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ aside:first-child nav {

/* table of contents */
.toc {
margin: 1.5em 0;
margin: 1.5em 0 2.5em;

/* overlfow ellipsis */
a {
Expand Down Expand Up @@ -111,7 +111,7 @@ aside:first-child nav {
aside { height: calc(100vh - 2em) }
h1 { margin-top: 0 }

body > header, body > nav, article + aside h3, .toc {
body > header, body > nav, article + aside h4, .toc {
display: none
}
}
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 cdc2c25

Please sign in to comment.