Skip to content

Commit

Permalink
py-markdown-it-py: update to 3.0.0.
Browse files Browse the repository at this point in the history
## 3.0.0 - 2023-06-03

⚠️ This release contains some minor breaking changes in the internal API and improvements to the parsing strictness.

**Full Changelog**: <executablebooks/markdown-it-py@v2.2.0...v3.0.0>

### ⬆️ UPGRADE: Drop support for Python 3.7

Also add testing for Python 3.11

### ⬆️ UPGRADE: Update from upstream markdown-it `12.2.0` to `13.0.0`

A key change is the addition of a new `Token` type, `text_special`, which is used to represent HTML entities and backslash escaped characters.
This ensures that (core) typographic transformation rules are not incorrectly applied to these texts.
The final core rule is now the new `text_join` rule, which joins adjacent `text`/`text_special` tokens,
and so no `text_special` tokens should be present in the final token stream.
Any custom typographic rules should be inserted before `text_join`.

A new `linkify` rule has also been added to the inline chain, which will linkify full URLs (e.g. `https://example.com`),
and fixes collision of emphasis and linkifier (so `http://example.org/foo._bar_-_baz` is now a single link, not emphasized).
Emails and fuzzy links are not affected by this.

* ♻️ Refactor backslash escape logic, add `text_special` [#276](executablebooks/markdown-it-py#276)
* ♻️ Parse entities to `text_special` token [#280](executablebooks/markdown-it-py#280)
* ♻️ Refactor: Add linkifier rule to inline chain for full links [#279](executablebooks/markdown-it-py#279)
* ‼️ Remove `(p)` => `§` replacement in typographer [#281](executablebooks/markdown-it-py#281)
* ‼️ Remove unused `silent` arg in `ParserBlock.tokenize` [#284](executablebooks/markdown-it-py#284)
* 🐛 FIX: numeric character reference passing [#272](executablebooks/markdown-it-py#272)
* 🐛 Fix: tab preventing paragraph continuation in lists [#274](executablebooks/markdown-it-py#274)
* 👌 Improve nested emphasis parsing [#273](executablebooks/markdown-it-py#273)
* 👌 fix possible ReDOS in newline rule [#275](executablebooks/markdown-it-py#275)
* 👌 Improve performance of `skipSpaces`/`skipChars` [#271](executablebooks/markdown-it-py#271)
* 👌 Show text of `text_special` in `tree.pretty` [#282](executablebooks/markdown-it-py#282)

### ♻️ REFACTOR: Replace most character code use with strings

The use of `StateBase.srcCharCode` is deprecated (with backward-compatibility), and all core uses are replaced by `StateBase.src`.

Conversion of source string characters to an integer representing the Unicode character is prevalent in the upstream JavaScript implementation, to improve performance.
However, it is unnecessary in Python and leads to harder to read code and performance deprecations (during the conversion in the `StateBase` initialisation).

See [#270](executablebooks/markdown-it-py#270), thanks to [@hukkinj1](https://github.com/hukkinj1).

### ♻️ Centralise indented code block tests

For CommonMark, the presence of indented code blocks prevent any other block element from having an indent of greater than 4 spaces.
Certain Markdown flavors and derivatives, such as mdx and djot, disable these code blocks though, since it is more common to use code fences and/or arbitrary indenting is desirable.
Previously, disabling code blocks did not remove the indent limitation, since most block elements had the 3 space limitation hard-coded.
This change centralised the logic of applying this limitation (in `StateBlock.is_code_block`), and only applies it when indented code blocks are enabled.

This allows for e.g.

```md
<div>
  <div>

    I can indent as much as I want here.

  <div>
<div>
```

See [#260](executablebooks/markdown-it-py#260)

### 🔧 Maintenance changes

Strict type annotation checking has been applied to the whole code base,
[ruff](https://github.com/charliermarsh/ruff) is now used for linting,
and fuzzing tests have been added to the CI, to integrate with Google [OSS-Fuzz](https://github.com/google/oss-fuzz/tree/master/projects/markdown-it-py) testing, thanks to [@DavidKorczynski](https://github.com/DavidKorczynski).

* 🔧 MAINTAIN: Make type checking strict [#](executablebooks/markdown-it-py#267)
* 🔧 Add typing of rule functions [#283](executablebooks/markdown-it-py#283)
* 🔧 Move linting from flake8 to ruff [#268](executablebooks/markdown-it-py#268)
* 🧪 CI: Add fuzzing workflow for PRs [#262](executablebooks/markdown-it-py#262)
* 🔧 Add tox env for fuzz testcase run [#263](executablebooks/markdown-it-py#263)
* 🧪 Add OSS-Fuzz set up by @DavidKorczynski in [#255](executablebooks/markdown-it-py#255)
* 🧪 Fix fuzzing test failures [#254](executablebooks/markdown-it-py#254)
  • Loading branch information
0-wiz-0 committed Jun 6, 2023
1 parent 149ab84 commit e0eb8f6
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 19 deletions.
6 changes: 3 additions & 3 deletions textproc/py-markdown-it-py/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# $NetBSD: Makefile,v 1.3 2023/03/05 07:27:37 adam Exp $
# $NetBSD: Makefile,v 1.4 2023/06/06 08:21:18 wiz Exp $

DISTNAME= markdown-it-py-2.2.0
DISTNAME= markdown-it-py-3.0.0
PKGNAME= ${PYPKGPREFIX}-${DISTNAME}
CATEGORIES= textproc python
MASTER_SITES= ${MASTER_SITE_PYPI:=m/markdown-it-py/}
Expand All @@ -15,7 +15,7 @@ DEPENDS+= ${PYPKGPREFIX}-mdurl>=0.1:../../www/py-mdurl

USE_LANGUAGES= # none

PYTHON_VERSIONS_INCOMPATIBLE= 27
PYTHON_VERSIONS_INCOMPATIBLE= 27 37

post-install:
cd ${DESTDIR}${PREFIX}/bin && \
Expand Down
28 changes: 16 additions & 12 deletions textproc/py-markdown-it-py/PLIST
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
@comment $NetBSD: PLIST,v 1.1 2023/02/20 10:52:16 adam Exp $
@comment $NetBSD: PLIST,v 1.2 2023/06/06 08:21:18 wiz Exp $
bin/markdown-it-${PYVERSSUFFIX}
${PYSITELIB}/${WHEEL_INFODIR}/INSTALLER
${PYSITELIB}/${WHEEL_INFODIR}/LICENSE
${PYSITELIB}/${WHEEL_INFODIR}/LICENSE.markdown-it
${PYSITELIB}/${WHEEL_INFODIR}/METADATA
${PYSITELIB}/${WHEEL_INFODIR}/RECORD
${PYSITELIB}/${WHEEL_INFODIR}/REQUESTED
${PYSITELIB}/${WHEEL_INFODIR}/WHEEL
${PYSITELIB}/${WHEEL_INFODIR}/direct_url.json
${PYSITELIB}/${WHEEL_INFODIR}/entry_points.txt
${PYSITELIB}/markdown_it/__init__.py
${PYSITELIB}/markdown_it/__init__.pyc
${PYSITELIB}/markdown_it/_compat.py
Expand Down Expand Up @@ -103,6 +94,8 @@ ${PYSITELIB}/markdown_it/rules_core/smartquotes.py
${PYSITELIB}/markdown_it/rules_core/smartquotes.pyc
${PYSITELIB}/markdown_it/rules_core/state_core.py
${PYSITELIB}/markdown_it/rules_core/state_core.pyc
${PYSITELIB}/markdown_it/rules_core/text_join.py
${PYSITELIB}/markdown_it/rules_core/text_join.pyc
${PYSITELIB}/markdown_it/rules_inline/__init__.py
${PYSITELIB}/markdown_it/rules_inline/__init__.pyc
${PYSITELIB}/markdown_it/rules_inline/autolink.py
Expand All @@ -117,12 +110,16 @@ ${PYSITELIB}/markdown_it/rules_inline/entity.py
${PYSITELIB}/markdown_it/rules_inline/entity.pyc
${PYSITELIB}/markdown_it/rules_inline/escape.py
${PYSITELIB}/markdown_it/rules_inline/escape.pyc
${PYSITELIB}/markdown_it/rules_inline/fragments_join.py
${PYSITELIB}/markdown_it/rules_inline/fragments_join.pyc
${PYSITELIB}/markdown_it/rules_inline/html_inline.py
${PYSITELIB}/markdown_it/rules_inline/html_inline.pyc
${PYSITELIB}/markdown_it/rules_inline/image.py
${PYSITELIB}/markdown_it/rules_inline/image.pyc
${PYSITELIB}/markdown_it/rules_inline/link.py
${PYSITELIB}/markdown_it/rules_inline/link.pyc
${PYSITELIB}/markdown_it/rules_inline/linkify.py
${PYSITELIB}/markdown_it/rules_inline/linkify.pyc
${PYSITELIB}/markdown_it/rules_inline/newline.py
${PYSITELIB}/markdown_it/rules_inline/newline.pyc
${PYSITELIB}/markdown_it/rules_inline/state_inline.py
Expand All @@ -131,11 +128,18 @@ ${PYSITELIB}/markdown_it/rules_inline/strikethrough.py
${PYSITELIB}/markdown_it/rules_inline/strikethrough.pyc
${PYSITELIB}/markdown_it/rules_inline/text.py
${PYSITELIB}/markdown_it/rules_inline/text.pyc
${PYSITELIB}/markdown_it/rules_inline/text_collapse.py
${PYSITELIB}/markdown_it/rules_inline/text_collapse.pyc
${PYSITELIB}/markdown_it/token.py
${PYSITELIB}/markdown_it/token.pyc
${PYSITELIB}/markdown_it/tree.py
${PYSITELIB}/markdown_it/tree.pyc
${PYSITELIB}/markdown_it/utils.py
${PYSITELIB}/markdown_it/utils.pyc
${PYSITELIB}/${WHEEL_INFODIR}/INSTALLER
${PYSITELIB}/${WHEEL_INFODIR}/LICENSE
${PYSITELIB}/${WHEEL_INFODIR}/LICENSE.markdown-it
${PYSITELIB}/${WHEEL_INFODIR}/METADATA
${PYSITELIB}/${WHEEL_INFODIR}/RECORD
${PYSITELIB}/${WHEEL_INFODIR}/REQUESTED
${PYSITELIB}/${WHEEL_INFODIR}/WHEEL
${PYSITELIB}/${WHEEL_INFODIR}/direct_url.json
${PYSITELIB}/${WHEEL_INFODIR}/entry_points.txt
8 changes: 4 additions & 4 deletions textproc/py-markdown-it-py/distinfo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$NetBSD: distinfo,v 1.2 2023/03/05 07:27:37 adam Exp $
$NetBSD: distinfo,v 1.3 2023/06/06 08:21:18 wiz Exp $

BLAKE2s (markdown-it-py-2.2.0.tar.gz) = acc8bf0cd757c6027db4716829bb250f594d43c2fdc61ba7885621f666397536
SHA512 (markdown-it-py-2.2.0.tar.gz) = 3b9b8d91dd21cdc750025588fe489ad82b1f9003fdb50b179c4657f2c1fdc3a69c32d7532896fc2303a544e4576dada30ea7ec139024983aa693f93d17df3a34
Size (markdown-it-py-2.2.0.tar.gz) = 67120 bytes
BLAKE2s (markdown-it-py-3.0.0.tar.gz) = 6dce14563475d1c36927e0b3b9b81923a37e6b8d7c9626967d9fd858383e5488
SHA512 (markdown-it-py-3.0.0.tar.gz) = a862b450ad1d530320d9ece7b2dc370152105c568e9d79df622aaba84b986a3e24326f6cbca313d66edf9a61823d91076b815f81b978fae663d6d7cc239a5ac1
Size (markdown-it-py-3.0.0.tar.gz) = 74596 bytes

0 comments on commit e0eb8f6

Please sign in to comment.