Skip to content

Commit eb4dc88

Browse files
authored
Merge branch 'master' into fix-urls
2 parents 49c27bb + 22a65b3 commit eb4dc88

File tree

9 files changed

+40
-22
lines changed

9 files changed

+40
-22
lines changed

.github/workflows/tests.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ jobs:
2323
- name: Set up Python 3.8
2424
uses: actions/setup-python@v2
2525
with:
26-
python-version: 3.8
26+
python-version: '3.8'
2727
- uses: pre-commit/action@v2.0.0
2828

2929
tests:
3030

3131
runs-on: ubuntu-latest
3232
strategy:
3333
matrix:
34-
python-version: [pypy-3.6, 3.6, 3.7, 3.8, 3.9]
34+
python-version: ['pypy-3.6', '3.6', '3.7', '3.8', '3.9', '3.10']
3535

3636
steps:
3737
- uses: actions/checkout@v2
@@ -45,9 +45,9 @@ jobs:
4545
pip install .[testing,linkify]
4646
- name: Run pytest
4747
run: |
48-
pytest --cov=markdown_it --cov-report=xml --cov-report=term-missing
48+
pytest tests/ --cov=markdown_it --cov-report=xml --cov-report=term-missing
4949
- name: Upload to Codecov
50-
if: matrix.python-version == 3.7 && github.repository == 'executablebooks/markdown-it-py'
50+
if: matrix.python-version == '3.7' && github.repository == 'executablebooks/markdown-it-py'
5151
uses: codecov/codecov-action@v1
5252
with:
5353
name: markdown-it-py-pytests-py3.7
@@ -60,7 +60,7 @@ jobs:
6060
runs-on: ubuntu-latest
6161
strategy:
6262
matrix:
63-
python-version: [3.8]
63+
python-version: ['3.8']
6464
steps:
6565
- uses: actions/checkout@v2
6666
- name: Set up Python ${{ matrix.python-version }}
@@ -87,7 +87,7 @@ jobs:
8787
- name: Set up Python 3.8
8888
uses: actions/setup-python@v2
8989
with:
90-
python-version: 3.8
90+
python-version: '3.8'
9191

9292
- name: Install tox
9393
run: |
@@ -116,7 +116,7 @@ jobs:
116116
- name: Set up Python 3.7
117117
uses: actions/setup-python@v2
118118
with:
119-
python-version: 3.7
119+
python-version: '3.7'
120120
- name: Build package
121121
run: |
122122
pip install wheel

markdown_it/port.yaml

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

