Releases: miyuchina/mistletoe
Releases · miyuchina/mistletoe
v1.4.0
Added
-
Add
parent
attribute/property (#71 via #206).COMPATIBILITY REMARKS:
- As the
children
attribute changed to property, existing code needs to be changed like this:-hasattr(token, 'children') +token.children is not None # ... -'children' in vars(token) +token.children is not None # ... -getattr(token, 'children', []) +token.children or []
- As the
Fixed
- Incomplete sdist content (#219).
Changed
v1.3.0
Added
- Add line numbers (
line_number
attribute) on all block tokens during parsing (#188). - More thorough documentation and explanation of AST and tokens in the Developer's Guide (within #188).
HtmlRenderer
: Option to skip HTML tokens parsing (#74 via #204). Just passprocess_html_tokens=False
to the renderer's constructor.LaTeXRenderer
: Add AMS packages for Math (#207).
Fixed
MarkdownRenderer
: Penultimate lines of multiline fragments being ignored (#201).MathJaxRenderer
: Output inline math (in:$...$
) correctly (out:\(...\)
) (#195).- Make local installation work again with pip 23.2 and above (fb231b1).
Changed
-
MarkdownRenderer
: Keep the original content spacing after the list marker (#196 via #197).COMPATIBILITY REMARKS:
- The old behavior can be enforced by passing
normalize_whitespace=True
to the renderer's constructor (#202). - Provided you create
ListItem
's tokens directly via its constructor, you need to pass it a new parameter calledindentation
(number of spaces before the item marker):-def __init__(self, parse_buffer, prepend, leader): +def __init__(self, parse_buffer, indentation, prepend, leader):
- The old behavior can be enforced by passing
For contributors:
- Improvements in the Python styling checks, setup and documentation - see diff.
v1.2.1
v1.2.0
Fixed
FileWrapper
's methods anchor/reset are DEPRECATED, use a more versatile get_pos/set_pos approach instead (#186).LaTeXRenderer
: Escape special characters in URLs of generated links (#114 via #190).
Changed
- Do not escape double or single quotes by default (#181).
- As in GFM, tables are allowed to interrupt paragraphs by default (#166 via #187). Set
mistletoe.block_token.Table.interrupt_paragraph
tofalse
if you need the old behavior. PygmentsRenderer
no longer throws aClassNotFound
error if there is a code language specified which is not supported by the Pygments highlighter (#183). If you still need to get the error, simply passfail_on_unsupported_language=True
to the renderer's constructor.- Use strict PascalCase for class names (#182). The old names like
HTMLRenderer
are marked as deprecated.
For contributors:
- Unify
assertEqual()
calls in all the tests (#185). - Starting to use requirements.txt.
Scheme
renderer's__main__
section turned into a proper unit test (#189).- The possibility of a block token to interrupt a paragraph was generalized (#187). A token class just needs to define the
check_interrupts_paragraph(cls, lines) -> bool
method.
v1.1.0
Added
MarkdownRenderer
- the long awaited renderer for outputting parsed AST back to the Markdown syntax (#4, #162). 🎉
For this, parsing was extended to store additional information about the input markdown.- New options to control whether
HTMLRenderer
should escape double and/or single quotes (#176).
Fixed
Token.__repr__()
no longer outputs class attributes (#172).- Make
Scheme
(scheme.py
) work again (7883f58). - Make CI work again (#121). Good news for both the maintainers and the contributors.
Changed
- "Simpler is better!": Revert back to
HTMLRenderer
not escaping single quotes by default (#176).
Note that we plan to extend this to not escaping double quotes in the next version. - As a side effect of #162, the AST token classes and parsing process was changed for more uniform behavior and API
(#163). ASTRenderer
no longer outputs all token attributes, but only those listed inToken.repr_attributes
(#172).
Special thanks go to @anderskaplan as the most active contributor of this release. 💪
v1.0.1
v1.0.0
WARNING - Backwards compatibility changes:
- #167: For practical reasons and for following common packaging practices,
contrib
folder got moved under themistletoe
folder / package. So if you reference a renderer from that folder, you need to reference it asmistletoe.contrib.<renderer>
now. - See "change handling of (white)space characters in code spans" below. We keep processing extra whitespace characters at the parsing level, so that all renderers can benefit from it out-of-the-box. Provided that a custom renderer, for whatever reason, relied on all the spaces being collapsed, it needs to do that collapsing itself now (e.g.
' '.join(re.split('[ \n]+', content.strip()))
, orre.sub('[ \n]+', ' ', content.strip())
).
Added:
JIRARenderer
: Support link title notation, i.e.[label](url "title")
gets transformed to[label|url|title]
(#161)
Fixed:
- Make the
traverse()
function actually work with various input parameters: - Compatibility with the latest CommonMark specification v0.30 (#108):
- Change handling of (white)space characters in code spans (#156; in line with commonmark/commonmark-spec#532 and commonmark/commonmark-spec#569)
- Fix handling of tabs and parsing continuation lines within list items (#89 via #164)
- Fix the other examples, mostly edge cases, from the spec (see #165 and #168 for details; #173 seems to be fixed as well)
- Make parsing of link reference definitions (a.k.a.
Footnote
s) more strict - spec compliant (#132) - Fix handling of special punctuation characters when parsing emphasis (#96, #175)
Updated:
- Smaller inner working refactorings, like #171.
v0.9.0
WARNING - Backwards compatibility changes:
- Python versions below 3.5 are no longer supported (Python 3.6 end-of-life: December 2021)
html
module (available since Python 3.4) is no longer included
- As unescaping of HTML character references (entities) is now correctly done in parsing phase already, prospective custom renderers should be altered accordingly provided they do the unescaping themselves now.
HTMLRenderer
: single quote is no longer rendered as'
, but as'
(see #115; let us know if you would need the old behavior)BaseRenderer.__getattr__()
is removed and replaced by explicitrender_*()
methods definitions for clearer API (#133)
Added:
- Add
__repr__()
methods to all token classes (#140) - Add type hints for HTMLRenderer methods (#133; supported since Python 3.0)
Fixed:
- Correctly unescape HTML character references (entities) for
LaTeXRenderer
- refactored globally (#135) - Ensure LaTeX renderer uses valid \verb delimiter - not always just
|
(#149) - GithubWiki unit test failing when run via
pytest
(#142)
Others:
- Simplify implementation of escaping special HTML characters (#135)
- Remove unused imports and variables (#146)
- Document (for maintainers) how to create a new mistletoe release
- Fix and extend docstring documentation of various token types (#154)
- This version is about 0,5% faster according to the benchmark test. :)