aboutsummaryrefslogtreecommitdiffstats
path: root/markdown/extensions
Commit message (Collapse)AuthorAgeFilesLines
* Support custom labels in TOC. (#700)Waylan Limberg2018-09-051-2/+9
| | | | | | | | 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.
* Move isBlockLevel to class. (#693)Waylan Limberg2018-07-311-2/+1
| | | | | Allows users and/or extensions to alter the list of block level elements. The old implementation remains with a DeprecationWarning. Fixes #575.
* Deprecate md_globals from extension API. (#697)Waylan Limberg2018-07-3118-18/+34
| | | | | | In the past, most of the config was defined using globals. Today all of the config is held on the class instance. Therefore, the `md_globals` parameter is no longer necessary.
* smart_emphasis keyword > legacy_em extension.Waylan Limberg2018-07-313-38/+30
| | | | | | | | | The smart_strong extension has been removed and its behavior is now the default (smart em and smart strong are the default). The legacy_em extension restores legacy behavior (no smart em or smart strong). This completes the removal of keywords. All parser behavior is now modified by extensions, not by keywords on the Markdown class.
* Remove lazy_ol keyword. Use sane_lists extension instead.Waylan Limberg2018-07-311-0/+1
| | | | This was adapted from 11408e50 of the md3 branch.
* Consistent copyright headers.Waylan Limberg2018-07-272-2/+39
| | | | Fixes #435.
* All Markdown instances are now 'md'. (#691)Waylan Limberg2018-07-277-17/+23
| | | | | | | | | | | | Previously, instances of the Markdown class were represented as any one of 'md', 'md_instance', or 'markdown'. This inconsistency made it difficult when developing extensions, or just maintaining the existing code. Now, all instances are consistently represented as 'md'. The old attributes on class instances still exist, but raise a DeprecationWarning when accessed. Also on classes where the instance was optional, the attribute always exists now and is simply None if no instance was provided (previously the attribute wouldn't exist).
* Replace homegrown OrderedDict with purpose-built Registry. (#688)Waylan Limberg2018-07-2717-87/+51
| | | | | | | | | | | | | | | | | | | All processors and patterns now get "registered" to a Registry. Each item is given a name (string) and a priority. The name is for later reference and the priority can be either an integer or float and is used to sort. Priority is sorted from highest to lowest. A Registry instance is a list-like iterable with the items auto-sorted by priority. If two items have the same priority, then they are listed in the order there were "registered". Registering a new item with the same name as an already registered item replaces the old item with the new item (however, the new item is sorted by its newly assigned priority). To remove an item, "deregister" it by name or index. A backwards compatible shim is included so that existing simple extensions should continue to work. DeprecationWarnings will be raised for any code which calls the old API. Fixes #418.
* Add toc_depth parameter to toc extensionJesús Fernández2018-07-241-2/+7
|
* Add the possibility to set additional classesWhiteWinterWolf2018-07-241-2/+4
| | | | | | | | | | | | | | | | | Additional CSS classes names can be appended to the admonition name using spaces as separators. The following markdown: !!! note floatright This is a floating note. Generates the following HTML code: <div class="admonition note floatright"> <p class="admonition-title">Note</p> <p>This is a floating note.</p> </div>
* Add support for PY37 and PYPY3.Waylan Limberg2018-07-241-1/+1
|
* Moved enable_attributes keyword to extension: legacy_attrs.Waylan Limberg2018-07-241-0/+49
| | | | | | | If you have existing documents that use the legacy attributes format, then you should enable the legacy_attrs extension for those documents. Everyone is encouraged to use the attr_list extension going forward. Closes #643. Work adapted from 0005d7a of the md3 branch.
* Implement reset() for Meta extension (#672)Glandos2018-06-191-0/+5
| | | | Fixes #671
* Better check of allowed TOC location #639 (#641)Charles de Beauchesne2018-03-081-10/+12
|
* Only strip spaces in tables (#644)Isaac Muse2018-02-221-5/+5
| | | | | Strip only the space character and not things like nbsp in tables. Fixes #635.
* Flexible inline (#629)Isaac Muse2018-01-176-38/+38
| | | | Add new InlineProcessor class that handles inline processing much better and allows for more flexibility. This adds new InlineProcessors that no longer utilize unnecessary pretext and posttext captures. New class can accept the buffer that is being worked on and manually process the text without regex and return new replacement bounds. This helps us to handle links in a better way and handle nested brackets and logic that is too much for regular expression. The refactor also allows image links to have links/paths with spaces like links. Ref #551, #613, #590, #161.
* Remove deprecated support for Extension args.Waylan Limberg2018-01-1317-73/+45
| | | | | | | | In the past Markdown used to pass extension config settings to the Extension class via a positional argument named `config`. That was deprecated in 2.6 in favor of using keyword arguments (`**kwargs`). Support has been completely dropped. Only keyword arguments are accepted.
* Improve test coverage.Waylan Limberg2018-01-1316-17/+17
|
* Correct spelling mistakes.Edward Betts2018-01-133-4/+4
|
* Refactor Extension loading (#627)Waylan Limberg2018-01-121-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Deprecated naming support is removed: * Removed special treatment for modules in `markdown.extensions` * Removed support for `mdx_` prefixes. Support for Entry Point names added: Support for "short names" are now implemented with entry points. Therefore all the users who call extension names as `toc` will not get errors as the builtin extensions all have entry points defined which match the old "short names" for modules in `markdown.extensions`. The benefit is that any extension can offer the same support without requiring the user to manually copy a file to that location on the file system (way to many extension authors have included such instructions in their installation documentation). The one odd thing about this is that we have been issuing a DeprecationWarning for short names and now they are fully supported again. But I think it's the right thing to do. Support for using dot notation is not removed. After all, it was never deprecated. And we shouldn't "force" entry points. There are plenty of reasons why users may not want that and not all of them can be resolved by using class instances instead. All of the following ways to load an extension are valid: # Class instance from markdown.extensions.toc import TocExtension markdown.markdown(src, extensions=[TocExtension()] # Entry point name markdown.markdown(src, extensions=['toc']) # Dot notation with class markdown.markdown(src, extensions=['markdown.extensions.toc:TocExtension']) # Dot notation without class markdown.markdown(src, extensions=['markdown.extensions.toc'])
* Removed some Py2.4-2.6 specific code.Waylan Limberg2018-01-111-7/+1
|
* Removed deprecated HeaderId Extension.Waylan Limberg2018-01-111-97/+0
| | | | Use the TOC extension instead.
* Removed deprecated safe_mode.Waylan Limberg2018-01-115-16/+12
|
* Fix raw html reference issue (#585)Isaac Muse2018-01-042-1/+14
| | | | | | | | | | | | | | Preserve the line which a reference was on to prevent raw HTML indexing issue. Fixes #584. Prevent raw HTML parsing issue in abbr and footnotes Peserve abbreviation line when stripping and preserve a line for each footnote block. Footnotes should also accumulate the extraneous padding. Test extra lines at the end of references Strip the gathered extraneous whitespace When processing footnotes, we don't actually care to process the extra whitespace at the end of a footnote, but we want it to calculate lines to preserve.
* Avoid DeprecationWarnings for etreeWaylan Limberg2018-01-041-2/+2
| | | | Fixes #618.
* Make sure regex patterns are raw strings (#614)Isaac Muse2018-01-022-12/+12
| | | Python 3.6 is starting to reject invalid escapes. Regular expression patterns should be raw strings to avoid having regex escapes being mistaken for invalid string escapes. Fixes #611.
* [Footnote extension] Add a way to customize the backlink title (#616)Jorge Maldonado Ventura2017-12-221-2/+7
| | | Fixes #610.
* Switch docs to MKDocs (#602)Waylan Limberg2017-12-0617-17/+17
| | | | | | | | | | | | | | | | | | | | | | | | Fixes #601. Merged in 6f87b32 from the md3 branch and did a lot of cleanup. Changes include: * Removed old docs build tool, templates, etc. * Added MkDocs config file, etc. * filename.txt => filename.md * pythonhost.org/Markdown => Python-Markdown.github.io * Markdown lint and other cleanup. * Automate pages deployment in makefile with `mkdocs gh-deploy` Assumes a git remote is set up named "pages". Do git remote add pages https://github.com/Python-Markdown/Python-Markdown.github.io.git ... before running `make deploy` the first time.
* Loosen whitespace requirements for admonitions.Waylan Limberg2017-03-051-2/+2
| | | | | | | Also consume to the end of the first line of any admonition. Everything after the title is discarded. However, the only thing that will match should be whitespace so it should be a non-issue. Fixes #550.
* Fix regression of single column tables (#540)Isaac Muse2017-01-261-9/+40
| | | | | | Single column tables are valid tables, so add back in the accidentally removed functionality of allowing single column tables, but with one exception -- table bodies should not render empty (an empty `<tbody>` is invalid HTML. Fixes #539.
* Fix footnote parsing of footnote content (#536)Isaac Muse2017-01-231-13/+20
| | | | | | | Fixes #412 and #493. First we parse footnote content as its own document avoid quirks with using li as a parent. Second, we surround placeholders with STX and ETX to prevent them from interfering with inline parsing; this is also consistent with how placeholders are used everywhere else in Python Markdown.
* Create additional references for duplicate footnotes (#534)Isaac Muse2017-01-231-5/+93
| | | | | | Track when we find duplicate footnote references and create unique ids for them. Then add an additional tree-processor after inline to go back and update the footnotes with additional back references that link to the duplicate footnote references. Fixes #468.
* Tables: Improvements (#530)Isaac Muse2017-01-191-26/+53
| | | | | | | Tables now handle escaped pipes when testing, in table borders, and in the inline content. To achieve properly, a bug had to be fixed related to appending escaped chars to the Markdown class. Now appended chars only appear in the current instance. Lastly the first backtick in a table can be escaped rounding out the last corner case.
* Update fenced code extension to match codehilite lang regex. (#529)Waylan Limberg2017-01-181-1/+1
| | | Related to #527.
* codehilite: detect languages with funny names (#527)Grant Mathews2017-01-171-1/+1
| | | Extend the language regex to match things like 'C#' and 'VB.Net'.
* Better handling of backticks in tables (#524)Isaac Muse2017-01-111-40/+62
| | | | At some point the logic of counting backticks and determining if they are odd or even was used to parse a row's text into cells. Unfortunately this approach broke expected code parsing logic in a table. We essentially traded one bug for another. This fixes table backtick handling and restores sane backtick logic while preserving existing fixes. (issue #449)
* Add blank lines after toplevel function definitions.Dmitry Shachnev2016-11-181-0/+1
| | | | This fixes warnings with pycodestyle ≥ 2.1, see PyCQA/pycodestyle#400.
* lists are not tables - fixes #478 (#507)Adam Wood2016-10-261-1/+2
|
* getiterator to iter (#501)Brandon Chinn2016-09-291-1/+1
|
* Merge branch 'master' of https://github.com/waylan/Python-MarkdownWaylan Limberg2016-09-232-3/+4
|\
| * Fix table alignment when seperator contains spaces (#489)eph2016-08-151-0/+1
| | | | | | | | | | | | | | | | | | | | * Fix table alignment when seperator contains spaces eg. seperator like "------ | :----- | :----: | -----: | ------" * Update tests for table * Delete the newline at the end of tables.html
| * Fix another issue with attribute lists (with multiple ‘=’ signs)Dmitry Shachnev2016-06-131-3/+3
| |
* | Don't allow equal signs in attr_list keys.Waylan Limberg2016-09-231-3/+3
|/ | | | | | This will probably not result in the output intending by the author, but the syntax would be incorrect so the author needs to edit the document anyway. We just need to ensure the parser does not crash here. Fixes #498.
* Attribute lists are not permitted to contain newlines. Fixes #482.Waylan Limberg2016-06-121-1/+1
|
* Merge branch 'master' of https://github.com/waylan/Python-MarkdownWaylan Limberg2016-04-111-0/+1
|\
| * Support CodeHilite option use_pygments in fenced_codeMartin Morgenstern2016-04-111-0/+1
| |
* | Remove unnessecary if statement.Waylan Limberg2016-04-111-5/+1
|/ | | | | | The statement will never evaluate False, so its not needed. Also, Unicode is not valid for PY3, so its better to not include it. Fixes #470.
* toc: Remove children from header element after iteratingDmitry Shachnev2016-03-171-1/+2
| | | | Removing items while iterating can result in wrong behavior. Refs #461.
* Fix handling of characters after backtick in tables.Dmitry Shachnev2015-11-071-1/+1
| | | | Fixes #440. Thanks @jandecaluwe for the bug report.
* Fixed handling of table cell splitMustafa Haddara2015-10-241-2/+49
|