Skip to content

Commit

Permalink
run all tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nobkd committed Jan 31, 2025
1 parent a37d52a commit 3fbf049
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
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
6 changes: 3 additions & 3 deletions packages/nuemark/test/tag.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,16 +255,16 @@ const svgpath = join(relpath, 'test.svg')

test('[svg]', () => {
const html = renderLines([`[svg ${svgpath}]`])
expect(html).toBe('<svg/>')
expect(html).toBe('<svg class="icon"/>')
})

test('[svg] nested in [button]', () => {
const html = renderLines(['[button href="/"]', ` [svg ${svgpath}] *Yo*`])
expect(html).toBe('<a href="/" role="button"><svg/> <em>Yo</em></a>')
expect(html).toBe('<a href="/" role="button"><svg class="icon"/> <em>Yo</em></a>')
})


test.only('[define]', () => {
test('[define]', () => {
const content = [
'[define]',
' ## Design System { #ds.foo }',
Expand Down

0 comments on commit 3fbf049

Please sign in to comment.