From: Brian N. <bg...@gm...> - 2011-03-02 17:38:50
|
Hi Waylan, On Wed, Mar 2, 2011 at 11:24 AM, Waylan Limberg <wa...@gm...> wrote: > Brian, > > Glad you have found Python-Markdown useful. Of course, we try to > support Markdown as close as possible, so we won't be implementing > your request as a built in feature. In fact, for those of us who > prefer command line text editors (vim or emacs) Markdown's default > behavior with line breaks makes much more sense. However, in a web > form, I can see the value in making all line breaks hard. I completely understand that; I was thinking of writing it as an extension. I've found the urlize extension that your wiki links too, and with these two tweaks, I think Markdown will be perfect for my web site users. > > This would be a super simple extension. I'm not aware that one already > exists, but you could easily replace the current line break inline > pattern with your own. In fact, you'd really only need to write the > appropriate regex and pass it in using our extension API. See the docs > for all the details [1]. Given the simplicity of something like this, > my tutorials [2] [3] might be more helpful. If you need any help, feel > free to ask. I have been studying your blog posts and the Wiki page on writing extensions. I was concerned that a simple inline pattern would break too many things. For example, could this mess up a code block? I don't think you want to blindly replace all newlines with <br /> tags do you? If so, would writing a tree processor that looked for <p> elements and did the hard breaking inside there be better? Thanks for any advice. If you think an inline pattern will do the trick without being heavy handed and stomping on other blocks I'll try that. I really appreciate how python markdown has been designed with these nice extension points. > > And when you have a working extension, please post a link to it on our > wiki [4] so others may use it. Definitely. Thanks. BN |