| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
| |
Fixes #1040 and fixes #1045.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
By calling str on all stash elements we ensure they don't raise an error.
Worse case, soemthing like `<Element 'div' at 0x000001B2DAE94900>` gets
inserted into the output. However, with the override in the md_in_html
extension, we actually serialize and reinsert the original HTML. Worse case,
an HTML block which should be parsed as Markdown gets skipped by the
extension (`<div markdown="block"></div>` gets inserting into the output).
The tricky part is testing as there should be no known cases where this
ever occurs. Therefore, we forefully pass an etree Element directly to
the method in the test. That said, as #1040 is unresolved at this point,
I have tested locally with a real existing case and it works well.
Related to #1040.
|
|
|
|
|
|
|
| |
* Ensure unclosed script tags are parsed correctly by providing a workaround for https://bugs.python.org/issue41989.
* Avoid cdata_mode outside of HTML blocks, such as in inline code spans.
Fixes #1036.
|
|
|
|
|
|
|
|
| |
If pygments is installed and the version doesn't match the expected version.
then any relevant tests will fail. To avoid failing tests due to different
output by pygments, those tests will be skipped. The pygments tox env
sets the `PYGMENTS_VERSION environment variable, so that env will always
run those tests against the expected version.
|
|
|
|
|
|
|
|
|
|
| |
* Pygments specific tests now only run when the pygments version installed
matches the expected version. That version is defined in an environment
variable (PYGMENTS_VERSION) in the 'pygments' tox env (see #1030).
* When the Python lib tidylib is installed but the underlying c lib is not,
the relevant tests are now skipped rather than fail. This matches the
behavior when the Python lib is not installed. The tox envs are now useful
on systems which don't have the c lib installed.
|
|
|
|
|
|
|
| |
* All non-language classes should always be assigned to the pre tag.
* The language identifying class should never be included with the
general list of classes.
Fixes #1032
|
|
|
|
| |
Closes #1030
|
|
|
| |
A second function, `slugify_unicode` was added rather than changing the existing function so as to maintain backward compatibility. While an `encoding` parameter was added to the `slugify` function, we can't expect existing third party functions to accept a third parameter. Therefore, the two parameter API was preserved with this change.
|
|
|
|
|
|
|
|
|
|
| |
The HTML parser has been completely replaced. The new HTML parser is built on Python's html.parser.HTMLParser, which alleviates various bugs and simplifies maintenance of the code.
The md_in_html extension has been rebuilt on the new HTML Parser, which drastically simplifies it. Note that raw HTML elements with a markdown attribute defined are now converted to ElementTree Elements and are rendered by the serializer. Various bugs have been fixed.
Link reference parsing, abbreviation reference parsing and footnote reference parsing has all been moved from preprocessors to blockprocessors, which allows them to be nested within other block level elements. Specifically, this change was necessary to maintain the current behavior in the rebuilt md_in_html extension. A few random edge-case bugs (see the included tests) were resolved in the process.
Closes #595, closes #780, closes #830 and closes #1012.
|
|
|
| |
Fixes #918.
|
|
|
|
|
| |
Add better logic to admonitions to account for more complex list cases
Fixes #1004
|
|
|
|
| |
Fixes #897.
|
|
|
|
| |
Fixes #894.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Ignore empty braces. Braces must contain at least one non-whitepsace
character to be recognized as an attr list.
Attr lists for table cells must be at the end of the cell content and must
be seperated from the content by at least one space. This appears to be
a breaking change. However, it is consistent with the behavior elsewhere.
Fixes #898.
|
|
|
|
|
|
|
|
|
|
|
| |
Previously, we'd unescape both `&gt;` and `>` to the same
string because we were running the & => & replacement first.
By changing the order of this replacement, we now convert:
`&gt; >` => `> >`
as expected.
Fixes #988.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If the Python stack comes within 100 frames of the recursion limit,
then the nesting limit of blockquotes is met. Any remaining text,
including angle brackets, are simply wrapped in a paragraph. To
increasing the nesting depth, increase Python's recursion limit.
However, be aware that each level of recursion will likely result in
multiple frames being added to the Python stack. Therefore, the
recursion depth and nesting depth are not one-to-one.
Performance is an concern here. However, the current solution seems like
a reasonable compromise. It doesn't slow things down too much, but also
avoids Markdown input resulting in an error. This is mostly only a concern
with contrived input anyway. For the average Markdown document, this will
likely never be an issue.
Fixes #799.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Add `language-` prefix to output when syntax highlighting is
disabled for both codehilite and fenced_code extensions.
* Add `lang_prefix` config option to customize the prefix.
* Add a 'pygments' env to tox which runs the tests with Pygments
installed. Pygments is locked to a specific version in the env.
* Updated codehilite to accept any Pygments options.
* Refactor fenced code attributes.
- ID attr is defined on `pre` tag.
- Add support for attr_list extension, which allows setting arbitrary
attributes.
- When syntax highlighting is enabled, any pygments options can
be defined per block in the attr list.
- For backward compatibility, continue to support `hi_lines` outside
of an attr_list. That is the only attr other than lang which is allowed
without the brackets (`{}`) of an attr list. Note that if the brackets
exist, then everything, including lang and hl_lines, must be within
them.
* Resolves #775. Resolves #334. Addresses #652.
|
|
|
|
|
| |
Resolves issue that can occur with complex emphasis combinations.
Fixes #979
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Importing the `pkg_resources` module has high memory and startup time
cost. A recent change in 102e01c already avoided it for loading extensions,
but it's still used for validating that __version__ is correctly formatted.
It is possible to avoid it by installing the `packaging` package, but
that adds a dependency for something quite trivial.
Instead, remove the validation and add tests which check the output is
as expected.
Since `setuptools` is no longer required at runtime, remove it from
`install_required`.
|
|
|
| |
Also Raise a `KeyError` when attempting to delete a nonexistent key from the extension registry.
|
| |
|
|
|
| |
Fixes #931.
|
|
|
|
| |
Fixes #906.
|
|
|
|
|
|
|
|
| |
cElementTree is a deprecated alias for ElementTree since Python 3.3.
Also drop the recommendation to import etree from markdown.util,
and deprecate markdown.util.etree.
|
|
|
|
|
|
| |
Note: this slightly changes existing behavior in that raw HTML tags are no
longer included in the HTML `.toc`. However, the fact that that worked before
was an oversight. The intention was always to strip all markup. Resolves #899.
|
|
|
|
|
| |
Addes a new `permalink_title` option to the TOC extension, which allows the title attribute of a permalink to be set to something other than the default English string "Permanent link".
Fixes #781.
|
|
|
|
|
|
|
|
|
| |
Two new configuration options have been added to the toc extension:
`anchorlink_class` and `permalink_class` which allows class(es) to be
assigned to the `anchorlink` and `permalink` HTML respectively. This
allows using icon fonts from CSS for the links. Therefore, an empty string
passed to `permalink` now generates an empty `permalink`. Previously
no `permalink` would have been generated. Based on #776.
|
|
|
|
|
|
| |
The slugify function will stript the STX and ETX characters from
placeholders for backslash excaped characters. Therefore, we need
to unescape any text before passing it to slugify. Fixes #864.
|
|
|
|
|
|
|
| |
* Python syntax upgraded using `pyupgrade --py3-plus`
* Travis no longer uses `sudo`. See https://blog.travis-ci.com/2018-11-19-required-linux-infrastructure-migration
See #760 for Python Version Support Timeline and related dicussion.
|
|
|
| |
Pygments added the `wrapcode` option in version 2.4. Users need to have 2.4+ installed to see the change. However, as earlier versions accepted arbitrary keywords passed to the HTMLFormatter, no error will be raised if the user has an older version of Pygments installed.
|
| |
|
|
|
|
|
|
| |
Remove misleading escaped_chars_in_js test
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In the event that a test fails, a more specific assert will usually
provide more useful information about what went wrong.
Prefer assertIs(..., True) over assertTrue() to assert the type as well
as the truthy value. This is recommended by Python:
https://docs.python.org/3/library/unittest.html#unittest.TestCase.assertTrue
> Note that this is equivalent to bool(expr) is True and not to expr is
> True (use assertIs(expr, True) for the latter). This method should
> also be avoided when more specific methods are available (e.g.
> assertEqual(a, b) instead of assertTrue(a == b)), because they provide
> a better error message in case of failure.
|
| |
|
|
|
|
|
|
| |
Part of the discussion in #798.
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
|
|
|
|
| |
Closes #786.
|
|
|
|
|
| |
Recursively run substitution to handle overlapping matches.
Fixes #458.
|
|
|
|
|
|
| |
All whitespace characters should be treated the same by inline patterns.
Previoulsy, emphasis patterns were only accounting for spaces, but not
other whitepsace characters such as newlines. Fixes #783.
|
|
|
|
|
| |
Adjust pattern to allow for escaped hashes, but take care to not treat
escaped escapes before hashes as escaped hashes. Close #762.
|
|
|
| |
Use a vendored Pep562 backport to simulate Python 3.7's new PEP 562 feature. For Python3.7 and later, default to the official implementation.
|
| |
|
|
|
| |
Previously only newlines preceded by whitespace were collapsed. Fixes #742.
|
|
|
|
| |
This essentially implements the closest we can get to PEP 562 which allows for modules to control `__dir__` and `__getattr__` in order to deprecate attributes. Here we provide a wrapper class for the module in `util`. If a module has attributes that need to deprecated, we derive from the wrapper class and define the attributes as functions with the `property` decorator and the provided `deprecated` decorator. The class is instantiated with the module's `__name__` attribute and the class will properly replace the module with the wrapped module. When accessing the depracted attributes, a warning is raised. Closes #739.
|
|
|
|
| |
Block level elements should be defined per instance, not as base class variables.
|
|
|
|
|
|
| |
Add a config to set the footnote separator. Also remove rel/rev as they aren't really compatible with HTML5 and we already have classes set for refs and backrefs.
Fixes 723.
|
|
|
|
|
| |
Fixes #725
|
| |
|
|
|
|
| |
Fixes #712.
|
|
|
|
|
|
|
|
| |
New `toc_tokens` attribute on Markdown class.
Contains the raw tokens used to build the Table of Contents. Users can
use this to build their own custom Table of Contents rather than needing
to parse the HTML available on the `toc` attribute of the Markdown
class.
|