-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Instead of storing `attrs` as `[["key1", "value1"], ["key2", "value2"]]`, use `{"key1": "value1", "key2": "value2"}`. Upstream the list format is only used to guarantee order: markdown-it/markdown-it#142, but in Python 3.7+ dictionary order is now guaranteed by the specification (in Python 3.6 it is also preserved as an implementation detail). This change improves typing and performance. One should anyhow generally use the `attrGet`, `attrSet`, `attrPush` and `attrJoin` methods to manipulate `Token.attrs`, which all have an identical signature to those upstream. To minimize how breaking this change is, auto-conversion is done on `Token` initiation, i.e. you can still use `Token("type", "tag", 0, attrs=[["key", "value"]])`, and also `Token.as_dict(as_upstream=True)` converts the dict back to `null`/`list`, o that they can still be directly compared to those produced in the `debug` tab of https://markdown-it.github.io/. The `meta_serializer` option has also been added to `Token.as_dict`, which now ensures that this method is always able to produce valid JSON.
- Loading branch information
1 parent
00a28a6
commit 6204674
Showing
18 changed files
with
428 additions
and
408 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.