Skip to content

Releases: miyuchina/mistletoe

v0.8.0

09 Oct 18:29
Compare
Choose a tag to compare

Added:

  • Support escaped pipes in table cells (#85)
  • traverse() function, to recursively yield children of a token (breadth-first traverse) (#94)
  • XWiki20Renderer - supports XWiki syntax 2.0 (#113)

Fixed:

  • JIRARenderer is basically ready for real life scenarios now
    • Fixed output of empty lines in lists and others (#100)
    • Don't HTML-escape special chars (#100)
    • Fixed output of table headers (#105)
    • Escape special Jira chars (#111)
    • Fixed output of empty cells (#109; see JRASERVER-70048)
  • Read and write to files / console in UTF-8, so that UnicodeDecodeError-s and UnicodeEncodeError-s are avoided (#100)
  • Various Markdown parsing problems (#86, #91)
  • Removed over-escaping of URLs in HTML and Jira renderers (#102)
  • TOCRenderer: The resulting toc property is properly generated (#88)
  • LaTeXRenderer: Escape underscores and percentages + don't escape in inline code (#93 / #112)

Testing:

  • Don't limit diffs from assertEquals, so that all differences are visible (#100)
  • Introduced filesBasedTest decorator for simple tests via conventionally named test files (#100)

v0.7.2

08 Jun 19:28
Compare
Choose a tag to compare

Fixed:

Testing:

  • Add Python 3.7 to integration testing (#63, thanks @nikolas)

v0.7.1

25 Jun 13:30
Compare
Choose a tag to compare

Fixed:

  • only matching the first instance of InlineCode (#50, thanks @huettenhain);
  • normalize newlines after every line (#51, thanks @elebow and @rsrdesarrollo);
  • trailing characters after reference definition.

Performance:

  • small speed boost to ParseToken.append_child.

Version 0.7

11 Jun 00:18
Compare
Choose a tag to compare

Warning: this is a release that breaks backwards compatibility in non-trivial ways (hopefully for the last time!) Read the full release notes if you are updating from a previous version.

Features:

  • all tests passing in CommonMark test suite (finally! 🎉)
  • allow specifying span token precedence levels;
  • new and shiny span_tokenizer.tokenize.

Fixed:

  • well, all the CommonMark test cases..
  • ASTRenderer crashes on tables with headers (#48, thanks @timfox456!)

Where I break backwards compatibility:

Previously span-level tokens need to have their children attribute manually specified. This is no longer the case, as the children attribute will automatically be set based on the class variable parse_group, which correspond to the regex match group in which child tokens might occur.

As an example, previously GithubWiki is implemented as this:

from mistletoe.span_token import SpanToken, tokenize_inner
import re

class GithubWiki(SpanToken):
    pattern = re.compile(r'...')
    def __init__(self, match_obj):
        super().__init__(match_obj) 
        # alternatively, self.children = tokenize_inner(match_obj.group(1))
        self.target = match_obj.group(2)

Now we can write:

from mistletoe.span_token import SpanToken
import re

class GithubWiki(SpanToken):
    pattern = re.compile(r'...')
    parse_inner = True  # default value, can be omitted
    parse_group = 1  # default value, can be omitted
    precedence = 5  # default value, can be omitted
    def __init__(self, match_obj):
        self.target = match_obj.group(2)

If we have a span token that does not need further parsing, we can write:

class Foo(SpanToken):
    pattern = re.compile(r'(foo)')
    parse_inner = False
    def __init__(self, match_obj):
        self.content = match_obj.group(1)

See the readme for more details.

v0.6.2

27 May 15:32
Compare
Choose a tag to compare

Features:

  • CommonMark compliant CodeFence;
  • CommonMark compliant BlockCode;
  • CommonMark compliant HTMLBlock;
  • CommonMark compliant HTMLSpan;
  • CommonMark compliant AutoLink;
  • CommonMark compliant InlineCode;
  • CommonMark compliant Heading;
  • CommonMark compliant SetextHeading;
  • added span-level token LineBreak;
  • better handling of lazy-continuation in Quote;
  • Footnotes can be defined in any block-level containers.

Fixes:

  • loose lists conform to CommonMark spec (#44, thanks @huettenhain);
  • not parsing sub-lists deeper than two levels (#46, thanks @daerhu);
  • FileWrapper._index should not go below -1.

Development:

  • refactored handling of SetextHeading;
  • removed block_tokenizer.MismatchException;
  • removed _children attribute, using children directly; (potentially breaking change?)
  • renamed Separator to ThematicBreak;
  • renamed FootnoteBlock to Footnote;
  • tokenize and tokenize_inner returns lists of tokens;
  • refactored CommonMark testing script.

v0.6.1

13 May 14:40
Compare
Choose a tag to compare

Features:

  • CommonMark compliant CodeFence (#41);
  • allow multiple backticks for InlineCode;
  • strips whitespace around InlineCode;

Fixed:

  • Separator needs at least three characters;
  • indented code blocks should not interrupt paragraphs (#40, thanks @joncass);
  • crashes when sublists have different marker type (#42, thanks @JBartlett86);
  • typo in Paragraph.read (#43, thanks @NatTupper);
  • preliminary fixes for handling loose lists (#44, thanks @huettenhain);
  • removed corrupted block_token.until function;
  • html code language tags starts with "language-".

Version 0.6 Poinsettia

02 May 02:09
Compare
Choose a tag to compare

Features:

  • added Pygments renderer to contrib (#35, thanks to @Bridouz);
  • HTMLSpan now supports comments (#37);
  • (more or less) Commonmark compliant List implementation (#40).

Fixes:

  • changed logo to an actual mistletoe (#21, thanks to @liuq);
  • allow lists after block tokens without newlines (#34, thanks to @huettenhain);
  • recognize headings within paragraphs (#36);
  • disallow opening space in html tag (#37).

Performance:

  • removed FileWrapper.normalize;
  • utilized universal newline mode.

Breaking changes:

  • BlockToken.start does not advance file iterator.

Special shout-out to @joncass for raising the unattributed issues above, and giving me the motivation to finally fix the list implementation!

Note that this is a release with major changes. If you notice any rough edges (as there will certainly be), please do not hesitate to open an issue.

v0.5.5

15 Apr 18:07
Compare
Choose a tag to compare

Features:

  • added default render methods for all tokens;
  • added reset_tokens function to block_token and span_token;
  • allowed BlockToken.read to return any iterable;
  • BaseRenderer is now available at mistletoe.BaseRenderer;
  • added Scheme.

Fixes:

  • throw better AttributeError when accessing RawText.children (#31, thanks @jabdoa2);
  • disallow whitespace in span_token.Link (#32, thanks @DMRobertson);
  • allowed empty alt text in Image and FootnoteImage (#33, thanks @joncass).

v0.5.4

27 Mar 17:20
Compare
Choose a tag to compare

Features:

  • md2jira: read from stdin if no input file is given (#27, thanks @alexkolson!);
  • better command line options and help messages;
  • auto-splitlines when mistletoe.markdown is given a string;
  • inline tokens can span multiple lines (#30, thanks @duckwork!).

Fixes:

  • TableRow now supports table shorthand (#29, thanks @huettenhain!);
  • normalize line breaks.

... plus various refactors and documentation improvements.

v0.5.3

05 Feb 20:38
Compare
Choose a tag to compare

Features:

  • shortened mistletoe.markdown keyword argument name (renderer_cls to renderer);
  • removed List reference lookup;
  • list items can contain paragraphs (CM5.2);
  • shorthand syntax added for tables (#26).

Fixed:

  • ignored invisible characters at line end for CodeFence (#24);
  • fixed extra newlines for headings in JIRARenderer (#25, thanks @huettenhain!);

Development:

  • moved documentation to docs directory;
  • solved the biggest mystery in the codebase.