markdown_it/ruler.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def __compile__(self) -> None:
103103
def at(self, ruleName: str, fn: RuleFunc, options=None):
104104
"""Replace rule by name with new function & options.
105105
106-
:param name: rule name to replace.
106+
:param ruleName: rule name to replace.
107107
:param fn: new rule function.
108108
:param options: new rule options (not mandatory).
109109
:raises: KeyError if name not found
@@ -135,8 +135,8 @@ def before(self, beforeName: str, ruleName: str, fn: RuleFunc, options=None):
135135
def after(self, afterName: str, ruleName: str, fn: RuleFunc, options=None):
136136
"""Add new rule to chain after one with given name.
137137
138-
:param beforeName: new rule will be added before this one.
139-
:param ruleName: new rule will be added before this one.
138+
:param afterName: new rule will be added after this one.
139+
:param ruleName: new rule will be added after this one.
140140
:param fn: new rule function.
141141
:param options: new rule options (not mandatory).
142142
:raises: KeyError if name not found
@@ -153,7 +153,7 @@ def after(self, afterName: str, ruleName: str, fn: RuleFunc, options=None):
153153
def push(self, ruleName: str, fn: RuleFunc, options=None):
154154
"""Push new rule to the end of chain.
155155
156-
:param ruleName: new rule will be added before this one.
156+
:param ruleName: new rule will be added to the end of chain.
157157
:param fn: new rule function.
158158
:param options: new rule options (not mandatory).
159159

markdown_it/rules_block/code.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def code(state: StateBlock, startLine: int, endLine: int, silent: bool = False):
2929
state.line = last
3030

3131
token = state.push("code_block", "code", 0)
32-
token.content = state.getLines(startLine, last, 4 + state.blkIndent, True)
32+
token.content = state.getLines(startLine, last, 4 + state.blkIndent, False) + "\n"
3333
token.map = [startLine, state.line]
3434

3535
return True

setup.cfg

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ classifiers =
1818
Programming Language :: Python :: 3.7
1919
Programming Language :: Python :: 3.8
2020
Programming Language :: Python :: 3.9
21+
Programming Language :: Python :: 3.10
2122
Programming Language :: Python :: Implementation :: CPython
2223
Programming Language :: Python :: Implementation :: PyPy
2324
Topic :: Software Development :: Libraries :: Python Modules
@@ -62,11 +63,13 @@ rtd =
6263
sphinx_book_theme
6364
testing =
6465
coverage
65-
psutil
66-
pytest>=3.6,<4
67-
pytest-benchmark~=3.2
66+
pytest
6867
pytest-cov
6968
pytest-regressions
69+
benchmarking =
70+
psutil
71+
pytest
72+
pytest-benchmark~=3.2
7073

7174
[options.packages.find]
7275
exclude =

tests/test_port/fixtures/normalize.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,11 @@ Don't encode domains in unknown schemas:
2929
.
3030
<p><a href="skype:%CE%B3%CE%B3%CE%B3"></a></p>
3131
.
32+
33+
34+
Square brackets are allowed
35+
.
36+
[foo](https://bar]baz.org)
37+
.
38+
<p><a href="https://bar%5Dbaz.org">foo</a></p>
39+
.

tests/test_port/test_fixtures.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,12 @@ def test_commonmark_extras(line, title, input, expected):
7777
read_fixture_file(FIXTURE_PATH.joinpath("normalize.md")),
7878
)
7979
def test_normalize_url(line, title, input, expected):
80+
if title in {
81+
"Keep %25 as is because decoding it may break urls, #720",
82+
"Square brackets are allowed",
83+
}:
84+
# TODO fix failing url escaping test
85+
pytest.xfail("url normalisation")
8086
md = MarkdownIt("commonmark")
8187
text = md.render(input)
8288
assert text.rstrip() == expected.rstrip()

tests/test_port/test_no_end_newline.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
("<h1></h1>", "<h1></h1>"),
1818
("p", "<p>p</p>\n"),
1919
("[reference]: /url", ""),
20+
(" indented code block", "<pre><code>indented code block\n</code></pre>\n"),
2021
],
2122
)
2223
def test_no_end_newline(input, expected):

tox.ini

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ envlist = py37
99
[testenv]
1010
usedevelop = true
1111

12-
[testenv:py{36,37,38,39}]
12+
[testenv:py{36,37,38,39,310}]
1313
extras =
1414
linkify
1515
testing
16-
commands = pytest {posargs}
16+
commands = pytest tests/ {posargs}
1717

18-
[testenv:py{36,37,38,39}-plugins]
18+
[testenv:py{36,37,38,39,310}-plugins]
1919
extras = testing
2020
changedir = {envtmpdir}
2121
allowlist_externals =
@@ -28,11 +28,11 @@ commands =
2828
pytest {posargs}
2929

3030
[testenv:py{36,37,38,39}-bench-core]
31-
extras = testing
31+
extras = benchmarking
3232
commands = pytest benchmarking/bench_core.py {posargs}
3333

3434
[testenv:py{36,37,38}-bench-packages]
35-
extras = testing,compare
35+
extras = benchmarking,compare
3636
commands = pytest benchmarking/bench_packages.py {posargs}
3737

3838
[testenv:docs-{update,clean}]

0 commit comments

Comments
 (0)