Brian Morearty
91c115d87b
Moved `hljs` class to `<code>` from `<pre>`. ( #913 )
In this change set I am changing the guidance in the README
and in comments to put the class on the correct tag: `<code>`, not `<pre>`.
If you put the `hljs` class on `<pre>`, syntax highlighting
does not use the correct padding.
You can see from the default CSS stylesheet in the highlight.js
repo that the `hljs` tag is expected to be on the `<code>` tag:
84719c17a5/src/styles/default.css (L17-L25)
All the official highlight.js examples have the `hljs` class on `<code>`:
https://highlightjs.org/static/demo/
1 year ago
Alex Kocharin
80a3adc094
Fix crash in linkify inline rule on malformed input
1 year ago
Baoshuo Ren
940459e654
fix: remove outdated comments ( #891 )
ref: f52351499b
2 years ago
Alex Kocharin
1529ff4944
Guard against custom rule not incrementing pos
3 years ago
Alex Kocharin
6325878f9f
Multiple refactors
removed unused and duplicated variables
3 years ago
Alex Kocharin
9ff460ef87
Drop a lot of extra code from blockquotes
1st iteration before the loop is exactly the same as a part of that loop
this effectively replaces:
```
do(0)
for (i = 1; i < x; i++) do(i)
```
with:
```
for (i = 0; i < x; i++) do(i)
```
3 years ago
Tobias Speicher
e6d1bfdee1
refactor: replace deprecated String.prototype.substr()
.substr() is deprecated so we replace it with .slice() which works similarily but isn't deprecated
Signed-off-by: Tobias Speicher <rootcommander@gmail.com>
3 years ago
Alex Kocharin
f52351499b
Remove (p) => § replacement in typographer
close https://github.com/markdown-it/markdown-it/issues/763
3 years ago
Alex Kocharin
3fc0deb38b
Put entities to separate token
3 years ago
Alex Kocharin
6b58ec4245
Add linkifier rule to inline chain for full links
prevents emphasis from appearing in `http://example.org/foo._bar_.baz `
3 years ago
Alex Kocharin
75037c6514
Put escape sequences into separate token
3 years ago
Mizux
c7e36eb12d
Fix typo
3 years ago
Vitaly Puzrin
ffc49ab46b
Fix possible ReDOS in newline rule.
Co-authored-by: MakeNowJust <make.just.on@gmail.com>
3 years ago
Alex Kocharin
1cd8a5143b
Fix tab preventing paragraph continuation in lists
close https://github.com/markdown-it/markdown-it/issues/830
3 years ago
Alex Kocharin
24abaa51a6
Improve emphasis algorithm
This fixes quadratic complexity in `**<...>**a**<...>**`
pathological case.
3 years ago
Himanshu Mehta
e07a9ddeee
typo fix
3 years ago
Eddie Kohler
8bcc82aa74
Parser: Set ordered list_item_open token info to input marker.
For instance, in a list
1. Item 1
20. Item 2
the first list_item_open token will have token.info === '1', and the
second will have token.info === '20'.
This is useful for later rendering plugins that might want to
use the actual markers.
4 years ago
Taneli Hukkinen
e5986bb7cc
Always suffix indented code block with a newline
3 years ago
Alex Kocharin
eed156e9cd
Fix emphasis algorithm as per 0.30 spec
https://github.com/commonmark/cmark/issues/383
4 years ago
Alex Kocharin
0b14fa069f
Update CommonMark spec to 0.30
4 years ago
Vitaly Puzrin
064d602c68
Updated highlight.js usage info
- Ref #779
4 years ago
Taneli Hukkinen
272a470ed2
Fix newline not rendered in image alt attribute
4 years ago
Alex Kocharin
309c03a9e8
Lower priority for ATX headers to resolve conflict with HTML blocks
fix https://github.com/markdown-it/markdown-it/issues/772
4 years ago
Taneli Hukkinen
cd5296f1e7
Fix table/list parsing ambiguity ( #767 )
4 years ago
Taneli Hukkinen
32564bad8d
Clarify `Token.info` comment
4 years ago
Vitaly Puzrin
c9949dd585
Avoid fenced token mutation, #745
4 years ago
Alex Kocharin
c9dd942246
Fix crash when processing strikethrough
close https://github.com/markdown-it/markdown-it/issues/742
4 years ago
Alex Kocharin
ddbb195546
Remove meta from list of block html tags
ref https://github.com/commonmark/commonmark-spec/issues/527
4 years ago
Alex Kocharin
8ad16ac4d9
Allow EOL in processing instructions
same fix as in https://github.com/commonmark/commonmark.js/issues/196
4 years ago
Alex Kocharin
e729b90a1d
Fix quadratic complexity in autolinks
close https://github.com/markdown-it/markdown-it/issues/737
4 years ago
Alex Kocharin
8cd6fc34c4
Fix quadratic compexity on backticks
close https://github.com/markdown-it/markdown-it/issues/736
4 years ago
Alex Kocharin
2290e109c5
Disallow escaped spaces inside link destination
4 years ago
Alex Kocharin
83b05755db
Fix quadratic time on emphasis
close https://github.com/markdown-it/markdown-it/issues/735
4 years ago
Alex Kocharin
537ab89d7c
Don't try to parse link title if link wasn't found
4 years ago
Alex Kocharin
fece91e265
Fix backtick algorithm
now it more closely matches one in `cmark`
4 years ago
Alex Kocharin
b1651b1363
Stop link title parsing when second `(` is found
`[](url (xxx())` is no longer a valid link
4 years ago
Alex Kocharin
1e8aff0084
Fix quadratic time on backticks
This commit adds a cache `StateInline->backticks` which remembers
positions for every possible backtick closer (`, ``, ```, etc.).
Algorithm is similar to one described here:
685b714453
close https://github.com/markdown-it/markdown-it/issues/733
4 years ago
Alex Kocharin
1910a3cdb2
Limit () nesting inside urls
Allow no more than 32 levels of nesting in `[]( (((((....))))) )`
for performance reasons.
close https://github.com/markdown-it/markdown-it/issues/732
4 years ago
Alex Kocharin
f688abccaf
Stop link parsing when second `<` is found
`[](<foo<bar>)` is no longer a valid link
4 years ago
Alex Kocharin
b56eeb01d9
Table with no columns is no longer a table
this is now just raw text:
```md
|
|
|
```
close https://github.com/markdown-it/markdown-it/issues/724
4 years ago
Alex Kocharin
75fe6e0c76
Fix tables inside lists indented with tabs
close https://github.com/markdown-it/markdown-it/issues/721
4 years ago
Vitaly Puzrin
564de6b249
Deps bump & related updates
4 years ago
Alex Kocharin
f156ed1bff
Don't decode %25 in beautified urls
fix https://github.com/markdown-it/markdown-it/issues/720
4 years ago
Alex Kocharin
9fe835bc12
Fix mappings for table rows
- `table`, `tbody`, `tr` now have mapping
- `th`, `td`, `inline` in tables do not have it
close https://github.com/markdown-it/markdown-it/issues/705
4 years ago
Alex Kocharin
866fba34a2
Add lang str remainder to highlight callback
``` javascript {line-numbers=5 highlight=14-17}
test
```
This markup now calls `highlight` like this:
require('markdown-it')({
highlight(code, lang, attrs) {
assert(code === 'test')
assert(lang === 'javascript')
assert(attrs === '{line-numbers=5 highlight=14-17}')
}
})
close https://github.com/markdown-it/markdown-it/issues/626
close https://github.com/markdown-it/markdown-it/pull/706
4 years ago
Alex Kocharin
3021a5207b
Bring pipe escape algorithm in tables closer to gfm
- table now doesn't deal with backticks at all
- `|` is considered escaped if and only if there is a `\` character immediately before it
- number of elements in the first row (thead) now must match second row (aligns) exactly
- no tbody if it would be empty
close https://github.com/markdown-it/markdown-it/issues/689
close https://github.com/markdown-it/markdown-it/pull/697
4 years ago
Vas Sudanagunta
6629917dec
Remove unnecessary calculation
4 years ago
ocavue
b979ca01d5
fix: remove unused comparison code
4 years ago
Alex Kocharin
0b1699b034
Add missing line mapping for table rows
fix https://github.com/markdown-it/markdown-it/issues/705
4 years ago
Alex Kocharin
805c69528d
Fix smartquotes adjacent to code block
close https://github.com/markdown-it/markdown-it/issues/677
4 years ago