aboutsummaryrefslogtreecommitdiffstats
path: root/markdown
Commit message (Collapse)AuthorAgeFilesLines
* More refactor of TOC Extension.Waylan Limberg2015-01-011-24/+24
| | | | | | Mostly just code cleanup so it reads better. Renamed a few internal things. I didn't write this extension originally so most of this would have been done a long time ago. I just havn't touched this code much till now.
* HeaderId Extension marked as Pending Deprecation.Waylan Limberg2015-01-012-69/+74
| | | | | | | | | | | | | | | | | | | | 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.
* PendingDeprecationWarning (v2.5) => DeprecationWarning (v2.6)Waylan Limberg2014-12-302-35/+29
|
* Preserve order of nested headers in TOCWaylan Limberg2014-12-301-49/+55
| | | | | | | | | Fixes #380. The TOC replacement is now seperate from building the TOC, which allows us to iter through the doc in order rather than with the non-order-preserving interparent pethod. This is almost a complete refactor of the run method. Also cleaned up the config stuff. Thanks to @colewerner for the report and test case.
* Complete test coverage of TOC ExtensionWaylan Limberg2014-12-301-8/+6
|
* Always add toc to Markdown Class InstanceWaylan Limberg2014-12-301-6/+6
| | | | | | | | Previously, we only added the toc attribute (md.toc) if no Marker was found within the document. However, that has caused framworks to do things like force insert a marker, run convert, then extract the toc from the body of the document. This is much cleaner. And if the user wants to add the toc to the document also, they still can.
* Add reset support to TOC extension.Waylan Limberg2014-12-301-0/+6
| | | | | | 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.
* flake8ifyMarc Abramowitz2014-12-091-3/+3
|
* Add YAML support to Meta extensionKernc2014-11-301-7/+41
| | | | | | | | 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.
* Upped version to 2.6.devWaylan Limberg2014-11-301-1/+1
| | | | We are ready to start adding/changing features now.
* Completed flake8 cleanup.Waylan Limberg2014-11-202-2/+2
| | | | | I've decided to go with longer lines in the tests. Also fixed a couple errors with the previous cleanup.
* Flake8 cleanup (mostly whitespace).Waylan Limberg2014-11-2030-602/+805
| | | | | | Got all but a couple files in the tests (ran out of time today). Apparently I have been using some bad form for years (although a few things seemed to look better before the update). Anyway, conformant now.
* Upped version to 2.5.2.2.5.2-finalWaylan Limberg2014-11-191-1/+1
|
* Issue #368: Fix Markdown in raw HTML stops workingfacelessuser2014-11-191-2/+3
| | | | | | | Originally there was an infinite loop issue that was patched in issue #308. Unfortunately, it was fixed all the way. This fix patches the infinite loop fix to only add an offset to the `right_listindex` when it is in a infinite loop scenario.
* Issue #366 Recursion error in toc extfacelessuser2014-11-171-48/+47
| | | | | | | | This reworks the toc ordering to be done in a single pass with no recursion. Very long documents with lots of headers can actually exceed Python’s max recursion limit. By handling the toc ordering with no recursion, large documents can no longer cause toc to fail with recursion erros.
* Issue #365 Bold/Italic nesting fixfacelessuser2014-11-171-2/+2
| | | | | | | | | | | The logic for the current regex for strong/em and em/strong was sound, but the way it was implemented caused some unintended side effects. Whether it is a quirk with regex in general or just with Python’s re engine, I am not sure. Put basically `(\*|_){3}` causes issues with nested bold/italic. So, allowing the group to be defined, and then using the group number to specify the remaining sequential chars is a better way that works more reliably `(\*|_)\2{2}. Test from issue #365 was also added to check for this case in the future.
* Changed logging level when loading extensionsChris Topaloudis2014-10-241-1/+1
| | | So it suppresses messages for loaded extensions when its used as third party.
* Fix tail out of order issuefacelessuser2014-10-181-1/+1
| | | | | | | | | | | | This issue was discovered when dealing with nested inlines. In treeprocessors.py it was incorrectly handling tails. In short, tail elements were being inserted earlier than they were supposed to be. In order to fix this, the insertion index should be incremented by 1 so that when the tails are inserted into the parent, they will be just after the child they came from. Also added a test in nested-patterns to catch this issue.
* Use Pygments APIfacelessuser2014-10-041-10/+10
|
* Upped version to 2.5.12.5.1-finalWaylan Limberg2014-09-261-1/+1
| | | | Also removed an inacurate statement in the 2.5 release notes.
* Run Meta after whitespace normalizationWaylan Limberg2014-09-261-1/+1
| | | | Fixes #343. Thanks for the report @AlexJF.
* Better nested STRONG EM support.Waylan Limberg2014-09-261-2/+6
| | | | | | | | | Fixes #253. Thanks to @facelessuser for the tests. Although I removed a bunch of weird ones (even some that passed) from his PR (#342). For the most part, there is no definitive way for those to be parsed. So there is no point of testing for them. In most of those situations, authors should be mixing underscores and astericks so it is clear what is intended.
* Fix the lost tail issue in inlineprocessors.facelessuser2014-09-262-23/+26
| | | | | | See #253. Prior to this patch, if any inline processors returned an element with a tail, the tail would end up empty. This resolves that issue and will allow for #253 to be fixed. Thanks to @facelessuser for the work on this.
* Added a temp workwround for deprecated short ext names.Waylan Limberg2014-09-251-0/+4
| | | | | | | | | | | | As we chnaged the order in import trys for short names extensions (no dot syntax), an extra test was added to the import code for the occassion when a naming conflict exists. For example, if PyTables is installed (module name is tables) and the user tries to use the short name 'tables' instead of 'markdown.extensions.tables'. Fixes #341. Of course, this code will get ripped out when the old behavior is fully deprecated.
* Fixed TOC Option parsing.Waylan Limberg2014-09-251-2/+2
| | | | | | The new option parser assumes bool values if the default is bool or None. As the "title" option is not a bool value, it should default to an empty string rather than None. Fixes #347.
* Version 2.5-Final2.5-finalWaylan Limberg2014-09-121-1/+1
|
* Deprecate positional args for markdownFromFile also.Waylan Limberg2014-09-121-0/+4
|
* Code Blocks must always be AtomicStringsWaylan Limberg2014-09-081-1/+1
| | | | | | | | | | | | | | | | | | Fixes #340. The "inline" TreeProcessor runs before the "prettify" TreeProcessor, but the "smarty" TreeProcessor (wich is just another instance of `InlineProcessor`) runs after the "prettify" TreeProcessor. The problem was that the "prettify" TreeProcessor was losing the AtomicString quality of the text of code blocks (any operation on a string creates a new string. When that string is an AtomicString, the new string must explicitly be declared as an AtomicString. As the "prettify" TreeProcessor cleans up newlines on code blocks, it was changing the AtomicString to a normal string. And as `InlineProcessor` identifies what elements to skip solely by whether the text is an AtomicString, the "smarty" instance was running on code blocks. Importantly, I added a test of code blocks and spans for smarty, so this shouldn't break again.
* Mark "Safe Mode" as pending deprecation.Waylan Limberg2014-09-012-7/+22
| | | | | Both `safe_mode` and `html_replacement_test` keywords are pending deprecation, as are positional args. Closes #337.
* Mark special treatment of extension names as PendingDeprecationWaylan Limberg2014-08-292-7/+41
| | | | | | | | | | | | | | | | | 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.
* More updates to test configs.Waylan Limberg2014-08-293-13/+18
| | | | | | | | | | | | | | The last few extensions were updated to accept dicts/**kwargs as configs and more tests were updated. Also updated extra to actually accept configs. Note that extra requires an extra level of dicts. First you need to indicate tha the settings are for extra, then, which extension extra wraps. I'm not crazy abount this, bit not sur ehow else to do it without making all the configs a global attribute on the Markdown class to that any extention can access any other extensions config settings. I don't think we wnat to do that. Also updated extra to use dot notation for the sub-extensions.
* Merge branch 'master' of https://github.com/waylan/Python-MarkdownWaylan Limberg2014-08-271-1/+1
|\
| * Fixed a small bug in --extension_configs CLI option.Waylan Limberg2014-08-251-1/+1
| | | | | | | | | | | | | | | | | | This needs to work with the JSON lib if PyYaml isn't available. Therefore, we can't catch a yaml specific exception. The tests are fine using a yaml specific exception as the yaml lib is required by the testing framework anyway. So yaml is always available when running the tests.
* | Allow named extensions to specify the Class NameWaylan Limberg2014-08-271-10/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If you were to import the class like this: from path.to.module import SomeExtensionClass Then the named extension would be the string: "path.to.module:SomeExtensionClass" This should simplify loading extensions from the command line or template filters -- expecially when multiple extensions are defined in a single python module. The docs still need updating. I'm waiting to update the docs after implementing #335 and #336 as that will require a major refactor of that section of the docs anyway.
* | Refactored extension importing.Waylan Limberg2014-08-271-15/+23
|/ | | | | | | | | | | | | We now use importlib which means we no longer support Python 2.6. Also, this refactor properly imports third party extensions which reside at the root of PYTHONPATH. Previously, either `markdown.extensions.` or `mdx_` would be appended to any extension name that did not contain a dot, which required third party extensions to either be in submodules or use the old `mdx_` naming convention. This commit is also in preperation for #336. It will now be much easier to deprecate (and later remove) support for the old ways of handling extension names.
* Removed some old codeWaylan Limberg2014-08-251-4/+1
| | | | | | These couple lines were from an old - no longer used - method of stashing inlines. There is no need for it today. The if statement would never evaluate True.
* Fixed a bug in markdown.util.parseBoolValueWaylan Limberg2014-08-251-3/+3
| | | | | A couple scenarios with "None" were previously not accounted for. Also updated tests which guives us 100% for markdown/util.py
* Include __main__.py in coverage.Waylan Limberg2014-08-221-3/+3
|
* Added `--extension_configs` option to the CLI.Waylan Limberg2014-08-221-13/+37
| | | | | | | | | | The `--extension_configs` option must point to a YAML or JSON file. The contents of the file must parse to a Python Dict which will be passed to the `extension_configs` keyword of the `markdown.Markdown` class. Also added tests for all of the CLI option parsing options and updated documentation.
* Cleaned up some whitespace inconsistancies.Waylan Limberg2014-08-221-1/+1
|
* Standardized all extension header comments to a uniform format.Waylan Limberg2014-08-2117-446/+193
|
* 'http://packages.python.org/Markdown/' => ↵Waylan Limberg2014-08-2110-13/+13
| | | | 'https://pythonhosted.org/Markdown/'. The former redirects to the latter anyway. Might as well point to the actual destination.
* Upped version to 2.5-dev and started release notes.Waylan Limberg2014-08-201-1/+1
|
* Renamed 'smart_substitutions' option to 'substitutions'. Fixed a typo.Martin Altmayer2014-08-151-3/+2
|
* Fixed an old typo in the smarty extension and added a test case.Martin Altmayer2014-08-111-2/+2
|
* Replaced smart_lsquo etc. by a single option smart_substitutions which ↵Martin Altmayer2014-08-111-14/+32
| | | | allows to overwrite all substitution strings. Fixed line length in docs.
* Added options to the Smarty extension that configure the text that is used ↵Martin Altmayer2014-08-091-3/+10
| | | | to replace quotes. This makes it possible to use the correct quotes in languages other than English.
* Update extensions for Extension.__init__ refactorWaylan Limberg2014-07-3119-102/+100
| | | | | | | | | | | | | | | | | 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-7/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Mark a few more lines with 'no cover' - missed them the first time through. ↵Waylan Limberg2014-07-113-6/+6
| | | | The rest should have test cases added.