Igor Bochkariov
ebc9f50759
fallback to reference if a link is not valid
This commit makes martdown-it pass a new example introduced in cfc8416447
```
[foo](not a link)
[foo]: /url1
.
<p><a href="/url1">foo</a>(not a link)</p>
```
Ref: https://github.com/jgm/CommonMark/issues/427
9 years ago
Alex Kocharin
f5a06ec0b6
Make link/image/reference helpers overridable
9 years ago
Alex Kocharin
1482c3e64f
Disallow spaces inside links
1. between link label and reference: `[foo] [bar]`
2. inside angular brackets: `[](<foo bar>)`
9 years ago
Bernard Lambeau
68cfe099df
Check for the presence of `env` before `env.references`.
This commit fixes a "Cannot read property 'references' of undefined"
when parsing "[xxx]". state.env is sometimes undefined, and so are
references as well.
10 years ago
Alex Kocharin
b2aee1a978
Expand tabs only when it's needed, as per CommonMark 0.21
10 years ago
Alex Kocharin
77e8b6cad0
Add configurable url normalizers
- md.normalizeLink
- md.normalizeLinkText
10 years ago
Vitaly Puzrin
18d80c6f0b
Moved validateLink() to root class
10 years ago
Alex Kocharin
4aabd5592e
Use a common class for tokens
10 years ago
Vitaly Puzrin
e77666c4a0
moved normalizeReference to utils, closes #42
10 years ago
Alex Kocharin
8cb29935a3
Move reference rule to the block chain
11 years ago
Alex Kocharin
6497e9a80f
Split links rule to link+image
11 years ago
Vitaly Puzrin
e72603af70
Moved nesting check from rules to upper level
11 years ago
Vitaly Puzrin
a66e29f8d0
Place md link to states and remove other aliases
11 years ago
Vitaly Puzrin
56001200c0
Added link target attribute support for plugins
11 years ago
Alex Kocharin
ea62dda30b
Remove state.linkLevel
It's redundant after the changes in links algorithm.
11 years ago
Alex Kocharin
1d07999279
Avoid crash in links when references are disabled
11 years ago
Alex Kocharin
08f2d3eb4d
Forbid nested links, prefer inner one
11 years ago
Alex Kocharin
8470c1cae8
Fix an issue with links skipping space after them
11 years ago
Alex Kocharin
d7221761fb
Render image labels as text
11 years ago
Alex Kocharin
19e1aa28ea
use .toUpperCase() for link normalization
because __proto__ has magic and __PROTO__ doesn't
+ comments for the rest of ':' stuff
11 years ago
Alex Kocharin
1ff69abeba
Fix arbitrary keys in refs/footnotes/abbrs
11 years ago
Vitaly Puzrin
35063086ba
Moved link parse functions to helpers
11 years ago
Alex Kocharin
c9adb050e0
Preserve initial position in links
fix #55
11 years ago
Vitaly Puzrin
2040c4f02e
StateInline props rename
11 years ago
Alex Kocharin
5d772b9bb6
Add validation mode to all inline rules
11 years ago
Alex Kocharin
6d4538910c
Forbid nested reference links
11 years ago
Vitaly Puzrin
b27c630815
Code structure and options refactoring
11 years ago
Vitaly Puzrin
892460ed0b
Options rename
11 years ago
Alex Kocharin
0705173c87
Move link helpers to it's own file
+ return value of parseLink* functions in the state
11 years ago
Alex Kocharin
bbac451a42
Trivial bugfix in the links rule
11 years ago
Alex Kocharin
9aea37acc1
Limit element depth
11 years ago
Alex Kocharin
0453b72bf1
Rename "lexer" to "parser"
and move rules from lexer_* to rules_*
11 years ago
Alex Kocharin
46dc1f93ac
Add state.level everywhere
11 years ago
Alex Kocharin
b492fa2cc2
Add tokenizeSingle method
11 years ago
Alex Kocharin
0894209d96
Fix: whitespace in links element can contain newlines
11 years ago
Alex Kocharin
7884adfda2
Small bugfixes
11 years ago
Alex Kocharin
7432a6827c
Add collapsed and full reference links
11 years ago
Alex Kocharin
45da119338
Parse link reference definitions
11 years ago
Alex Kocharin
0b6b9d206d
Parse links and images
11 years ago