summaryrefslogtreecommitdiff
path: root/markdown/extensions/headerid.py
Commit message (Collapse)AuthorAgeFilesLines
* Switch docs to MKDocs (#602)Waylan Limberg2017-12-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* Use newer ElementTree API to avoid future breakage.Waylan Limberg2015-01-311-1/+1
|
* Only log warnings from commandline script.Waylan Limberg2015-01-311-4/+0
| | | | | | | | | I need to remember this is a lib first and not configure logging from within the lib. Also, from the script we are now actually displaying deprecation warnings. For some reason I don't understnad deprecation warnings are hidden by default in Python. And who remembers to run Python with the `-Wd` flag every time they upgrade a lib just to make sure there's no new deprecations? Fixes #384.
* HeaderId Extension marked as Pending Deprecation.Waylan Limberg2015-01-011-56/+10
| | | | | | | | | | | | | | | | | | | | 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.
* Flake8 cleanup (mostly whitespace).Waylan Limberg2014-11-201-15/+13
| | | | | | 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.
* More updates to test configs.Waylan Limberg2014-08-291-3/+2
| | | | | | | | | | | | | | 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.
* Cleaned up some whitespace inconsistancies.Waylan Limberg2014-08-221-1/+1
|
* Standardized all extension header comments to a uniform format.Waylan Limberg2014-08-211-67/+8
|
* 'http://packages.python.org/Markdown/' => ↵Waylan Limberg2014-08-211-2/+2
| | | | 'https://pythonhosted.org/Markdown/'. The former redirects to the latter anyway. Might as well point to the actual destination.
* Update extensions for Extension.__init__ refactorWaylan Limberg2014-07-311-2/+3
| | | | | | | | | | | | | | | | | 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).
* Make doctests support Python 3Dmitry Shachnev2014-06-111-6/+6
|
* Add new utility function parseBoolValue()Dmitry Shachnev2013-09-251-12/+3
| | | | and use it in all extension that need parsing bool config values.
* Extended headerid's rawHTML in id handling to toc ext.Waylan Limberg2013-08-111-14/+17
|
* HeaderID Ext now handles raw html in ids. Fixes #232Waylan Limberg2013-07-281-1/+16
|
* Future imports go after the docstringsAdam Dinwoodie2013-03-181-1/+1
| | | | | | | | | A `from __future__ import ...` statement must go after any docstrings; since putting them before the docstring means the docstring loses its magic and just becomes a string literal. That then causes a syntax error if there are further future statements after the false docstring. This fixes issue #203, using the patch provided by @Arfrever.
* Now using universal code for Python 2 & 3.Waylan Limberg2013-02-271-13/+9
| | | | | | | | | | 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.
* Change `set.append` -> `set.add` in `headerid.unique`Waylan Limberg2013-02-221-2/+2
| | | | | | | | | 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.
* nl2br and attr_list compatability.Waylan Limberg2013-02-061-2/+2
| | | | | | Fixes #177. When using both extensions, breaks (`<br>`) must have a linebreak (`\n`) after them before attr_list is run. This patch reorders the treeprocessors so that happens ('attr_list' runs after 'prettify' not before). Also had to alter headerid extension so it runs after 'prettify' or it would run before 'attr_list' if loaded before 'attr_list' by user.
* Fixed #165. Switched the order of treeprocessors when attr_list and headerid ↵Waylan Limberg2012-12-131-3/+7
| | | | 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)
* Fix all pyflakes unused-import/unused-variable warningsDmitry Shachnev2012-11-091-2/+0
|
* Fixed unicode breakage.Erik van Zijst2012-08-141-1/+1
| | | | | | | | | | | | | | | | slugify() requires unicode, not a str instance. This causes the extension to crash: File "/home/erik/virtualenv/bb/local/lib/python2.7/site-packages/markdown/__init__.py" in markdown 386. return md.convert(text) File "/home/erik/virtualenv/bb/local/lib/python2.7/site-packages/markdown/__init__.py" in convert 287. newRoot = treeprocessor.run(root) File "/home/erik/virtualenv/bb/local/lib/python2.7/site-packages/markdown/extensions/headerid.py" in run 140. id = slugify(''.join(itertext(elem)), sep) File "/home/erik/virtualenv/bb/local/lib/python2.7/site-packages/markdown/extensions/headerid.py" in slugify 93. value = unicodedata.normalize('NFKD', value).encode('ascii', 'ignore') TypeError: must be unicode, not str
* Fixed #106. Replaced all references to freewisdom.org (except for Yuri's ↵Waylan Limberg2012-06-281-2/+2
| | | | homepage).
* Fix #99. Account for empty header IDs when ensuring uniqueness.Waylan Limberg2012-05-241-1/+1
|
* Added doctests to fabfile and edited them to pass in all supported versions ↵Waylan Limberg2011-08-021-12/+16
| | | | of python. Note: one test (meta) is still failing on Python 3 due to unicode strings.
* Fix a minor Python 3 incompatability in the headerid extension's slugify ↵Waylan Limberg2011-07-281-1/+1
| | | | function. The url is being encoded (with errors ignored) as an easy means of removing non-ascii chars, but we have to re-encode it *before* running the regex on it, not after.
* Refactored HeaderId extension to no longer include defining ids. It only ↵Waylan Limberg2011-06-301-77/+75
| | | | autogenerates ids. If you want to define your own, use the attr_list extension. Also expanded HeaderId extension to use the same algorithm as the TOC extension (which is better) for slugifying the header text. Added config settings to override the default word separator and the slugify callable. Closes #16 as the reported bug is for a removed feature.
* Added "." to the characters that may be included in implicit heading ids.David Chambers2011-06-051-1/+1
|
* Extension.getConfigs returns a dict and is used by the extensions that use ↵Waylan Limberg2011-05-041-4/+4
| | | | configs. No more self.config['name'][0] weirdness anymore.
* Corrected behavior of headerid extension to match default behavior when ↵Waylan Limberg2011-04-281-1/+4
| | | | "Weve got a problem header". We log a warning - not raise an exception.
* sane logging. remove sys.exit() calls (libraries should never ever call ↵Craig de Stigter2011-04-181-3/+1
| | | | sys.exit()) and raise appropriate exceptions instead. backwards incompatible insofar as custom extensions may need tweaks if they're using old markdown logging (but they shouldn't, it was gross)
* Made the HeaderId extension's word separator configurable to allow, forDavid Chambers2011-01-221-2/+3
| | | | example, hyphens to be used rather than underscores.
* Updated regular expression to accept periods in heading ids.David Chambers2011-01-091-1/+1
|
* Clean up previous commit a little. renamed misc_logging to md_logging and ↵Waylan Limberg2010-07-061-1/+2
| | | | 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-1/+1
|
* Break cyclic import of markdown. This allows people to embed markdownToshio Kuratomi2010-07-051-2/+3
| | | | if they desire.
* Fix for undefined variables that need to be importedToshio Kuratomi2010-07-051-1/+1
|
* Fixed ticket 25. Added reset to HeaderID extension. Reset now resets the ↵Waylan Limberg2009-03-131-5/+8
| | | | duplicate id counter.
* Updated headerid extension for recent refactors (both BlockParser and package).Waylan Limberg2008-11-201-80/+100
|
* Moved markdown_extensions/ to markdown/extensions. Markdown is now one ↵Waylan Limberg2008-11-201-0/+172
package instead of two.