Opened 15 years ago
Closed 11 years ago
#10146 closed New feature (wontfix)
Support for contrib/markdown extension_configs in settings.py
Reported by: | bdejong | Owned by: | nobody |
---|---|---|---|
Component: | contrib.markup | Version: | dev |
Severity: | Normal | Keywords: | markdown config extensions extension_configs |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | yes | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Markdown has support for "extension configs". For example: the "wikilink" extension normally turns [[link]]
into <a href="/link/" class="wikilink">link</a>
, but if you want to change the link class or the prefix of the URL you need to do this through configuration of the extension.
This patch allows you to add the configuration in the settings.py file as such:
MARKDOWN_EXTENSION_CONFIGS = { 'wikilink': [ ('base_url', '/help/'), ('end_url', ''), ('html_class', 'wikilink') ] }
It's a very small patch but helps a lot when using markdown extensions. Almost all extensions have some form of configuration available.
Attachments (2)
Change History (17)
Changed 15 years ago by
Attachment: | markup_extension_configs.diff added |
---|
comment:1 Changed 15 years ago by
Ah, saw that the restrucured text markup template used a different name (and method of getting the config) for the config value. Changed the code to match that example:
MARKDOWN_FILTER_SETTINGS = {'wikilink': [('base_url', '/help/'), ('end_url', '/'), ('html_class', 'wikilink')]}
Now using:
extension_configs = getattr(settings, "MARKDOWN_FILTER_SETTINGS", {}) md = markdown.Markdown(extensions=extensions, extension_configs=extension_configs, safe_mode=safe_mode)
Changed 15 years ago by
Attachment: | markup_extension_configs_docs.diff added |
---|
documentation for additional (and django 1.0) markup parameters and settings
comment:2 Changed 15 years ago by
The documentation diff also includes documentation for features which were already in django 1.0, but were not documented.
I.e. the usage of RESTRUCTUREDTEXT_FILTER_SETTINGS and markdown extensions.
comment:4 Changed 15 years ago by
milestone: | → 1.1 |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:5 Changed 15 years ago by
Maybe MarkupField (#10317) will solve this in more generic and elegant way?
comment:8 Changed 14 years ago by
The request for documentation for reST filter support has been split off to #13310; this ticket is now solely for the feature of supporting Markdown extensions.
comment:10 Changed 13 years ago by
Component: | Contrib apps → contrib.markup |
---|
comment:11 Changed 13 years ago by
Severity: | → Normal |
---|---|
Type: | → New feature |
comment:12 Changed 13 years ago by
Needs tests: | set |
---|
Could someone write tests for this? Also, all changes would need to be combined in one single diff patch.
comment:15 Changed 11 years ago by
Resolution: | → wontfix |
---|---|
Status: | new → closed |
contrib.markup has been deprecated (#18504) and will be removed in Django 1.6. Closing as obsolete.
markdown extension_configs patch, svn revision 9791 version