The first stable release of markdown-it-py 🎉
See the changes in the beta releases below, thanks to all the contributors in the last year!
RendererProtocoltype, for typing renderers (thanks to @hukkinj1)
Noneis no longer allowed as a valid
‼️ BREAKING: Move
mdit-py-plugins out of the core install requirements and into a
Synchronised code with the upstream Markdown-It
This is the first beta release of the stable v1.x series.
There are four notable (and breaking) changes:
v12.0.4. In particular, this update alters the parsing of tables to be consistent with the GFM specification: https://github.github.com/gfm/#tables-extension- A number of parsing performance and validation improvements are also included.
Token.attrsare now stored as dictionaries, rather than a list of lists. This is a departure from upstream Markdown-It, allowed by Pythons guarantee of ordered dictionaries (see #142), and is the more natural representation. Note
attrJoinmethods remain identical to those upstream, and
Token.as_dict(as_upstream=True)will convert the token back to a directly comparable dict.
AttrDicthas been replaced: For
MarkdownIt.optionsit is now set as an
OptionsDict, which is a dictionary sub-class, with attribute access only for core MarkdownIt configuration keys.
SyntaxTreeNode. This is a more comprehensive replacement for
NestedTokens(which are now deprecated). It allows for the
Tokenstream to be converted to/from a nested tree structure, with opening/closing tokens collapsed into a single
SyntaxTreeNodeand the intermediate tokens set as children. See Creating a syntax tree documentation for details.
This release brings Markdown-It-Py inline with Markdown-It v11.0.1 (2020-09-14), applying two fixes:
Thanks to @hukkinj1!
This release provides some improvements to the code base:
🗑 DEPRECATE: Move plugins to
markdown_it.extensions) have now been moved to executablebooks/mdit-py-plugins. This will allow for their maintenance to occur on a different cycle to the core code, facilitating the release of a v1.0.0 for this package
🔧 MAINTAIN: Add mypy type-checking, thanks to @hukkinj1.
✨ NEW: Add linkify, thanks to @tsutsu3.
This extension uses linkify-it-py to identify URL links within text:
Important: To use this extension you must install linkify-it-py;
pip install markdown-it-py[linkify]
It can then be activated by:
from markdown_it import MarkdownIt md = MarkdownIt().enable("linkify") md.options["linkify"] = True
✨ NEW: Add smartquotes, thanks to @tsutsu3.
This extension will convert basic quote marks to their opening and closing variants:
It can be activated by:
from markdown_it import MarkdownIt md = MarkdownIt().enable("smartquotes") md.options["typographer"] = True
✨ NEW: Add markdown-it-task-lists plugin, thanks to @wna-se.
This is a port of the JS markdown-it-task-lists, for building task/todo lists out of markdown lists with items starting with
[ ] or
[x]. For example:
- [ ] An item that needs doing - [x] An item that is complete
This plugin can be activated by:
from markdown_it import MarkdownIt from markdown_it.extensions.tasklists import tasklists_plugin md = MarkdownIt().use(tasklists_plugin)
🐛 Various bug fixes, thanks to @hukkinj1:
_Entities.__contains__fix return data
🧪 TESTS: Add CI for Python 3.9 and PyPy3
✨ NEW: Add simple typographic replacements, thanks to @tsutsu3: This allows you to add the
typographer option to the parser, to replace particular text constructs:
md = MarkdownIt().enable("replacements") md.options["typographer"] = True
📚 DOCS: Improve documentation for CLI, thanks to @westurner
👌 IMPROVE: Use
re.sub() instead of
re.subn(), thanks to @hukkinj1
🐛 FIX: An exception raised by having multiple blank lines at the end of some files
👌 IMPROVE: Add
This allows for storage of original reference label in link/image token's metadata, which can be useful for renderers.
✨ NEW: Add
anchors_plugin for headers, which can produce:
<h1 id="title-string">Title String <a class="header-anchor" href="#title-string">¶</a></h1>
🐛 Fixed an undefined variable in the reference block.
🐛 Fixed an
container_plugin, when there is no newline on the closing tag line.
⬆️ UPGRADE: attrs -> v20
This is not breaking, since it only deprecates Python 3.4 (see CHANGELOG.rst)
dollarmathplugins (see plugins list).
containersplugin (see plugins list)