From: Brian N. <bg...@gm...> - 2011-03-01 21:50:43
|
Hi - First of all, thanks for your great work on this package. It is really useful. My users are easily confused and get tripped up by the way Markdown does not insert a <br /> tag when it encounters a newline in a paragraph-like construct. So I'm searching for a way to implement this behavior, just like StackOverflow and GitHub Flavored Markdown do: http://github.github.com/github-flavored-markdown/ Has this been done by anyone before? If not, what is the best way to do this, as an extension? Any pointers on how to best do that? As a preprocessor or tree extension? Or is there already a Python implementation of GitHub flavored Markdown? Thanks, BN |
From: Gerry L. <gjl...@gm...> - 2011-03-02 14:35:46
|
Standard markdown will insert the <br /> if a line is terminated with a double space-CR sequence. In other words, "<space><space><CR>" at the end of a line. Don't know if that's useful or not. Otherwise, paragraphs are handled as a blockparser, you might look at writing an extension to replace the processing done in the ParagraphProcessor class. Regards- Gerry On Tue, Mar 01, 2011 at 03:50:36PM -0600, Brian Neal wrote: > Hi - > > First of all, thanks for your great work on this package. It is really useful. > > My users are easily confused and get tripped up by the way Markdown > does not insert a <br /> tag when it encounters a newline in a > paragraph-like construct. So I'm searching for a way to implement this > behavior, just like StackOverflow and GitHub Flavored Markdown do: > http://github.github.com/github-flavored-markdown/ > > Has this been done by anyone before? If not, what is the best way to > do this, as an extension? Any pointers on how to best do that? As a > preprocessor or tree extension? > > Or is there already a Python implementation of GitHub flavored Markdown? > > Thanks, > BN > > ------------------------------------------------------------------------------ > Free Software Download: Index, Search & Analyze Logs and other IT data in > Real-Time with Splunk. Collect, index and harness all the fast moving IT data > generated by your applications, servers and devices whether physical, virtual > or in the cloud. Deliver compliance at lower cost and gain new business > insights. http://p.sf.net/sfu/splunk-dev2dev > _______________________________________________ > Python-markdown-discuss mailing list > Pyt...@li... > https://lists.sourceforge.net/lists/listinfo/python-markdown-discuss > |
From: Waylan L. <wa...@gm...> - 2011-03-02 17:24:40
|
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. 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. And when you have a working extension, please post a link to it on our wiki [4] so others may use it. [1]: http://www.freewisdom.org/projects/python-markdown/Writing_Extensions [2]: http://achinghead.com/archive/86/python-markdown-adding-insert-delete/ [3]: http://achinghead.com/archive/87/python-markdown-changing-bold-italics/ [4]: http://www.freewisdom.org/projects/python-markdown/Available_Extensions On Tue, Mar 1, 2011 at 4:50 PM, Brian Neal <bg...@gm...> wrote: > Hi - > > First of all, thanks for your great work on this package. It is really useful. > > My users are easily confused and get tripped up by the way Markdown > does not insert a <br /> tag when it encounters a newline in a > paragraph-like construct. So I'm searching for a way to implement this > behavior, just like StackOverflow and GitHub Flavored Markdown do: > http://github.github.com/github-flavored-markdown/ > > Has this been done by anyone before? If not, what is the best way to > do this, as an extension? Any pointers on how to best do that? As a > preprocessor or tree extension? > > Or is there already a Python implementation of GitHub flavored Markdown? > > Thanks, > BN > > ------------------------------------------------------------------------------ > Free Software Download: Index, Search & Analyze Logs and other IT data in > Real-Time with Splunk. Collect, index and harness all the fast moving IT data > generated by your applications, servers and devices whether physical, virtual > or in the cloud. Deliver compliance at lower cost and gain new business > insights. http://p.sf.net/sfu/splunk-dev2dev > _______________________________________________ > Python-markdown-discuss mailing list > Pyt...@li... > https://lists.sourceforge.net/lists/listinfo/python-markdown-discuss > -- ---- \X/ /-\ `/ |_ /-\ |\| Waylan Limberg |
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 |
From: Waylan L. <wa...@gm...> - 2011-06-21 14:32:19
|
Brian, We've received at least one request [1] for your Nl2Br extension [2] to be distributed with Python-Markdown. Unlike some requests, I think this one could be useful to a larger number of people. If you're not opposed, I'll include a copy in our extensions dir with the credit to you. Thanks, Waylan [1]: https://github.com/waylan/Python-Markdown/issues/13 [2]: http://deathofagremmie.com/2011/05/09/a-newline-to-break-python-markdown-extension/ On Thu, Mar 3, 2011 at 10:43 AM, Brian Neal <bg...@gm...> wrote: > On Thu, Mar 3, 2011 at 9:23 AM, Waylan Limberg <wa...@gm...> wrote: >> On Wed, Mar 2, 2011 at 9:52 PM, Brian Neal <bg...@gm...> wrote: >>> Hi - >>> >>> After some head scratching I came up with something super simple (as >>> Waylan said it might be) and it actually seems to work, so far. Before >>> I publish it somewhere for good I'm wondering if you guys would give >>> it a quick peer review. Does this look reasonable? >>> >>> http://dpaste.com/hold/467237/ >>> >> >> That looks good to me. However, what happens when Markdown line break >> syntax (two spaces followed by a newline) is encountered? I'm >> wondering if this will add a second linebreak. If so, you should >> probably remove that pattern. >> > > I've tried this too and it does the right thing. No extra break is inserted. > > Thanks, > BN > -- ---- \X/ /-\ `/ |_ /-\ |\| Waylan Limberg |
From: Brian N. <bg...@gm...> - 2011-06-21 15:02:30
|
Waylan, Yes, absolutely you have my permission! I've been using it for months and so far it seems to work as expected with a variety of inputs. Thanks for including it and thanks for designing Python-Markdown with such a useful extension facility! Best regards, BN On Tue, Jun 21, 2011 at 9:31 AM, Waylan Limberg <wa...@gm...> wrote: > Brian, > > We've received at least one request [1] for your Nl2Br extension [2] > to be distributed with Python-Markdown. Unlike some requests, I think > this one could be useful to a larger number of people. If you're not > opposed, I'll include a copy in our extensions dir with the credit to > you. > > Thanks, > Waylan > > [1]: https://github.com/waylan/Python-Markdown/issues/13 > [2]: http://deathofagremmie.com/2011/05/09/a-newline-to-break-python-markdown-extension/ > |