Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-mistletoe for
openSUSE:Factory checked in at 2025-11-07 18:20:56
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-mistletoe (Old)
and /work/SRC/openSUSE:Factory/.python-mistletoe.new.1980 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-mistletoe"
Fri Nov 7 18:20:56 2025 rev:5 rq:1315972 version:1.5.0
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-mistletoe/python-mistletoe.changes
2025-08-29 18:36:22.197041581 +0200
+++
/work/SRC/openSUSE:Factory/.python-mistletoe.new.1980/python-mistletoe.changes
2025-11-07 18:21:36.453297825 +0100
@@ -1,0 +2,12 @@
+Wed Nov 5 14:02:21 UTC 2025 - John Paul Adrian Glaubitz
<[email protected]>
+
+- Update to 1.5.0
+ * LaTeXRenderer: Render thematic break on a new line (#224).
+ * LaTeXRenderer: Properly escape caret ("^") within raw text (#234).
+ * Incomplete configuration for tox and tests (#220, #221).
+ * Add types to __init__.py's markdown function (#251).
+ * Fix typos in the in-line documentation, while also resolving problems
+ within the docs folder (#226).
+ * Describe Document's constructor and how end-of-lines are treated (#64).
+
+-------------------------------------------------------------------
Old:
----
mistletoe-1.4.0.tar.gz
New:
----
mistletoe-1.5.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-mistletoe.spec ++++++
--- /var/tmp/diff_new_pack.WMbBnK/_old 2025-11-07 18:21:36.989320377 +0100
+++ /var/tmp/diff_new_pack.WMbBnK/_new 2025-11-07 18:21:36.989320377 +0100
@@ -23,7 +23,7 @@
%endif
%{?sle15_python_module_pythons}
Name: python-mistletoe
-Version: 1.4.0
+Version: 1.5.0
Release: 0
Summary: A Markdown parser in pure Python
License: MIT
++++++ mistletoe-1.4.0.tar.gz -> mistletoe-1.5.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/mistletoe-1.4.0/.github/workflows/python-package.yml
new/mistletoe-1.5.0/.github/workflows/python-package.yml
--- old/mistletoe-1.4.0/.github/workflows/python-package.yml 2024-07-14
12:06:44.000000000 +0200
+++ new/mistletoe-1.5.0/.github/workflows/python-package.yml 2025-10-18
18:23:41.000000000 +0200
@@ -17,7 +17,9 @@
# As long as we want to support Python 3.6-, we need to stick to an older
version of Ubuntu,
# see <https://github.com/actions/setup-python/issues/544>.
- runs-on: ubuntu-20.04
+ #
+ # Update: ubuntu-20.04 is no longer available, see
<https://github.com/actions/runner-images/issues/11101>.
+ runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
@@ -36,8 +38,8 @@
- name: Install dependencies
run: |
python -m pip install --upgrade pip
- python -m pip install flake8 pytest parameterized
- if [ -f requirements.txt ]; then python -m pip install -r
requirements.txt; fi
+ python -m pip install -r requirements.txt -r test-requirements.txt
+ python -m pip install flake8
- name: Lint with flake8
run: |
# See https://www.flake8rules.com for the list of the rules.
@@ -74,10 +76,9 @@
- name: Install dependencies
run: |
python -m pip install --upgrade pip
- python -m pip install pytest parameterized
+ python -m pip install -r requirements.txt -r test-requirements.txt
# note: the following also installs "coverage"
python -m pip install coveralls
- if [ -f requirements.txt ]; then python -m pip install -r
requirements.txt; fi
- name: Get coverage report
run: |
coverage run --source=${package_name} --append -m pytest
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/mistletoe-1.4.0/cutting-a-release.md
new/mistletoe-1.5.0/cutting-a-release.md
--- old/mistletoe-1.4.0/cutting-a-release.md 2024-07-14 12:06:44.000000000
+0200
+++ new/mistletoe-1.5.0/cutting-a-release.md 2025-10-18 18:23:41.000000000
+0200
@@ -12,7 +12,7 @@
* install / upgrade Twine: `$ python -m pip install --upgrade twine`
* if unsure, upload to test PyPi and/or test locally - see
[docs](https://packaging.python.org/en/latest/tutorials/packaging-projects/#uploading-the-distribution-archives)
* do the upload to PyPi: `$ python -m twine upload dist/*`
- * for the username, use `__token__`, for the password, use your
token from PyPi (see docs again how to do that)
+ * authenticate with your token from PyPi (for details, see docs
again)
* check that you can install locally what you uploaded: `$ python -m
pip install mistletoe`
* [create the release in
GitHub](https://github.com/miyuchina/mistletoe/releases/new)
* attach the "dist/*.whl" from the previous step to the release (drag &
drop) (source code archives are attached automatically)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/mistletoe-1.4.0/docs/.gitignore
new/mistletoe-1.5.0/docs/.gitignore
--- old/mistletoe-1.4.0/docs/.gitignore 1970-01-01 01:00:00.000000000 +0100
+++ new/mistletoe-1.5.0/docs/.gitignore 2025-10-18 18:23:41.000000000 +0200
@@ -0,0 +1 @@
+*.html
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/mistletoe-1.4.0/docs/README.md
new/mistletoe-1.5.0/docs/README.md
--- old/mistletoe-1.4.0/docs/README.md 2024-07-14 12:06:44.000000000 +0200
+++ new/mistletoe-1.5.0/docs/README.md 2025-10-18 18:23:41.000000000 +0200
@@ -1,3 +1,7 @@
-DEPRECATED: This folder used to be the source for project pages. It is not
used anymore though.
+Generated documentation
+=======================
-This folder's content is updated by running `make docs`.
+This folder is the target for HTML pages generated from the *.md files.
+You can generate it by running `make docs` in the project's root folder.
+
+Note: This folder used to be the source for project pages.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/mistletoe-1.4.0/docs/__init__.py
new/mistletoe-1.5.0/docs/__init__.py
--- old/mistletoe-1.4.0/docs/__init__.py 2024-07-14 12:06:44.000000000
+0200
+++ new/mistletoe-1.5.0/docs/__init__.py 2025-10-18 18:23:41.000000000
+0200
@@ -1,7 +1,12 @@
from mistletoe import Document, HtmlRenderer, __version__
-INCLUDE = {'README.md': 'index.html',
- 'CONTRIBUTING.md': 'contributing.html'}
+INCLUDE = {
+ "README.md": "index.html",
+ "CONTRIBUTING.md": "contributing.html",
+ "cutting-a-release.md": "cutting-a-release.html",
+ "dev-guide.md": "dev-guide.html",
+ "performance.md": "performance.html",
+}
METADATA = """
<head>
@@ -31,7 +36,8 @@
if v == filename:
self.footnotes[k] = new_link
subtitle = ' | {}'.format('version ' + __version__ if name ==
'README.md' else name.split('.')[0].lower())
- return pattern.format(METADATA.format(subtitle),
self.render_inner(token))
+ body = '\n'.join([self.render(child) for child in token.children])
+ return pattern.format(METADATA.format(subtitle), body)
def _replace_link(self, token):
token.target = getattr(self, 'files', {}).get(token.target,
token.target)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/mistletoe-1.4.0/docs/contributing.html
new/mistletoe-1.5.0/docs/contributing.html
--- old/mistletoe-1.4.0/docs/contributing.html 2024-07-14 12:06:44.000000000
+0200
+++ new/mistletoe-1.5.0/docs/contributing.html 1970-01-01 01:00:00.000000000
+0100
@@ -1,107 +0,0 @@
-<html>
-<head>
- <title>mistletoe | contributing</title>
- <meta charset="UTF-8" />
- <meta name="description" content="A fast, extensible Markdown parser in
Python." />
- <meta name="keywords" content="Markdown,Python,LaTeX,HTML" />
- <meta name="author" content="Mi Yu" />
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
- <link rel="stylesheet" href="style.css" type="text/css" />
- <link rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/github.min.css">
- <script
src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
- <script>hljs.initHighlightingOnLoad();</script>
-</head>
-<body><h1>Contributing<img
src='https://cdn.rawgit.com/miyuchina/mistletoe/master/resources/logo.svg'
align='right'></h1>
-<p>You've seen mistletoe: it branches off in all directions, bringing
people
-together. We would love to see what you can make of mistletoe, which direction
-you would take it to. Or maybe you can discover some <a
href="http://harrypotter.wikia.com/wiki/Nargle">Nargles</a>, which,
-by the way, totally exists.
-</p>
-<p>The following instructions serve as guidelines, and you should use your best
-judgements when employing them.
-</p>
-<h2>Getting started</h2>
-<p>Refer to the <a href="index.html">README</a> for install instructions.
Since you're going to
-mess with the code, it's prefered that you clone the repo directly.
-</p>
-<p>Check back on the dev branch regularly to avoid redoing work that others
might
-have done. The master branch is updated only when features on the dev branch
-are stabilized somewhat.
-</p>
-<h2>Things you can do</h2>
-<h3>Introducing new features</h3>
-<p>It is suggested that you <strong>open an issue first</strong> before
working on new
-features. Include your reasons, use case, and maybe plans for implementation.
-That way, we have a better idea of what you'll be working on, and can
hopefully
-avoid collision. Your pull request may also get merged much faster.
-</p>
-<h3>Fixing bugs</h3>
-<p>Before you post an issue, try narrowing the problem down to the smallest
-component possible. For example, if an <code>InlineCode</code> token is not
parsed
-correctly, include only the paragraph that introduce the error, not the
-entire document.
-</p>
-<p>You might find mistletoe's interactive mode handy when tracking down
bugs.
-Type in your input, and you immediately see how mistletoe handles it.
-I created it just for this purpose. To use it, run <code>mistletoe</code> (or
-<code>python3 mistletoe</code>) in your shell without arguments.
-</p>
-<p>Markdown is a very finicky document format to parse, so if something does
not
-work as intended, it's probably my fault and not yours.
-</p>
-<h3>Writing documentations</h3>
-<p>The creator might not the best person to write documentations; the users,
-knowing all the painpoints, have a better idea of actual use cases and possible
-things that can go wrong.
-</p>
-<p>Go to the mistletoe <a
href="https://github.com/miyuchina/mistletoe/wiki">wiki</a> and write up your
own topic. Alternatively,
-write docstrings or comments for functions that are missing them. mistletoe
-generally follows the <a
href="https://google.github.io/styleguide/pyguide.html">Google Python Style
Guide</a> to format
-comments.
-</p>
-<h2>Writing code</h2>
-<h3>Commit messages</h3>
-<ul>
-<li><p>minimal cosmetic changes are fine to mix in with your commits, but try
feel
- guilty when you do that, and if it's not too big of a hassle, break them
- into two commits.
-</p>
-</li>
-<li><p>give clear, instructive commit messages. Try using phrases like
"added XXX
- feature" or "fixed XXX (#42)".
-</p>
-</li>
-<li><p>if you find yourself cramming too many things into one commit message,
you
- should probably break them into multiple commits.
-</p>
-</li>
-<li>emojis are awesome. Use them like this:</li>
-</ul>
-<p> | Emoji | Description |
- | :---: | :------------------------------ |
- | 📚 | Update documentation. |
- | 🐎 | Performance improvements. |
- | 💡 | New features. |
- | 🐛 | Bug fixes. |
- | 🚨 | Under construction. |
- | ☕️ | Refactoring / cosmetic changes. |
- | 🌎 | Internationalization. |
-</p>
-<h3>Style guide</h3>
-<p>Here's the obligatory <a
href="https://www.python.org/dev/peps/pep-0008/">PEP8</a> link, but here's
a much shorter list of
-things to be aware of:
-</p>
-<ul>
-<li>mistletoe uses <code>CamelCase</code> for classnames,
<code>snake_case</code> for functions and methods;</li>
-<li>mistletoe uses <em>one</em> blank line between classes and functions, even
global ones, despite PEP8's suggestion to the contrary.</li>
-<li>mistletoe follows the eighty-character rule: if you find your line to be
too lengthy, try giving variable names to expressions, and break it up that
way. That said, it's okay to go over the charater limit occasionally.</li>
-<li>mistletoe uses four spaces instead of a tab to indent. For vim users,
include <code>set ts=4 sw=4 ai et</code> in your <code>.vimrc</code>.</li>
-</ul>
-<p>Apart from that, stay consistent with the coding style around you. But
don't
-get boggled down by this: if you have a genius idea, I'd love to clean up
-for you; write down your genius idea first.
-</p>
-<h2>Get in touch</h2>
-<p>I tweet <a href="https://twitter.com/mi_before_yu">@mi_before_yu</a>. Also
yell at me over <a href="mailto:miyu.china%40icloud.com">email</a>.
-</p>
-</body></html>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/mistletoe-1.4.0/docs/index.html
new/mistletoe-1.5.0/docs/index.html
--- old/mistletoe-1.4.0/docs/index.html 2024-07-14 12:06:44.000000000 +0200
+++ new/mistletoe-1.5.0/docs/index.html 1970-01-01 01:00:00.000000000 +0100
@@ -1,293 +0,0 @@
-<html>
-<head>
- <title>mistletoe | version 0.5.2</title>
- <meta charset="UTF-8" />
- <meta name="description" content="A fast, extensible Markdown parser in
Python." />
- <meta name="keywords" content="Markdown,Python,LaTeX,HTML" />
- <meta name="author" content="Mi Yu" />
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
- <link rel="stylesheet" href="style.css" type="text/css" />
- <link rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/github.min.css">
- <script
src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
- <script>hljs.initHighlightingOnLoad();</script>
-</head>
-<body><h1>mistletoe<img
src='https://cdn.rawgit.com/miyuchina/mistletoe/master/resources/logo.svg'
align='right'></h1>
-<p><a href="https://travis-ci.org/miyuchina/mistletoe"><img
src="https://img.shields.io/travis/miyuchina/mistletoe.svg?style=flat-square"
title="" alt="Build Status"></a>
-<a
href="https://coveralls.io/github/miyuchina/mistletoe%3Fbranch%3Dmaster"><img
src="https://img.shields.io/coveralls/miyuchina/mistletoe.svg?style=flat-square"
title="" alt="Coverage Status"></a>
-<a href="https://pypi.python.org/pypi/mistletoe"><img
src="https://img.shields.io/pypi/v/mistletoe.svg?style=flat-square" title=""
alt="PyPI"></a>
-<a href="https://pypi.python.org/pypi/mistletoe"><img
src="https://img.shields.io/pypi/wheel/mistletoe.svg?style=flat-square"
title="" alt="is wheel"></a>
-</p>
-<p>mistletoe is a Markdown parser in pure Python, designed to be fast, modular
-and fully customizable.
-</p>
-<p>mistletoe is not simply a Markdown-to-HTML transpiler. It is designed, from
-the start, to parse Markdown into an abstract syntax tree. You can swap out
-renderers for different output formats, without touching any of the core
-components.
-</p>
-<p>Remember to spell mistletoe in lowercase!
-</p>
-<h2>Features
-</h2>
-<ul>
-<li><p><strong>Fast</strong>: mistletoe is as fast as the <a
href="https://github.com/lepture/mistune">fastest implementation</a>
- currently available: that is, over 4 times faster than
- <a href="https://github.com/waylan/Python-Markdown">Python-Markdown</a>, and
much faster than
- <a href="https://github.com/trentm/python-markdown2">Python-Markdown2</a>.
-
- See the <a href="#performance">performance</a> section for details.
-</p>
-</li>
-<li><p><strong>Modular</strong>: mistletoe is designed with modularity in
mind. Its initial
- goal is to provide a clear and easy API to extend upon.
-</p>
-</li>
-<li><strong>Customizable</strong>: as of now, mistletoe can render Markdown
documents to LaTeX, HTML and an abstract syntax tree out of the box. Writing a
new renderer for mistletoe is a relatively trivial task.</li>
-</ul>
-<h2>Installation
-</h2>
-<p>mistletoe requires Python 3.3 and above, including Python 3.7, the current
-development branch. It is also tested on PyPy 5.8.0. Install mistletoe with
-pip:
-</p>
-<pre><code class="lang-sh">pip3 install mistletoe
-</code></pre>
-<p>Alternatively, clone the repo:
-</p>
-<pre><code class="lang-sh">git clone https://github.com/miyuchina/mistletoe.git
-cd mistletoe
-pip3 install -e .
-</code></pre>
-<p>See the <a href="contributing.html">contributing</a> doc for how to
contribute to mistletoe.
-</p>
-<h2>Usage
-</h2>
-<h3>Basic usage</h3>
-<p>Here's how you can use mistletoe in a Python script:
-</p>
-<pre><code class="lang-python">import mistletoe
-
-with open('foo.md', 'r') as fin:
- rendered = mistletoe.markdown(fin)
-</code></pre>
-<p><code>mistletoe.markdown()</code> uses mistletoe's default settings:
allowing HTML mixins
-and rendering to HTML. The function also accepts an additional argument
-<code>renderer</code>. To produce LaTeX output:
-</p>
-<pre><code class="lang-python">import mistletoe
-from mistletoe.latex_renderer import LaTeXRenderer
-
-with open('foo.md', 'r') as fin:
- rendered = mistletoe.markdown(fin, LaTeXRenderer)
-</code></pre>
-<p>Finally, here's how you would manually specify extra tokens and a
renderer
-for mistletoe. In the following example, we use <code>HtmlRenderer</code> to
render
-the AST, which adds <code>HtmlBlock</code> and <code>HtmlSpan</code> to the
normal parsing
-process.
-</p>
-<pre><code class="lang-python">from mistletoe import Document, HtmlRenderer
-
-with open('foo.md', 'r') as fin:
- with HtmlRenderer() as renderer:
- rendered = renderer.render(Document(fin))
-</code></pre>
-<h3>From the command-line</h3>
-<p>pip installation enables mistletoe's commandline utility. Type the
following
-directly into your shell:
-</p>
-<pre><code class="lang-sh">mistletoe foo.md
-</code></pre>
-<p>This will transpile <code>foo.md</code> into HTML, and dump the output to
stdout. To save
-the HTML, direct the output into a file:
-</p>
-<pre><code class="lang-sh">mistletoe foo.md > out.html
-</code></pre>
-<p>You can pass in custom renderers by including the full path to your renderer
-class after a <code>-r</code> or <code>--renderer</code> flag:
-</p>
-<pre><code class="lang-sh">mistletoe foo.md --renderer
custom_renderer.CustomRenderer
-</code></pre>
-<p>Running <code>mistletoe</code> without specifying a file will land you in
interactive
-mode. Like Python's REPL, interactive mode allows you to test how your
-Markdown will be interpreted by mistletoe:
-</p>
-<pre><code>mistletoe [version 0.5.2] (interactive)
-Type Ctrl-D to complete input, or Ctrl-C to exit.
->>> some **bold text**
-... and some *italics*
-... ^D
-<html>
-<body>
-<p>some <strong>bold text</strong> and some
<em>italics</em></p>
-</body>
-</html>
->>>
-</code></pre>
-<p>The interactive mode also accepts the <code>--renderer</code> flag.
-</p>
-<h2>Performance
-</h2>
-<p>mistletoe is the fastest Markdown parser implementation available in pure
-Python; that is, on par with <a
href="https://github.com/lepture/mistune">mistune</a>. Try the benchmarks
yourself by
-running:
-</p>
-<pre><code class="lang-sh">python3 test/benchmark.py
-</code></pre>
-<p>One of the significant bottlenecks of mistletoe compared to mistune,
however,
-is the function overhead. Because, unlike mistune, mistletoe chooses to split
-functionality into modules, function lookups can take significantly longer than
-mistune.
-</p>
-<p>To boost the performance further, it is suggested to use PyPy with
mistletoe.
-Benchmark results show that on PyPy, mistletoe is about <strong>twice as
fast</strong> as
-mistune:
-</p>
-<pre><code class="lang-sh">$ pypy3 test/benchmark.py mistune mistletoe
-Test document: test/samples/syntax.md
-Test iterations: 1000
-Running tests with mistune, mistletoe...
-========================================
-mistune: 13.524028996936977
-mistletoe: 6.477352762129158
-</code></pre>
-<p>The above result was achieved on PyPy 5.8.0-beta0, on a 13-inch Retina
MacBook
-Pro (Early 2015).
-</p>
-<h2>Developer's Guide
-</h2>
-<p>Here's an example to add GitHub-style wiki links to the parsing
process,
-and provide a renderer for this new token.
-</p>
-<h3>A new token</h3>
-<p>GitHub wiki links are span-level tokens, meaning that they reside inline,
-and don't really look like chunky paragraphs. To write a new span-level
-token, all we need to do is make a subclass of <code>SpanToken</code>:
-</p>
-<pre><code class="lang-python">from mistletoe.span_token import SpanToken
-
-class GithubWiki(SpanToken):
- pass
-</code></pre>
-<p>mistletoe uses regular expressions to search for span-level tokens in the
-parsing process. As a refresher, GitHub wiki looks something like this:
-<code>[[alternative text | target]]</code>. We define a class variable,
<code>pattern</code>,
-that stores the compiled regex:
-</p>
-<pre><code class="lang-python">class GithubWiki(SpanToken):
- pattern = re.compile(r"\[\[ *(.+?) *\| *(.+?) *\]\]")
- def __init__(self, match_obj):
- pass
-</code></pre>
-<p>For spiritual guidance on regexes, refer to <a
href="https://xkcd.com/208/">xkcd</a> classics. For an
-actual representation of this author parsing Markdown with regexes, refer
-to this brilliant <a
href="http://www.greghendershott.com/img/grumpy-regexp-parser.png">meme</a> by
<a
href="http://www.greghendershott.com/2013/11/markdown-parser-redesign.html">Greg
Hendershott</a>.
-</p>
-<p>mistletoe's span-level tokenizer will search for our pattern. When it
finds
-a match, it will pass in the match object as argument into our constructor.
-We have defined our regex so that the first match group is the alternative
-text, and the second one is the link target.
-</p>
-<p>Note that alternative text can also contain other span-level tokens. For
-example, <code>[[*alt*|link]]</code> is a GitHub link with an
<code>Emphasis</code> token as its
-child. To parse child tokens, simply pass <code>match_obj</code> to the
<code>super</code>
-constructor (which assumes children to be in <code>match_obj.group(1)</code>),
-and save off all the additional attributes we need:
-</p>
-<pre><code class="lang-python">from mistletoe.span_token import SpanToken
-
-class GithubWiki(SpanToken):
- pattern = re.compile(r"\[\[ *(.+?) *\| *(.+?) *\]\]")
- def __init__(self, match_obj):
- super().__init__(match_obj)
- self.target = match_obj.group(2)
-</code></pre>
-<p>There you go: a new token in 7 lines of code.
-</p>
-<h3>A new renderer</h3>
-<p>Adding a custom token to the parsing process usually involves a lot
-of nasty implementation details. Fortunately, mistletoe takes care
-of most of them for you. Simply pass your custom token class to
-<code>super().__init__()</code> does the trick:
-</p>
-<pre><code class="lang-python">from mistletoe.html_renderer import HtmlRenderer
-
-class GithubWikiRenderer(HtmlRenderer):
- def __init__(self):
- super().__init__(GithubWiki)
-</code></pre>
-<p>We then only need to tell mistletoe how to render our new token:
-</p>
-<pre><code class="lang-python">def render_github_wiki(self, token):
- template = '<a href="{target}">{inner}</a>'
- target = token.target
- inner = self.render_inner(token)
- return template.format(target=target, inner=inner)
-</code></pre>
-<p>Cleaning up, we have our new renderer class:
-</p>
-<pre><code class="lang-python">from mistletoe.html_renderer import
HtmlRenderer, escape_url
-
-class GithubWikiRenderer(HtmlRenderer):
- def __init__(self):
- super().__init__(GithubWiki)
-
- def render_github_wiki(self, token):
- template = '<a
href="{target}">{inner}</a>'
- target = escape_url(token.target)
- inner = self.render_inner(token)
- return template.format(target=target, inner=inner)
-</code></pre>
-<h3>Take it for a spin?</h3>
-<p>It is preferred that all mistletoe's renderers be used as context
managers.
-This is to ensure that your custom tokens are cleaned up properly, so that
-you can parse other Markdown documents with different token types in the
-same program.
-</p>
-<pre><code class="lang-python">from mistletoe import Document
-from contrib.github_wiki import GithubWikiRenderer
-
-with open('foo.md', 'r') as fin:
- with GithubWikiRenderer() as renderer:
- rendered = renderer.render(Document(fin))
-</code></pre>
-<p>For more info, take a look at the <code>base_renderer</code> module in
mistletoe.
-The docstrings might give you a more granular idea of customizing mistletoe
-to your needs.
-</p>
-<h2>Why mistletoe?
-</h2>
-<p>For me, the question becomes: why not <a
href="https://github.com/lepture/mistune">mistune</a>? My original
-motivation really has nothing to do with starting a competition. Here's a
list
-of reasons I created mistletoe in the first place:
-</p>
-<ul>
-<li>I am interested in a Markdown-to-LaTeX transpiler in Python.</li>
-<li>I want to write more Python.</li>
-<li>"How hard could it be?"</li>
-<li>"For fun," says David Beazley.</li>
-</ul>
-<p>Here's two things mistune inspired mistletoe to do:
-</p>
-<ul>
-<li>Markdown parsers should be fast, and other parser implementations in
Python leaves much to be desired.</li>
-<li>A parser implementation for Markdown does not need to restrict itself to
one flavor of Markdown.</li>
-</ul>
-<p>Here's two things mistletoe does differently from mistune:
-</p>
-<ul>
-<li>Per its <a href="https://github.com/lepture/mistune">readme</a>, mistune
will always be a single-file script. mistletoe breaks its functionality into
modules.</li>
-<li>mistune, as of now, can only render Markdown into HTML. It is relatively
trivial to write a new renderer for mistletoe.</li>
-<li>Unlike mistune, mistletoe is pushing for some extent of spec compliance
with CommonMark.</li>
-</ul>
-<p>The implications of these are quite profound, and there's no definite
-this-is-better-than-that answer. Mistune is near perfect if one wants what
-it provides: I have used mistune extensively in the past, and had a great
-experience. If you want more control, however, give mistletoe a try.
-</p>
-<h2>Copyright & License
-</h2>
-<ul>
-<li>mistletoe's logo uses artwork by Daniele De Santis, under <a
href="https://creativecommons.org/licenses/by/3.0/us/">CC BY 3.0</a>.</li>
-<li>mistletoe is released under <a href="LICENSE">MIT</a>.</li>
-</ul>
-</body></html>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/mistletoe-1.4.0/mistletoe/__init__.py
new/mistletoe-1.5.0/mistletoe/__init__.py
--- old/mistletoe-1.4.0/mistletoe/__init__.py 2024-07-14 12:06:44.000000000
+0200
+++ new/mistletoe-1.5.0/mistletoe/__init__.py 2025-10-18 18:23:41.000000000
+0200
@@ -2,17 +2,20 @@
Make mistletoe easier to import.
"""
-__version__ = "1.4.0"
+__version__ = "1.5.0"
__all__ = ['html_renderer', 'ast_renderer', 'block_token', 'block_tokenizer',
'span_token', 'span_tokenizer']
+from typing import Callable, Iterable, Union
+
+from mistletoe.base_renderer import BaseRenderer
from mistletoe.block_token import Document
from mistletoe.html_renderer import HtmlRenderer
# import the old name for backwards compatibility:
from mistletoe.html_renderer import HTMLRenderer # noqa: F401
-def markdown(iterable, renderer=HtmlRenderer):
+def markdown(iterable: Union[str, Iterable[str]], renderer: Callable[...,
BaseRenderer] = HtmlRenderer):
"""
Converts markdown input to the output supported by the given renderer.
If no renderer is supplied, ``HtmlRenderer`` is used.
@@ -20,5 +23,5 @@
Note that extra token types supported by the given renderer
are automatically (and temporarily) added to the parsing process.
"""
- with renderer() as renderer:
- return renderer.render(Document(iterable))
+ with renderer() as r:
+ return r.render(Document(iterable))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/mistletoe-1.4.0/mistletoe/block_token.py
new/mistletoe-1.5.0/mistletoe/block_token.py
--- old/mistletoe-1.4.0/mistletoe/block_token.py 2024-07-14
12:06:44.000000000 +0200
+++ new/mistletoe-1.5.0/mistletoe/block_token.py 2025-10-18
18:23:41.000000000 +0200
@@ -4,6 +4,7 @@
import re
from itertools import zip_longest
+from typing import Iterable, Union
import mistletoe.block_tokenizer as tokenizer
from mistletoe import token, span_token
from mistletoe.core_tokens import (
@@ -136,7 +137,19 @@
footnotes (dictionary): link reference definitions.
"""
- def __init__(self, lines):
+ def __init__(self, lines: Union[str, Iterable[str]]):
+ """
+ Instantiates this token and its content by parsing the input lines.
+
+ Args:
+ lines: input markdown to be tokenized. If a string is provided,
+ it will be split into lines.
+
+ CAUTION: If the input lines end with Windows line endings
(``\\r\\n``),
+ the parsing process will not work correctly. For performance
reasons,
+ clients need to normalize such line endings themselves, before
passing
+ them to this function, e.g. by calling ``lines.replace('\\r',
'')``.
+ """
if isinstance(lines, str):
lines = lines.splitlines(keepends=True)
lines = [line if line.endswith('\n') else '{}\n'.format(line) for line
in lines]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/mistletoe-1.4.0/mistletoe/latex_renderer.py
new/mistletoe-1.5.0/mistletoe/latex_renderer.py
--- old/mistletoe-1.4.0/mistletoe/latex_renderer.py 2024-07-14
12:06:44.000000000 +0200
+++ new/mistletoe-1.5.0/mistletoe/latex_renderer.py 2025-10-18
18:23:41.000000000 +0200
@@ -81,7 +81,7 @@
return (token.content.replace('$', '\\$').replace('#', '\\#')
.replace('{', '\\{').replace('}', '\\}')
.replace('&', '\\&').replace('_', '\\_')
- .replace('%', '\\%')
+ .replace('%', '\\%').replace('^', '\\^{}')
) if escape else token.content
def render_heading(self, token):
@@ -158,7 +158,7 @@
@staticmethod
def render_thematic_break(token):
- return '\\hrulefill\n'
+ return '\n\\hrulefill\n'
@staticmethod
def render_line_break(token):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/mistletoe-1.4.0/mistletoe/span_tokenizer.py
new/mistletoe-1.5.0/mistletoe/span_tokenizer.py
--- old/mistletoe-1.4.0/mistletoe/span_tokenizer.py 2024-07-14
12:06:44.000000000 +0200
+++ new/mistletoe-1.5.0/mistletoe/span_tokenizer.py 2025-10-18
18:23:41.000000000 +0200
@@ -64,7 +64,7 @@
def relation(x, y):
if x.end <= y.start:
- return 0 # x preceeds y
+ return 0 # x precedes y
if x.end >= y.end:
if x.parse_start <= y.start and x.parse_end >= y.end:
return 2 # x contains y
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/mistletoe-1.4.0/setup.py new/mistletoe-1.5.0/setup.py
--- old/mistletoe-1.4.0/setup.py 2024-07-14 12:06:44.000000000 +0200
+++ new/mistletoe-1.5.0/setup.py 2025-10-18 18:23:41.000000000 +0200
@@ -1,15 +1,21 @@
from setuptools import setup
import mistletoe
+with open('README.md', 'r', encoding='utf-8') as f:
+ long_description = f.read()
+
setup(
name='mistletoe',
version=mistletoe.__version__,
description='A fast, extensible Markdown parser in pure Python.',
+ long_description=long_description,
+ long_description_content_type='text/markdown',
url='https://github.com/miyuchina/mistletoe',
author='Mi Yu',
author_email='[email protected]',
license='MIT',
packages=['mistletoe', 'mistletoe.contrib'],
+ package_data={'mistletoe': ['py.typed']},
entry_points={'console_scripts': ['mistletoe = mistletoe.__main__:main']},
classifiers=[
'Development Status :: 5 - Production/Stable',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/mistletoe-1.4.0/test/samples/syntax.md
new/mistletoe-1.5.0/test/samples/syntax.md
--- old/mistletoe-1.4.0/test/samples/syntax.md 2024-07-14 12:06:44.000000000
+0200
+++ new/mistletoe-1.5.0/test/samples/syntax.md 2025-10-18 18:23:41.000000000
+0200
@@ -298,7 +298,7 @@
Markdown supports ordered (numbered) and unordered (bulleted) lists.
-Unordered lists use asterisks, pluses, and hyphens -- interchangably
+Unordered lists use asterisks, pluses, and hyphens -- interchangeably
-- as list markers:
* Red
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/mistletoe-1.4.0/test/test_latex_renderer.py
new/mistletoe-1.5.0/test/test_latex_renderer.py
--- old/mistletoe-1.4.0/test/test_latex_renderer.py 2024-07-14
12:06:44.000000000 +0200
+++ new/mistletoe-1.5.0/test/test_latex_renderer.py 2025-10-18
18:23:41.000000000 +0200
@@ -120,7 +120,7 @@
self._test_token('TableCell', 'inner')
def test_thematic_break(self):
- self._test_token('ThematicBreak', '\\hrulefill\n')
+ self._test_token('ThematicBreak', '\n\\hrulefill\n')
def test_line_break(self):
self._test_token('LineBreak', '\\newline\n', soft=False)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/mistletoe-1.4.0/test-requirements.txt
new/mistletoe-1.5.0/test-requirements.txt
--- old/mistletoe-1.4.0/test-requirements.txt 1970-01-01 01:00:00.000000000
+0100
+++ new/mistletoe-1.5.0/test-requirements.txt 2025-10-18 18:23:41.000000000
+0200
@@ -0,0 +1,3 @@
+# in alphabetical order:
+parameterized
+pytest
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/mistletoe-1.4.0/tox.ini new/mistletoe-1.5.0/tox.ini
--- old/mistletoe-1.4.0/tox.ini 2024-07-14 12:06:44.000000000 +0200
+++ new/mistletoe-1.5.0/tox.ini 2025-10-18 18:23:41.000000000 +0200
@@ -6,3 +6,11 @@
max-line-length = 127
max-complexity = 10
+
+[testenv]
+# Configuration for tox - see https://tox.wiki/en/latest/config.html.
+deps =
+ -r requirements.txt
+ -r test-requirements.txt
+commands =
+ python -m pytest {posargs}