Skip to content

Releases: miyuchina/mistletoe

v1.4.0

14 Jul 10:23
Compare
Choose a tag to compare

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 []

Fixed

  • Incomplete sdist content (#219).

Changed

  • MarkdownRenderer: Keep the original content spacing before the list marker (#213 via #215).
  • Bump build/CI scripts.

v1.3.0

21 Jan 16:18
Compare
Choose a tag to compare

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 pass process_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 called indentation (number of spaces before the item marker):
      -def __init__(self, parse_buffer, prepend, leader):
      +def __init__(self, parse_buffer, indentation, prepend, leader):
  • Allow just 1 dash in Table delimiter cells (#131 via #203).

For contributors:

  • Improvements in the Python styling checks, setup and documentation - see diff.

v1.2.1

24 Aug 16:14
Compare
Choose a tag to compare

Fixed

  • In v1.2.0, due to #182, using HTMLRenderer (the old class name) directly from the mistletoe package stopped working.

v1.2.0

21 Aug 07:11
Compare
Choose a tag to compare

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 to false if you need the old behavior.
  • PygmentsRenderer no longer throws a ClassNotFound 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 pass fail_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

11 Jun 15:02
Compare
Choose a tag to compare

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 in Token.repr_attributes (#172).

Special thanks go to @anderskaplan as the most active contributor of this release. 💪

v1.0.1

20 Jan 21:16
Compare
Choose a tag to compare

Fixed:

  • Do include package "mistletoe.contrib" in the built artifacts (#177).

Updated:

  • Make CONTRIBUTING.md more up-to-date.

v1.0.0

14 Jan 20:25
Compare
Choose a tag to compare

WARNING - Backwards compatibility changes:

  • #167: For practical reasons and for following common packaging practices, contrib folder got moved under the mistletoe folder / package. So if you reference a renderer from that folder, you need to reference it as mistletoe.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())), or re.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):
  • Make parsing of link reference definitions (a.k.a. Footnotes) 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

18 Aug 18:46
Compare
Choose a tag to compare

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 &#x27; (see #115; let us know if you would need the old behavior)
  • BaseRenderer.__getattr__() is removed and replaced by explicit render_*() 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. :)

v0.8.2

09 Feb 20:54
5916ebd
Compare
Choose a tag to compare

Fixed:

  • Support emphasized inline code (#70)
  • Failure to parse paragraph containing just "[" (#130) (a side-effect of the fix of #124 in v0.8.1)
  • IndexError when parsing unfinished-link-like text (#98)

Others:

  • Small documentation improvements.

v0.8.1

18 Dec 19:38
Compare
Choose a tag to compare

Added:

  • Documentation (#122 - covering #56, #99 and some other basic topics)

Fixed:

  • Avoid infinite loop when parsing specific Footnotes (#124)
  • Read and write to files / console in UTF-8 (in all remaining locations)

Testing:

  • Benchmark tests made up-to-date (#119)