aboutsummaryrefslogtreecommitdiffstats
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* Support custom labels in TOC. (#700)Waylan Limberg2018-09-051-9/+25
| | | | | | | | 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-3/+4
| | | | | 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-311-2/+2
| | | | | | 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.
* Refactor options testsWaylan Limberg2018-07-314-10/+12
|
* smart_emphasis keyword > legacy_em extension.Waylan Limberg2018-07-317-7/+43
| | | | | | | | | 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-315-38/+22
| | | | This was adapted from 11408e50 of the md3 branch.
* Removed unnessecary no attributes test. (#694)Waylan Limberg2018-07-313-7/+0
| | | This was missed in #683.
* Fix double escaping of amp in attributes (#670)Isaac Muse2018-07-295-2/+21
| | | | | | | | | | Serializer should only escape & in attributes if not part of & Better regex avoid Unicode and `_` in amp detection. In general, we don't want to escape already escaped content, but with code content, we want literal representations of escaped content, so have code content explicitly escape its content before placing in AtomicStrings. Closes #669.
* Consistent copyright headers.Waylan Limberg2018-07-2716-3/+341
| | | | Fixes #435.
* Replace homegrown OrderedDict with purpose-built Registry. (#688)Waylan Limberg2018-07-271-147/+212
| | | | | | | | | | | | | | | | | | | 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-0/+54
|
* Add the possibility to set additional classesWhiteWinterWolf2018-07-242-0/+17
| | | | | | | | | | | | | | | | | 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>
* Moved enable_attributes keyword to extension: legacy_attrs.Waylan Limberg2018-07-2412-37/+55
| | | | | | | 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.
* Improve serializer test coverageWaylan Limberg2018-07-241-6/+64
| | | | | | | | | Should be 100% coverage now. The ProcessingInstruction needed to be imported directly from ElementTree as PY27 was using a PIProxy which resulted in a bug. Interestingly, PY3 worked fine. Also removed the encoding code as it was not used. Besides it was only ever accessable from a private function.
* Simplify namespace support in serializer.Waylan Limberg2018-07-241-0/+29
| | | | Fixes #679.
* Implement reset() for Meta extension (#672)Glandos2018-06-191-0/+14
| | | | Fixes #671
* Better check of allowed TOC location #639 (#641)Charles de Beauchesne2018-03-081-0/+35
|
* Only strip spaces in tables (#644)Isaac Muse2018-02-222-0/+43
| | | | | Strip only the space character and not things like nbsp in tables. Fixes #635.
* Simplify output_formats to html and xhtml.Waylan Limberg2018-01-251-3/+3
| | | | | | | | | | | We started with the numbers before HTML5 was a thing and we thought there might be an XHTML2. Today, we know that all we have are HTML style tags and XHTML style tags. Nothing else really matters in the real world. Note that if '(x)html1' '(x)html4' or '(x)html5' are passed in, the number is stripped/ignored. Users shouldn't need to change their code for this.
* Flexible inline (#629)Isaac Muse2018-01-176-22/+242
| | | | 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.
* Improve test coverage.Waylan Limberg2018-01-131-2/+56
|
* Correct spelling mistakes.Edward Betts2018-01-1313-13/+13
|
* Refactor Extension loading (#627)Waylan Limberg2018-01-123-103/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 deprecated HeaderId Extension.Waylan Limberg2018-01-111-54/+0
| | | | Use the TOC extension instead.
* Removed deprecated safe_mode.Waylan Limberg2018-01-1120-532/+2
|
* Removed support for deprecated config in ext name.Waylan Limberg2018-01-111-7/+0
|
* Removed deprecated support for positional args.Waylan Limberg2018-01-111-5/+5
|
* Switch from nose to unittestWaylan Limberg2018-01-0812-556/+213
| | | | | | | | | | | | | | | All file-based tests are now defined as unittest test cases via a metaclass which walks a directory and builds a unittest for each pair of test files. To run the tests just run `python -m unittest discover tests`. Or use tox as the tox config has been updated to run the new tests and all nose specific code has been removed. The test generator tools have been removed as well. If any changes or additions need to be made to tests, they should be implemented using the new framework rather than with the file-based tests. Eventually, only the PHP and pl tests should remain as file-based tests.
* Provide new testing framework.Waylan Limberg2018-01-086-0/+1305
| | | | | | | | | | | | | | | | | | As a part of the Markdown lib, test tools can be used by third party extensions. Also keeps test dir clean as it only contains actual tests. More work in this vein to come as the need for Nose is removed. Tests are defined as Unittests rather than in text files allowing features to be more easily broken into units and run individually. Based completely on standard lib unittest with no external dependencies. Use `python -m unittest tests.test_syntax` to run. Pulled some tests from https://github.com/karlcow/markdown-testsuite. Many more test units to pull from that source. As we encounter the need to edit an existing textfile-based test, or add a new test, a new test should be created with this framework and the old test should be deleted. Also need to delete existing testfile-based tests which are covered in the new tests included here.
* Fix raw html reference issue (#585)Isaac Muse2018-01-042-0/+186
| | | | | | | | | | | | | | 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.
* Warnings should cause tests to fail.Waylan Limberg2018-01-041-0/+7
|
* Switch docs to MKDocs (#602)Waylan Limberg2017-12-062-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* Feature ancestry (#598)Isaac Muse2017-11-231-0/+52
| | | | | Ancestry exclusion for inline patterns. Adds the ability for an inline pattern to define a list of ancestor tag names that should be avoided. If a pattern would create a descendant of one of the listed tag names, the pattern will not match. Fixes #596.
* Added footnote BACKLINK_TEXT test.Waylan Limberg2017-03-081-0/+24
|
* Loosen whitespace requirements for admonitions.Waylan Limberg2017-03-052-0/+16
| | | | | | | 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-262-2/+129
| | | | | | 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 HTML parse with empty lines (#537)Isaac Muse2017-01-242-0/+22
| | | | | | | If both open and close was not found in first block, additional blocks were evaluated without context of previous blocks. The algorithm needs to evaluate a buffer with the left bracket present. So feed in all items and get the right bracket, then adjust the data_index to be relative to the last block. Fixes #452.
* Fix footnote parsing of footnote content (#536)Isaac Muse2017-01-232-0/+58
| | | | | | | 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-232-0/+22
| | | | | | 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.
* Fix hr recursion issue (#535)Isaac Muse2017-01-232-0/+15
| | | | | | | HRProcessor tried to access a member variable after recursively calling itself. In certain situations HRProcessor will try to access its member variable containing its match, but it will not be the same match that call in the stack expected. This is easily fixed by storing the match locally *before* doing any recursive work.
* Better inline code escaping (#533)Isaac Muse2017-01-204-5/+33
| | | | | This aims to escape code in a more expected fashion. This handles when backticks are escaped and when the escapes before backticks are escaped.
* Tables: Improvements (#530)Isaac Muse2017-01-193-1/+116
| | | | | | | 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.
* Better handling of backticks in tables (#524)Isaac Muse2017-01-112-1/+40
| | | | 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)
* lists are not tables - fixes #478 (#507)Adam Wood2016-10-262-3/+13
|
* No need to test the same thing twice.Waylan Limberg2016-09-232-5/+2
| | | | Related to #498.
* Merge branch 'master' of https://github.com/waylan/Python-MarkdownWaylan Limberg2016-09-235-7/+16
|\
| * Fix table alignment when seperator contains spaces (#489)eph2016-08-151-4/+4
| | | | | | | | | | | | | | | | | | | | * Fix table alignment when seperator contains spaces eg. seperator like "------ | :----- | :----: | -----: | ------" * Update tests for table * Delete the newline at the end of tables.html
| * Fix image titles not following specfacelessuser2016-07-262-2/+8
| | | | | | | | | | Don’t allow spaces in image links. This was also causing an issue where any text following a space was treated as a title. Ref #484.
| * Fix another issue with attribute lists (with multiple ‘=’ signs)Dmitry Shachnev2016-06-132-0/+3
| |
* | Don't allow equal signs in attr_list keys.Waylan Limberg2016-09-232-1/+4
|/ | | | | | 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.