Skip to content

Commit d59f8c2

Browse files
SoreineSamyPesse
authored andcommitted
Fix link reference parsing after HTML (#98)
* Add failing test * Reorder definitions before HTML * Fix test output
1 parent a804ca3 commit d59f8c2

File tree

3 files changed

+69
-1
lines changed

3 files changed

+69
-1
lines changed

src/markdown/blocks/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@ const html = require('./html');
1414
const custom = require('./custom');
1515

1616
module.exports = [
17-
html,
17+
// All link definition (for link reference) must be resolved first.
1818
definition,
19+
// HTML must be high in the stack too.
20+
html,
1921
table,
2022
hr,
2123
list,
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<h1><p align="center"><a href="https://neutrino.js.org"><img src="https://raw.githubusercontent.com/mozilla-neutrino/neutrino-dev/master/docs/assets/logo.png" height="150"></a></p></h1>
2+
3+
[![NPM version][npm-image]][npm-url]
4+
5+
[npm-image]: https://img.shields.io/npm/v/neutrino.svg
6+
[npm-url]: https://npmjs.org/package/neutrino
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
document:
2+
data: {}
3+
kind: document
4+
nodes:
5+
- data:
6+
html: >-
7+
<h1><p align="center"><a href="https://neutrino.js.org"><img
8+
src="https://raw.githubusercontent.com/mozilla-neutrino/neutrino-dev/master/docs/assets/logo.png"
9+
height="150"></a></p></h1>
10+
kind: block
11+
isVoid: true
12+
type: html_block
13+
nodes:
14+
- kind: text
15+
ranges:
16+
- kind: range
17+
marks: []
18+
text: ' '
19+
- data: {}
20+
kind: block
21+
isVoid: false
22+
type: paragraph
23+
nodes:
24+
- kind: text
25+
ranges:
26+
- kind: range
27+
marks: []
28+
text: ''
29+
- data:
30+
href: 'https://npmjs.org/package/neutrino'
31+
kind: inline
32+
isVoid: false
33+
type: link
34+
nodes:
35+
- kind: text
36+
ranges:
37+
- kind: range
38+
marks: []
39+
text: ''
40+
- data:
41+
src: 'https://img.shields.io/npm/v/neutrino.svg'
42+
kind: inline
43+
isVoid: true
44+
type: image
45+
nodes:
46+
- kind: text
47+
ranges:
48+
- kind: range
49+
marks: []
50+
text: ' '
51+
- kind: text
52+
ranges:
53+
- kind: range
54+
marks: []
55+
text: ''
56+
- kind: text
57+
ranges:
58+
- kind: range
59+
marks: []
60+
text: ''

0 commit comments

Comments
 (0)