1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 01:36:22 +00:00

fix: array access error when token.map is null, fix #3123

This commit is contained in:
hikerpig
2019-07-24 23:49:07 +08:00
committed by Junyoung Choi
parent 7797661489
commit 972d053c83
5 changed files with 30 additions and 2 deletions

View File

@@ -104,6 +104,11 @@ Term 2 with *inline markup*
`
const shortcuts = '<kbd>Ctrl</kbd>\n\n[[Ctrl]]'
const footnote = `
^[hello-world]
hello-world: https://github.com/BoostIO/Boostnote/
`
export default {
basic,
codeblock,
@@ -115,5 +120,6 @@ export default {
subTexts,
supTexts,
deflists,
shortcuts
shortcuts,
footnote
}

View File

@@ -68,3 +68,8 @@ test('Markdown.render() should render shortcuts correctly', t => {
const rendered = md.render(markdownFixtures.shortcuts)
t.snapshot(rendered)
})
test('Markdown.render() should render footnote correctly', t => {
const rendered = md.render(markdownFixtures.footnote)
t.snapshot(rendered)
})

View File

@@ -4,6 +4,21 @@ The actual snapshot is saved in `markdown-test.js.snap`.
Generated by [AVA](https://ava.li).
## Markdown.render() should render footnote correctly
> Snapshot 1
`<p data-line="1"><sup class="footnote-ref"><a href="#fn1" id="fnref1">[1]</a></sup><br />␊
hello-world: <a href="https://github.com/BoostIO/Boostnote/">https://github.com/BoostIO/Boostnote/</a></p>␊
<hr class="footnotes-sep" />␊
<section class="footnotes">␊
<ol class="footnotes-list">␊
<li id="fn1" class="footnote-item"><p>hello-world <a href="#fnref1" class="footnote-backref">↩︎</a></p>␊
</li>␊
</ol>␊
</section>␊
`
## Markdown.render() should render line breaks correctly
> Snapshot 1