| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
Fixes #435.
|
| |
|
|
|
|
| |
Fixes #671
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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'])
|
|
|
|
| |
Use the TOC extension instead.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
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
|
| |
|
|
|
|
|
| |
The failure printed when self.assertTrue was used with str.startswith
did not show the string that was being searched.
|
|
|
|
|
|
| |
Added pygments to test-requirements and updated codehiliting tests to
only test partial output as output differs depending on Pygments version.
Fixes #453
|
|
|
|
|
| |
The option was buggy. Rather than try to fix it, it is being removed.
This feeture should exist as a seperate extension. Fixes #390.
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
I've decided to go with longer lines in the tests. Also fixed a couple
errors with the previous cleanup.
|
|
|
|
| |
Fixes #361.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
`'path.to.module(option=value'` => `path.to.module.Class(option='value')`
This is in anticipation of #335
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
| |
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
| |
|
|
|
|
| |
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.
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|\
| |
| |
| |
| |
| | |
Conflicts:
docs/extensions/index.txt
tests/extensions/test.cfg
|
| | |
|
| |
| |
| |
| | |
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)
|
| | |
|
| |
| |
| |
| | |
use an explicit blank title to not have the <p> tag with the title rendered.
|