Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#10685 closed (wontfix)

markdown line breaks with 80-char wrapped text don't make sense with hanging paragraphs i iug ih

Reported by: aresnick Owned by: nobody
Component: Contrib apps Version: 1.0
Severity: Keywords: markdown, template, indent, markup
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I use emacs to edit my django templates. When I use fill-paragraph in markdown-mode with a hanging paragraph (say, as an element of a list), e.g.:

"

- *bench space* :: Our [space](http://sproutward.org/greenhouse) and
  [equipment]() are available for use by individuals and groups. If
  you or your friends (or your research partners or your classmates or
  your children) want to figure out a way to make a project of yours
  happen at sprout--[let's see how we can make it
  happen](mailto:sprout@sproutward.org).

"

The HTML output by the markdown filter in the contrib.markup add-on makes the line break hard, so that the link in the first line has an unwanted whitespace after it is rendered (since the paragraph emacs was wrapped on is longer by the length of the included URIs). That is, as:

"
bench space :: Our space and
equipment are available for use by individuals and groups. If you or your friends (or your research partners or your classmates or your children) want to figure out a way to make a project of yours happen at sprout—let’s see how we can make it happen.
"

But, if you remove the hanging indent, as:

- *bench space* :: Our [space](http://sproutward.org/greenhouse) and
[equipment]() are available for use by individuals and groups. If you
or your friends (or your research partners or your classmates or your
children) want to figure out a way to make a project of yours happen
at sprout--[let's see how we can make it
happen](mailto:sprout@sproutward.org).

then the markdown is rendered as expected, namely:

bench space :: Our space and equipment are available for use by individuals and groups. If you or your friends (or your research partners or your classmates or your children) want to figure out a way to make a project of yours happen at sprout—let’s see how we can make it happen. 

This is confusing. It doesn't seem like the hanging indent should make a difference, given that Gruber's syntax for Markdown explicitly explicitly says:

"To make lists look nice, you can wrap items with hanging indents: [...] But if you want to be lazy, you don’t have to: [...]"

Change History (5)

comment:1 by alec resnick <aresnickety@…>, 15 years ago

comment:2 by Alex Gaynor, 15 years ago

Resolution: wontfix
Status: newclosed

I'm going to mark this as wontfix, since this is an issue with the Python markdown library, and there's nothing Django can do about it.

comment:3 by Karen Tracey, 15 years ago

Replying to Alex:

I'm going to mark this as wontfix, since this is an issue with the Python markdown library, and there's nothing Django can do about it.

There is a Django piece here -- the django.contrib.markup.markdown filter. It isn't at all clear to me from the description that this bit of Django is what is causing the problem, but I suppose it's conceivable that it could be. Or it could be something about how linebreaks and whitespace are handled in templates -- it's hard to tell as the description doesn't actually illustrate how this paragraph is being fed through Django's markdown filter.

For figuring out which piece is causing the problem, exact details of how the markdown filter is being used to format this text would be helpful. Also, something that showed how an alternative way of invoking markdown to format this file doesn't exhibit the problem. That seems to be sort of implied by the quote regarding markdown syntax, but it doesn't actually spell out "Look, here if I do it this other way markdown doesn't put a hard linebreak there, why does markdown when called via the Django filter?"

comment:4 by alec resnick <aresnickety@…>, 15 years ago

Turns out it's a problem in Python Markdown. Pasting the hanging indent text into [Dingus](http://daringfireball.net/projects/markdown/dingus) works, but converting the text using markdown as a module, I get:

'<ul>\n <li>\n     <em>bench space</em> :: Our <a href="http://sproutward.org/greenhouse">space</a> and\n<br />\n<a href="">equipment</a> are available for use by individuals and groups. If\n  you or your friends (or your research partners or your classmates or\n  your children) want to figure out a way to make a project of yours\n  happen at sprout--<a href="mailto:sprout@sproutward.org">let\'s see how we can make it\n  happen</a>.\n </li>\n</ul>'

Thanks for the help! I'll follow up with Python Markdown.

comment:5 by Waylan Limberg, 15 years ago

For the record, this *was* a Markdown bug. Within the next four days we will be releasing Markdown 2.0 which has fixed this and many other bugs. Not to worry, this time we have maintained the API Django uses so no new changes to Django. ;-)

Watch http://twitter.com/WaylanL for the announcement.

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