Skip to content

Commit

Permalink
Change to remove support for Footnote nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Jul 16, 2023
1 parent 6fc783a commit c13fe7f
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 164 deletions.
48 changes: 0 additions & 48 deletions lib/handlers/footnote.js

This file was deleted.

2 changes: 0 additions & 2 deletions lib/handlers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {code} from './code.js'
import {strikethrough} from './delete.js'
import {emphasis} from './emphasis.js'
import {footnoteReference} from './footnote-reference.js'
import {footnote} from './footnote.js'
import {heading} from './heading.js'
import {html} from './html.js'
import {imageReference} from './image-reference.js'
Expand Down Expand Up @@ -33,7 +32,6 @@ export const handlers = {
delete: strikethrough,
emphasis,
footnoteReference,
footnote,
heading,
html,
imageReference,
Expand Down
54 changes: 0 additions & 54 deletions test/footnote-mixed.js

This file was deleted.

59 changes: 0 additions & 59 deletions test/footnote.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,65 +8,6 @@ import {toHast} from '../index.js'

test('footnote', async function (t) {
await t.test('should render `footnote`s (#1)', async function () {
const tree = toHast({
type: 'root',
// @ts-expect-error: to do: remove `footnote`s.
children: [{type: 'footnote', children: [{type: 'text', value: 'alpha'}]}]
})
assert(tree, 'expected node')
assert.equal(
// @ts-expect-error: to do: remove when `to-html` is released.
toHtml(tree),
`<sup><a href="#user-content-fn-1" id="user-content-fnref-1" data-footnote-ref aria-describedby="footnote-label">1</a></sup>
<section data-footnotes class="footnotes"><h2 class="sr-only" id="footnote-label">Footnotes</h2>
<ol>
<li id="user-content-fn-1">
<p>alpha <a href="#user-content-fnref-1" data-footnote-backref class="data-footnote-backref" aria-label="Back to content">↩</a></p>
</li>
</ol>
</section>`
)
})

await t.test('should render `footnote`s (#2)', async function () {
const tree = toHast({
type: 'root',
children: [
{
type: 'footnoteDefinition',
identifier: '1',
children: [
{type: 'paragraph', children: [{type: 'text', value: 'bravo'}]}
]
},
{
type: 'paragraph',
children: [{type: 'footnoteReference', identifier: '1'}]
},
// @ts-expect-error: to do: remove `footnote`s.
{type: 'footnote', children: [{type: 'text', value: 'charlie'}]}
]
})
assert(tree, 'expected node')
assert.equal(
// @ts-expect-error: to do: remove when `to-html` is released.
toHtml(tree),
`<p><sup><a href="#user-content-fn-1" id="user-content-fnref-1" data-footnote-ref aria-describedby="footnote-label">1</a></sup></p>
<sup><a href="#user-content-fn-2" id="user-content-fnref-2" data-footnote-ref aria-describedby="footnote-label">2</a></sup>
<section data-footnotes class="footnotes"><h2 class="sr-only" id="footnote-label">Footnotes</h2>
<ol>
<li id="user-content-fn-1">
<p>bravo <a href="#user-content-fnref-1" data-footnote-backref class="data-footnote-backref" aria-label="Back to content">↩</a></p>
</li>
<li id="user-content-fn-2">
<p>charlie <a href="#user-content-fnref-2" data-footnote-backref class="data-footnote-backref" aria-label="Back to content">↩</a></p>
</li>
</ol>
</section>`
)
})

await t.test('should render `footnote`s (#3)', async function () {
const tree = toHast({
type: 'root',
children: [
Expand Down
1 change: 0 additions & 1 deletion test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import './delete.js'
import './emphasis.js'
import './footnote-definition.js'
import './footnote-reference.js'
import './footnote-mixed.js'
import './footnote.js'
import './heading.js'
import './html.js'
Expand Down

0 comments on commit c13fe7f

Please sign in to comment.