diff options
author | Waylan Limberg <waylan.limberg@icloud.com> | 2020-09-17 09:35:49 -0400 |
---|---|---|
committer | Waylan Limberg <waylan.limberg@icloud.com> | 2020-09-17 09:59:46 -0400 |
commit | 90e750b1f4fa8d150d7b5a4709858c786f2794dd (patch) | |
tree | 999baab9aaa0dcc7d1dfaafc80cb209a3279155f | |
parent | c99de368726023adba2725d9d0dffff16dec9350 (diff) | |
download | python-markdown-90e750b1f4fa8d150d7b5a4709858c786f2794dd.tar.gz |
Document passing configuration options to Extra.
Closes #1019.
-rw-r--r-- | docs/change_log/release-3.3.md | 1 | ||||
-rw-r--r-- | docs/extensions/extra.md | 38 |
2 files changed, 32 insertions, 7 deletions
diff --git a/docs/change_log/release-3.3.md b/docs/change_log/release-3.3.md index 20272f9..010f526 100644 --- a/docs/change_log/release-3.3.md +++ b/docs/change_log/release-3.3.md @@ -70,6 +70,7 @@ The following new features have been included in the 3.3 release: The following bug fixes are included in the 3.3 release: +* Document how to pass configuration options to Extra (#1019). * Fix HR which follows strong em (#897). * Support short reference image links (#894). * Avoid a `RecursionError` from deeply nested blockquotes (#799). diff --git a/docs/extensions/extra.md b/docs/extensions/extra.md index 3316b7a..77f5de0 100644 --- a/docs/extensions/extra.md +++ b/docs/extensions/extra.md @@ -29,10 +29,34 @@ From the Python interpreter: >>> html = markdown.markdown(text, extensions=['extra']) ``` -There may be [additional extensions](index.md) that are distributed with -Python-Markdown that are not included here in Extra. The features -of those extensions are not part of PHP Markdown Extra, and -therefore, not part of Python-Markdown Extra. If you really would -like Extra to include additional extensions, we suggest creating -your own clone of Extra under a different name -(see the [Extension API](api.md)). +To pass configuration options to the extensions included with Extra, they must be passed to Extra, with the +underlying extension identified as well. In that way Extra will have access to the options and can pass them on to +the appropriate underlying extension. + +```python +config = { + 'extra': { + 'footnotes': { + 'UNIQUE_IDS': True + }, + 'fenced_code': { + 'lang_prefix': 'lang-' + } + }, + 'toc': { + 'permalink': True + } +} + +html = markdown.markdown(text, extensions=['extra', 'toc'], extension_configs=config) +``` + +Note that in the above example, `footnotes` and `fenced_code` are both nested under the `extra` key as those +extensions are included with Extra. However, the `toc` extension is not included with `extra` and therefore its +configuration options are not nested under the `extra` key. + +See each individual extension for a list of supported configuration options. + +There are many other [extensions](index.md) which are distributed with Python-Markdown that are not included here in +Extra. The features of those extensions are not part of PHP Markdown Extra, and therefore, not part of Python-Markdown +Extra. |