Skip to content
This repository

enable_attributes=False truncates paragraph at italic/bold text #87

Closed
EdVinyard opened this Issue March 22, 2012 · 1 comment

3 participants

EdVinyard Waylan Limberg Michael Waterfall
EdVinyard

Per the library reference's advice regarding safe_mode, I want to disable attributes. When I use enable_attributes=False, however, the first occurrence of a boldfaced or italicized text truncates the output until the next paragraph break or heading. An example:

Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import markdown
>>> markdown.version
'2.1.1'
>>> markdown.markdown(' a *test* ', enable_attributes=True)
u'<p>a <em>test</em> </p>'
>>> markdown.markdown(' a *test* ', enable_attributes=False)
u'<p>a </p>'

My expectation was that enable_attributes=False wouldn't change this behavior.

See treeprocessors.py starting at line 307.

Michael Waterfall

I've also noticed this happens with links too when enable_attributes set to false; the text is truncated before the link would appear. My markdown will be entered by untrusted users so I need enable_attributes to be set to false. I can't release until it's resolved!

import markdown

>>> markdown.markdown('This is a [paragraph](http://google.com/) with a link')
u'<p>This is a <a href="http://google.com/">paragraph</a> with a link</p>'

>>> markdown.markdown('This is a [paragraph](http://google.com/) with a link', safe_mode=True)
u'<p>This is a <a href="http://google.com/">paragraph</a> with a link</p>'

>>> markdown.markdown('This is a [paragraph](http://google.com/) with a link', safe_mode=True, enable_attributes=False)
u'<p>This is a </p>'

(I'm using v2.1.1)

Waylan Limberg waylan closed this issue from a commit April 16, 2012
Catalin Iacob Fixed #87
Elements should be inserted in the tree regardless of enable_attributes
5236a98
Waylan Limberg waylan closed this in 5236a98 April 17, 2012
Cory Benfield Lukasa referenced this issue in Lukasa/minimalog May 15, 2012
Open

Markdown-formatted Comments #1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.