Skip to content

Commit 42e5732

Browse files
authored
⬆️ Update: Sync with markdown-it v12.1.0 and CommonMark v0.30 (#168)
A port of markdown-it/markdown-it@df4607f...13cdeb9: - Update CommonMark spec to 0.30 - Fix emphasis algorithm as per 0.30 spec - Update HMTL_SEQUENCES regexes as per CM 0.30 spec
1 parent 1d27af1 commit 42e5732

File tree

11 files changed

+7054
-6890
lines changed

11 files changed

+7054
-6890
lines changed

markdown_it/port.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
- package: markdown-it/markdown-it
2-
version: 12.0.6
3-
commit: df4607f1d4d4be7fdc32e71c04109aea8cc373fa
4-
date: Apr 16, 2021
2+
version: 12.1.0
3+
commit: 13cdeb95abccc78a5ce17acf9f6e8cf5b9ce713b
4+
date: Jul 1, 2021
55
notes:
66
- Rename variables that use python built-in names, e.g.
77
- `max` -> `maximum`

markdown_it/rules_block/html_block.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
# last argument defines whether it can terminate a paragraph or not
1414
HTML_SEQUENCES: List[Tuple[Pattern, Pattern, bool]] = [
1515
(
16-
re.compile(r"^<(script|pre|style)(?=(\s|>|$))", re.IGNORECASE),
17-
re.compile(r"<\/(script|pre|style)>", re.IGNORECASE),
16+
re.compile(r"^<(script|pre|style|textarea)(?=(\s|>|$))", re.IGNORECASE),
17+
re.compile(r"<\/(script|pre|style|textarea)>", re.IGNORECASE),
1818
True,
1919
),
2020
(re.compile(r"^<!--"), re.compile(r"-->"), True),

markdown_it/rules_inline/balance_pairs.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,15 @@ def processDelimiters(state: StateInline, delimiters, *args):
2323
continue
2424

2525
# Previously calculated lower bounds (previous fails)
26-
# for each marker and each delimiter length modulo 3.
26+
# for each marker, each delimiter length modulo 3,
27+
# and for whether this closer can be an opener;
28+
# https://github.com/commonmark/cmark/commit/34250e12ccebdc6372b8b49c44fab57c72443460
2729
if closer.marker not in openersBottom:
28-
openersBottom[closer.marker] = [-1, -1, -1]
30+
openersBottom[closer.marker] = [-1, -1, -1, -1, -1, -1]
2931

30-
minOpenerIdx = openersBottom[closer.marker][closer.length % 3]
32+
minOpenerIdx = openersBottom[closer.marker][
33+
(3 if closer.open else 0) + (closer.length % 3)
34+
]
3135

3236
openerIdx = closerIdx - closer.jump - 1
3337

@@ -89,7 +93,9 @@ def processDelimiters(state: StateInline, delimiters, *args):
8993
# See details here:
9094
# https:#github.com/commonmark/cmark/issues/178#issuecomment-270417442
9195
#
92-
openersBottom[closer.marker][(closer.length or 0) % 3] = newMinOpenerIdx
96+
openersBottom[closer.marker][
97+
(3 if closer.open else 0) + ((closer.length or 0) % 3)
98+
] = newMinOpenerIdx
9399

94100
closerIdx += 1
95101

0 commit comments

Comments
 (0)