Opened 14 years ago

Closed 10 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 14 years ago.
markdown extension_configs patch, svn revision 9791 version
markup_extension_configs_docs.diff (2.1 KB) - added by bdejong 14 years ago.
documentation for additional (and django 1.0) markup parameters and settings

Download all attachments as: .zip

Change History (17)

Changed 14 years ago by bdejong

markdown extension_configs patch, svn revision 9791 version

comment:1 Changed 14 years ago by bdejong

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 14 years ago by bdejong

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

comment:2 Changed 14 years ago by bdejong

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 Changed 13 years ago by (none)

milestone: post-1.0

Milestone post-1.0 deleted

comment:4 Changed 13 years ago by Jacob

milestone: 1.1
Triage Stage: UnreviewedAccepted

comment:5 Changed 13 years ago by dc

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

comment:6 Changed 13 years ago by Jacob

milestone: 1.11.2

This is a feature add -- bump to 1.2.

comment:7 Changed 12 years ago by jkocherhans

milestone: 1.21.3

Feature. Bumping to 1.3.

comment:8 Changed 12 years ago by James Bennett

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 Changed 12 years ago by James Bennett

milestone: 1.3

1.3 is feature-frozen now.

comment:10 Changed 11 years ago by Gabriel Hurley

Component: Contrib appscontrib.markup

comment:11 Changed 11 years ago by Chris Beaven

Severity: Normal
Type: New feature

comment:12 Changed 11 years ago by Julien Phalip

Needs tests: set

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

comment:13 Changed 10 years ago by Aymeric Augustin

UI/UX: unset

Change UI/UX from NULL to False.

comment:14 Changed 10 years ago by Aymeric Augustin

Easy pickings: unset

Change Easy pickings from NULL to False.

comment:15 Changed 10 years ago by Claude Paroz

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