aboutsummaryrefslogtreecommitdiffstats
path: root/markdown/util.py
Commit message (Collapse)AuthorAgeFilesLines
* Move isBlockLevel to class. (#693)Waylan Limberg2018-07-311-19/+20
| | | | | Allows users and/or extensions to alter the list of block level elements. The old implementation remains with a DeprecationWarning. Fixes #575.
* Fix double escaping of amp in attributes (#670)Isaac Muse2018-07-291-0/+11
| | | | | | | | | | 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-271-0/+21
| | | | Fixes #435.
* All Markdown instances are now 'md'. (#691)Waylan Limberg2018-07-271-3/+28
| | | | | | | | | | | | 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).
* Add 'style' to block level elementsWaylan Limberg2018-07-271-1/+1
| | | Fixes #689.
* Replace homegrown OrderedDict with purpose-built Registry. (#688)Waylan Limberg2018-07-271-0/+215
| | | | | | | | | | | | | | | | | | | 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.
* Update block level elements.Waylan Limberg2018-03-161-10/+13
| | | | | Also refactor from regex to a list and add comments to explain why the elements are in the list for future reference. Fixes #543.
* Flexible inline (#629)Isaac Muse2018-01-171-0/+2
| | | | 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.
* Removed deprecated safe_mode.Waylan Limberg2018-01-111-3/+2
|
* Make sure regex patterns are raw strings (#614)Isaac Muse2018-01-021-6/+6
| | | 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.
* Recognize <main> as an HTML5 block level tag. (#525)daniel-j-mac2017-01-171-1/+1
|
* flake8ifyMarc Abramowitz2014-12-091-3/+3
|
* Flake8 cleanup (mostly whitespace).Waylan Limberg2014-11-201-19/+27
| | | | | | 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.
* 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
* Update extensions for Extension.__init__ refactorWaylan Limberg2014-07-311-3/+8
| | | | | | | | | | | | | | | | | 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).
* Marked a bunch of lines as 'no cover'. Coverage at 91%Waylan Limberg2014-07-111-4/+5
|
* added nav-tag as block level elementDavid2014-03-021-1/+1
|
* No longer restrict INLUNE_PLACEHOLDER to 4 digits.Waylan Limberg2014-02-021-1/+1
| | | | | | This was limiting the parser to only 10,000 placeholders (0-9999) per document. removing this limitation allows longer documents ot be parsered correctly. Fixes #255.
* Issue #52ryneeverett2013-10-141-3/+14
|
* Add new "permalink" option to toc extensionDmitry Shachnev2013-09-251-1/+1
| | | | and use it in our docs
* Add new utility function parseBoolValue()Dmitry Shachnev2013-09-251-0/+13
| | | | and use it in all extension that need parsing bool config values.
* Typo in util.pyGrahack2013-08-241-1/+1
| | | implemenation -> implementation
* HeaderID Ext now handles raw html in ids. Fixes #232Waylan Limberg2013-07-281-1/+4
|
* Now using universal code for Python 2 & 3.Waylan Limberg2013-02-271-9/+22
| | | | | | | | | | The most notable changes are the use of unicode_literals and absolute_imports. Actually, absolute_imports was the biggest deal as it gives us relative imports. For the first time extensions import markdown relative to themselves. This allows other packages to embed the markdown lib in a subdir of their project and still be able to use our extensions.
* Simlify importing ElementTreeWaylan Limberg2013-02-261-2/+13
| | | | | | As we no longer support older python versions, importing ElementTree is much simpler. The documented way for extensions to use etree still remains the same.
* Fix all pyflakes unused-import/unused-variable warningsDmitry Shachnev2012-11-091-2/+0
|
* Fixed #151. Raw html matching is now case-insensitive.Waylan Limberg2012-10-211-1/+1
|
* Remove `<ins>` and `<del>` from html block element listfin2012-04-111-1/+1
| | | | They are span elements. `<del>` is explicitly mentioned as such in the [markdown syntax document](http://daringfireball.net/projects/markdown/syntax)
* Fixed #77. util.isBlockLevel() needs to check entire tag passed to it.Waylan Limberg2012-01-301-2/+2
|
* Partial fix of issue #14. hrefs (and titles) are now unescaped, but it ↵Waylan Limberg2011-06-021-0/+1
| | | | uppears that we are loosing escaped backslashes (both in the href and in the link label in the example given in issue 14.
* Added new HTML5 block elements to known block level elementsHorst Gutmann2011-05-221-1/+3
|
* Fixed previous two commits. cElementTree cannot use ElementTree nodes in the ↵Waylan Limberg2010-10-311-4/+1
| | | | tree, but it still uses ElementTree Comment assinged to a node's tag to test for Comment nodes. Also no longer considering Commet nodes to be block level.
* Improved previous commit. isBlockLevel is now more foolproof and will no ↵Waylan Limberg2010-10-291-1/+5
| | | | longer crash on other non-string ElemetTree tags (like processing instructions).
* Fixed Ticket 80. Added support for ElementTree Comments to be included by ↵Waylan Limberg2010-10-291-0/+2
| | | | third party extensions when using cElementTree.
* Moved a bunch of global variables to the instance of the Markdown class.Waylan Limberg2010-07-061-8/+0
|
* Removed Global variable HTML_PLACEHOLDER. Use HtmlStash.get_placeholder(key) ↵Waylan Limberg2010-07-061-3/+3
| | | | if you need it.
* Moved HtmlStash and base Prosessor classes to the new util module.Waylan Limberg2010-07-061-1/+45
|
* Updated commandline script as logging settings are no longer in ↵Waylan Limberg2010-07-061-2/+1
| | | | markdown/__init__.py
* Clean up previous commit a little. renamed misc_logging to md_logging and ↵Waylan Limberg2010-07-061-1/+1
| | | | fixed imports. We import logging levels from logging directly and only import message from md_logging.
* Rename misc.py to util.py at the request of upstreamToshio Kuratomi2010-07-051-0/+73