aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_extensions.py
Commit message (Collapse)AuthorAgeFilesLines
* Consistent copyright headers.Waylan Limberg2018-07-271-1/+20
| | | | Fixes #435.
* Add toc_depth parameter to toc extensionJesús Fernández2018-07-241-0/+54
|
* 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
|
* Refactor Extension loading (#627)Waylan Limberg2018-01-121-19/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 support for positional args.Waylan Limberg2018-01-111-5/+5
|
* Added footnote BACKLINK_TEXT test.Waylan Limberg2017-03-081-0/+24
|
* Test if fenced_code honors CodeHilite option use_pygmentsMartin Morgenstern2016-04-111-0/+12
|
* Add single inline code toc testsStephan Groß2016-03-171-4/+33
|
* Add toc permalink testsStephan Groß2016-03-171-0/+28
|
* Add failing toc testStephan Groß2016-03-171-0/+15
|
* Make TestCodeHilite work with Pygments ≥ 2.1.1Dmitry Shachnev2016-03-031-3/+3
| | | | | | | | New versions of Pygments insert <span></span> blocks in the beginning of the generated output sometimes [1], so we need to remove those blocks before doing the actual checking. [1]: https://bitbucket.org/birkenfeld/pygments-main/commits/164574c13533
* Added a few empty lines in the test to satisfy flake8Maurice van der Pot2016-02-271-0/+3
|
* Added assertStartsWith to tests to give better failure messagesMaurice van der Pot2016-02-271-27/+37
| | | | | The failure printed when self.assertTrue was used with str.startswith did not show the string that was being searched.
* Enabled pygments based tests.Waylan Limberg2016-01-281-35/+12
| | | | | | Added pygments to test-requirements and updated codehiliting tests to only test partial output as output differs depending on Pygments version. Fixes #453
* Removed `yaml` option from meta-data extension.Waylan Limberg2015-03-081-20/+0
| | | | | The option was buggy. Rather than try to fix it, it is being removed. This feeture should exist as a seperate extension. Fixes #390.
* Added a 'use_pygments' config option to CodeHilite.Waylan Limberg2015-02-051-0/+11
| | | | | | | | | Fixes #386. I'm doing this against my better judgement. The only reason is that I'm using the HTML format suggested by the HTML5 Spec and will simply not consider any alternate output. If a JavaScript library requires something else, to bad. I don't care. That library should support the format suggested by the spec or I'm not interested in it. If you want something else then you can create your own extension which does whatever you want.
* HeaderId Extension marked as Pending Deprecation.Waylan Limberg2015-01-011-54/+105
| | | | | | | | | | | | | | | | | | | | Use the Table of Contents Extension instead. The HeaderId Extension will raise a PendingDeprecationWarning. The last few features of the HeaderID extension were mirgrated to TOC including the baselevel and separator config options. Also, the marker config option of TOC can be set to an empty string to disable searching for a marker. The `slugify`, `unique` and `stashedHTML2text` functions are now defined in the TOC extension in preperation for the HeaderId extension being removed. All coresponding tests are now run against the TOC Extension. The meta-data support of the HeaderId Extension was not migrated and no plan exists to make that migration. The `forceid` config option makes no sense in the TOC Extension and the only other config setting supported by meta-data was the `header_level`. However, as that depends on the template, it makes more sense to not be defined at the document level.
* Complete test coverage of TOC ExtensionWaylan Limberg2014-12-301-0/+42
|
* Add reset support to TOC extension.Waylan Limberg2014-12-301-0/+8
| | | | | | Now, whenever the TOC extensiuon is loaded, the Markdown class instance will always have a toc attribute (md.toc). Calling md.reset() will also reset the toc attribute which defaults to an empty string.
* Add YAML support to Meta extensionKernc2014-11-301-0/+42
| | | | | | | | By default, this only supports YAML deliminators (`---`) and adds no additional behavior. In other words, parsing is unchanged. However, with the `yaml` option set, PyYAML will parse the metadata. Thanks to @kernc for suggesting the idea and doing the work on this.
* Completed flake8 cleanup.Waylan Limberg2014-11-201-158/+277
| | | | | I've decided to go with longer lines in the tests. Also fixed a couple errors with the previous cleanup.
* Make TestCodeHilite tests working with Pygments 2.0rc1.Dmitry Shachnev2014-11-041-9/+5
| | | | Fixes #361.
* Mark special treatment of extension names as PendingDeprecationWaylan Limberg2014-08-291-16/+0
| | | | | | | | | | | | | | | | | The builtin extensions will no longer get special treatment and have the path ("markdown.extensions.") appended . The same applies for "mdx_" extensions. All names extension must provide the full path. Fixes #336. Also deprecating support for passing in extension config settings as part of the string name. The extension_configs keyword should be used instead. Fixes #335. Also raising PendingDeprecationWarnings for positional args or the "config" keyword on the Extension Class. Pass each setting as a seperate keyword instead. Docs and tests are updated. Still need to update extension API docs.
* Refactored tests to no longer pass configs to names extensions.Waylan Limberg2014-08-291-10/+19
| | | | | `'path.to.module(option=value'` => `path.to.module.Class(option='value')` This is in anticipation of #335
* All extension tests now use python dot notation.Waylan Limberg2014-08-291-29/+29
| | | | | | | | | | All named extensions now use python dot notation in the tests - including all builtin extensions (eg: 'extra' => 'markdown.extensions.extra'). This is in anticipation of #336. Note there are a few tests (in the error tests) that will still need updating, but not till we make the change as they will test for the new error message.
* Renamed 'smart_substitutions' option to 'substitutions'. Fixed a typo.Martin Altmayer2014-08-151-2/+2
|
* Added test for the new 'smart_substitutions' feature of Smarty extension.Martin Altmayer2014-08-141-0/+33
|
* Fixed silly typo. Relates to #325.Waylan Limberg2014-08-011-1/+1
|
* Ensure Extension.getConfigInfo Test always passesWaylan Limberg2014-08-011-2/+3
| | | | | Dicts don't preserve order but still will be equal while lists of tuples always preserve order. When we use a dict to create a list of tuples, the results are unpredictable - especially for a equality test. so we need to compare dicts, not lists. Related to #325
* Update extensions for Extension.__init__ refactorWaylan Limberg2014-07-311-16/+21
| | | | | | | | | | | | | | | | | Fixes #325. All extensions can now accept a dict of configs or **kwargs, not just a list of tuples. Third party extensions may want to follow suite. Extensions may only accept keyword arguments in the future. These changes still need to be documented. A couple things of note: The CodeHilite extension previously issued a DeprecationWarning if the old config key `force_linenos` was used. With thins change, a KeyError will now be raised. The `markdown.util.parseBoolValue` function gained a new argument: `preserve_none` (defaults to False), which when set to True, will pass None through unaltered (will not convert it to False).
* Refactor markdown.extensions.Extension.__init__()Waylan Limberg2014-07-291-1/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As pointed out in #325, setting up Extension configs is kind of a mess. Some places pass a list of tuples on initialization, others a dict. And sometimes they're passed as an arg, othertimes a kwarg. Addiitonaly, the docs are just as inconsistant. This refactor addresses all those sinerios with tests included. The existing extensions still need refactored. But the fact that their tests still pass means we havn't broken third party extensions either. This refactor also introduces a new API, which is the prefered method going forward. All docs should be updated to match. Whereas previously one might do: ```python MyExtension(configs={'key': 'foo', 'otherkey': 'bar'}) ``` This can now be done: ```python MyExtension(key='foo', otherkey='bar') ``` Of course, the old way still works for backward compatability. But that means the `configs` keyword has special status and cannot be used for another purpose.
* Add tests of markdown.extensions.ExtensionWaylan Limberg2014-07-111-0/+23
|
* Allow single as well as double quotes for hl_lines.A. Jesse Jiryu Davis2014-01-071-15/+19
|
* Support syntax for highlighted lines like: ```python hl_lines=“1 3”A. Jesse Jiryu Davis2014-01-061-2/+35
|
* Add feature for emphasizing some lines in a code block.A. Jesse Jiryu Davis2014-01-031-0/+47
| | | | A code blocked headed by “:::python{1,3}” now emphasizes the first and third lines. With fences enabled, ```python{1,3} has the same effect.
* HeaderID Ext now handles raw html in ids. Fixes #232Waylan Limberg2013-07-281-0/+12
|
* MetaData no longer fails with no newline. Fixes #228.Waylan Limberg2013-07-031-0/+7
|
* AbbrExtension now handles abbreviations nested in other markup.Waylan Limberg2013-06-161-0/+9
| | | | | | | | Just set each abreviation as an AtomicString. Given the nature of abbreviations, they are not likely to ever contain any other markup anyway. Also added a test. Fixes #224. Thanks for the report @JakeChampion.
* CodeHilite tests pass in all pygments versions.Waylan Limberg2013-02-251-15/+11
|
* Change `set.append` -> `set.add` in `headerid.unique`Waylan Limberg2013-02-221-0/+7
| | | | | | | | | Fixes #195. This was getting missed because the HeadrerId extension's reset method was resetting the IDs to a list. However, some third party extensions may want to call the unique function and it should work as documented. Interestingly, the TOC extension was using it and passing in a list as well. All fixed now. Also added a test of the `unique` function directly so we shouldn't repeat this in the future.
* Ensure toc attribute is available on Markdown class.Waylan Limberg2013-02-191-0/+39
| | | | | | This appears to have recently been broken with the fixes in #191. This time I've added tests to prevent future breakage and added documentation to explain the behavior.
* Allow better linenum override in CodeHiliteWaylan Limberg2013-02-141-4/+74
| | | | | | | | | | | Fixes #148. The "force_linenos" config setting of the CodeHilite extension has been marked as Pending Deprecation and a new setting "linenums" has been added to replace it. See documentation for the [CodeHilite Extension] for an explaination of the new "linenums" setting. The new setting will honor the old "force_linenos" if it is set, but it will raise a PendingDeprecationWarning and will likely be removed in a future version of Python-Markdown. [CodeHilite Extension]: extensions/codehilite.html
* Merge branch 'master' into admonitionTiago Serafim2013-02-091-1/+14
|\ | | | | | | | | | | Conflicts: docs/extensions/index.txt tests/extensions/test.cfg
| * Testing framework now runs on Python 2 & 3 unmodified.Waylan Limberg2012-12-141-0/+1
| |
| * Fixed #165. Switched the order of treeprocessors when attr_list and headerid ↵Waylan Limberg2012-12-131-0/+12
| | | | | | | | extensions are used togeather. While this means headerid may alter IDs defined in attr_lists for uniqueness, automaticaly generated ids will not contain unparsed attr_lists. This is the lesser of two evils - and actually generates a more valid output (all IDs will be unique)
| * Fixed CodeHilite test when pygments is not installed.Waylan Limberg2012-11-041-1/+1
| |
* | More tests for the extension and new tests for the RE. It's now possible to ↵Tiago Serafim2012-09-191-21/+9
| | | | | | | | use an explicit blank title to not have the <p> tag with the title rendered.
* | Removed the configs.Tiago Serafim2012-09-081-10/+1
| |