Opened 15 years ago

Closed 12 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)

markup_extension_configs.diff (1.2 KB ) - added by bdejong 15 years ago.
markdown extension_configs patch, svn revision 9791 version
markup_extension_configs_docs.diff (2.1 KB ) - added by bdejong 15 years ago.
documentation for additional (and django 1.0) markup parameters and settings

Download all attachments as: .zip

Change History (17)

by bdejong, 15 years ago

markdown extension_configs patch, svn revision 9791 version

comment:1 by bdejong, 15 years ago

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)

by bdejong, 15 years ago

documentation for additional (and django 1.0) markup parameters and settings

comment:2 by bdejong, 15 years ago

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:3 by (none), 15 years ago

milestone: post-1.0

Milestone post-1.0 deleted

comment:4 by Jacob, 15 years ago

milestone: 1.1
Triage Stage: UnreviewedAccepted

comment:5 by dc, 15 years ago

Maybe MarkupField (#10317) will solve this in more generic and elegant way?

comment:6 by Jacob, 15 years ago

milestone: 1.11.2

This is a feature add -- bump to 1.2.

comment:7 by jkocherhans, 14 years ago

milestone: 1.21.3

Feature. Bumping to 1.3.

comment:8 by James Bennett, 14 years ago

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:9 by James Bennett, 13 years ago

milestone: 1.3

1.3 is feature-frozen now.

comment:10 by Gabriel Hurley, 13 years ago

Component: Contrib appscontrib.markup

comment:11 by Chris Beaven, 13 years ago

Severity: Normal
Type: New feature

comment:12 by Julien Phalip, 13 years ago

Needs tests: set

Could someone write tests for this? Also, all changes would need to be combined in one single diff patch.

comment:13 by Aymeric Augustin, 12 years ago

UI/UX: unset

Change UI/UX from NULL to False.

comment:14 by Aymeric Augustin, 12 years ago

Easy pickings: unset

Change Easy pickings from NULL to False.

comment:15 by Claude Paroz, 12 years ago

Resolution: wontfix
Status: newclosed

contrib.markup has been deprecated (#18504) and will be removed in Django 1.6. Closing as obsolete.

Note: See TracTickets for help on using tickets.
Back to Top