| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
| |
In addition to checking the spelling in our documentation, we are now also checking the spelling of the README.md and similar files as well as comments in our Python code.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There are small typos in:
- docs/extensions/fenced_code_blocks.md
- docs/extensions/meta_data.md
- markdown/extensions/codehilite.py
- markdown/extensions/footnotes.py
- tests/test_legacy.py
Fixes:
- Should read `delimiters` rather than `deliminators`.
- Should read `shebang` rather than `sheband`.
- Should read `processing` rather than `proccesing`.
- Should read `backslash` rather than `blackslash`.
Signed-off-by: Tim Gates <tim.gates@iress.com>
|
|
|
|
|
|
|
|
|
|
| |
By unescaping backslash escapes in a treeprocessor, the text is properly
escaped during serialization. Fixes #1131.
As it is recognized that various third-party extensions may be calling the
old class at `postprocessors.UnescapePostprocessor` the old class remains
in the codebase, but has been deprecated and will be removed in a future
release. The new class `treeprocessors.UnescapeTreeprocessor` should be
used instead.
|
| |
|
|
|
| |
This completely removes all objects which were deprecated in version 3.0 (this change will be included in version 3.4). Given the time that has passed, and the fact that older unmaintained extensions are not likely to support the new minimum Python version, this is little concern about breaking older extensions.
|
|
|
|
|
|
|
|
| |
* Add an extra option `lang_str` to pass the language of the code block
to the specified Pygments formatter.
* Include an example custom Pygments formatter in the documentation
that includes the language of the code in the output using the new option.
Resolves #1255.
|
|
|
|
|
| |
This adds configuration support for using a custom Pygments formatter,
either by giving the string name, or a custom formatter class (or
callable).
|
|
|
| |
Closes #1224
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* footnotes: Allow to use backlink title without footnote number
- The placeholder '{}' is optional. So a user can choose to include or
not the footnote number in the backlink text.
- The modification is backward compatible with configurations using
the old '%d' placeholder.
* footnotes: Allow to use custom superscript text
- The addition of a new SUPERSCRIPT_TEXT option allows to specify
a placeholder receiving the footnote number for the superscript text.
|
|
|
|
|
|
|
|
|
|
| |
This allows better interoperation with CSS style sheets, as the align
object on the TH is skipped if the css uses 'text-align: inherit' and
the previous 'text-align' is used instead (or the default: left).
Added an override to restore the original `align` behavior
Moved existing tests to the new test infrastructure
Added new tests to test the configuration parameter
Updated documentation to document the configuration parameter.
|
|
|
| |
Fixes #1247.
|
|
|
|
|
|
|
|
|
| |
This fixes a bug where any subsequent highlighted block with codehilite
would result in the omission of the style setting, because it was popped
off the dict. It would then fall back to pygments_style 'default' after
the first block.
Fixes #1240
|
| |
|
| |
|
|
|
|
| |
Fixes #1079.
|
|
|
| |
Fixes #1156.
|
|
|
| |
Fixes #1160.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Two regular expressions were vulerable to Regular Expression Denial of
Service (ReDoS).
Crafted strings containing a long sequence of spaces could cause Denial
of Service by making markdown take a long time to process.
This represents a vulnerability when untrusted user input is processed
with the markdown package.
ReferencesProcessor:
https://github.com/Python-Markdown/markdown/blob/4acb949256adc535d6e6cd8/markdown/blockprocessors.py#L559-L563
e.g.:
```python
import markdown
markdown.markdown('[]:0' + ' ' * 4321 + '0')
```
FencedBlockPreprocessor (requires fenced_code extension):
https://github.com/Python-Markdown/markdown/blob/a11431539d08e14b0bd821c/markdown/extensions/fenced_code.py#L43-L54
e.g.:
```python
import markdown
markdown.markdown('```' + ' ' * 4321, extensions=['fenced_code'])
```
Both regular expressions had cubic worst-case complexity, so doubling
the number of spaces made processing take 8 times as long.
The cubic behaviour can be seen as follows:
```
$ time python -c "import markdown; markdown.markdown('[]:0' + ' ' * 1000 + '0')"
python -c "import markdown; markdown.markdown('[]:0' + ' ' * 1000 + '0')" 1.25s user 0.02s system 99% cpu 1.271 total
$ time python -c "import markdown; markdown.markdown('[]:0' + ' ' * 2000 + '0')"
python -c "import markdown; markdown.markdown('[]:0' + ' ' * 2000 + '0')" 9.01s user 0.02s system 99% cpu 9.040 total
$ time python -c "import markdown; markdown.markdown('[]:0' + ' ' * 4000 + '0')"
python -c "import markdown; markdown.markdown('[]:0' + ' ' * 4000 + '0')" 74.86s user 0.27s system 99% cpu 1:15.38 total
```
Both regexes had three `[ ]*` groups separated by optional groups, in
effect making the regex `[ ]*[ ]*[ ]*`.
Discovered using [regexploit](https://github.com/doyensec/regexploit).
|
| |
|
|
|
|
|
|
|
| |
Update the existing test and add a new one to make sure that the
behavior of default slugify function has not changed.
Fixes #1118.
|
|
|
|
|
|
|
|
|
|
|
|
| |
This fixes a regression which was introduced with support for toc_depth.
Relevant tests have been moved and updated to the new framework.
Fixes #1107.
The test framework also received an addition. The assertMarkdownRenders
method now accepts a new keyword expected_attrs which consists of a dict
of attrs and expected values. Each is checked against the attr of the
Markdown instance. This was needed to check the value of md.toc and
md.toc_tokens in some of the included tests.
|
| |
|
| |
|
|
|
|
|
|
|
| |
* fix unclosed pi in code span
* fix unclosed dec in code span
* fix unclosed tag in code span
Closes #1066.
|
|
|
|
|
|
|
| |
Empty tags do not have a `mardkown` attribute set on them. Therefore,
there is no need to check the mdstack to determine behavior. If we
are in any md_in_html state (regardless of block, span, etc) the
behavior is the same. Fixes #1070.
|
|
|
|
|
|
|
|
|
|
| |
This reverts part of 2766698 and re-implements handling
of tails in the same manner as the core.
Also, ensure line_offset doesn't raise an error on bad input
(see #1066) and properly handle script tags in code
spans (same as in the core).
Fixes #1068.
|
|
|
|
|
|
|
|
|
|
|
| |
Ensure that start/end tag handler does not include tags in the previous
paragraph.
Provide special handling for tags like hr that never have content.
Use sets for block tag lists as they are much faster when comparing
if an item is in the list.
Fixes #1053.
|
|
|
| |
Fixes #1049
|
|
|
|
|
|
| |
Use the list of tags defined in the core by the md_in_html extension.
This ensures that the lists do not diverge and allows users and/or
extensions to expand the list in the core and have that change affect
the extension. Fixes #1047.
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
* 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
|
|
|
| |
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
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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
|
|
|
|
|
| |
The latest version of flake8 added some new tests. This cleans up after
them.
|
|
|
| |
Also Raise a `KeyError` when attempting to delete a nonexistent key from the extension registry.
|
|
|
| |
Fixes #931.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fixed spellings :
1. shebang
2. identification
Added 'the' before 'said'
Fixed vertical line column size to 79
Fixed failing tests : Removed trailing spaces
|
|
|
|
| |
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.
|