Skip to content

Commit

Permalink
Fixed unicode breakage.
Browse files Browse the repository at this point in the history
slugify() requires unicode, not a str instance. This causes the extension to
crash:

File "/home/erik/virtualenv/bb/local/lib/python2.7/site-packages/markdown/__init__.py" in markdown
  386.     return md.convert(text)
File "/home/erik/virtualenv/bb/local/lib/python2.7/site-packages/markdown/__init__.py" in convert
  287.             newRoot = treeprocessor.run(root)
File "/home/erik/virtualenv/bb/local/lib/python2.7/site-packages/markdown/extensions/headerid.py" in run
  140.                         id = slugify(''.join(itertext(elem)), sep)
File "/home/erik/virtualenv/bb/local/lib/python2.7/site-packages/markdown/extensions/headerid.py" in slugify
  93.     value = unicodedata.normalize('NFKD', value).encode('ascii', 'ignore')

TypeError: must be unicode, not str
  • Loading branch information
erikvanzijst committed Aug 14, 2012
1 parent 2789026 commit dbd6676
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion markdown/extensions/headerid.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def run(self, doc):
if "id" in elem.attrib:
id = elem.id
else:
id = slugify(''.join(itertext(elem)), sep)
id = slugify(u''.join(itertext(elem)), sep)
elem.set('id', unique(id, self.IDs))
if start_level:
level = int(elem.tag[-1]) + start_level
Expand Down

0 comments on commit dbd6676

Please sign in to comment.