Syntax Questions
Jurgens du Toit
jurgens.dutoit at gmail.com
Mon Jul 21 03:02:37 EDT 2008
I'm just throwing ideas around...
I don't think that if something is difficult to test, it shouldn't be
implemented. It would be the same as saying that to bake is too difficult,
so I'll just go without the cake. I do, however, agree with the fact that if
you get different versions of Markdown out in the wild, it would confuse
users as to which version this particular one is, and which syntax to use.
Thanx for the hardbreaks code.
Last question on this topic. This will make absolutely no difference in
which syntax you use, or the eventual presentation, be it HTML or plain
text:
When I nl2br (in PHP) a string returned from Markdown, there's a lot of
extra or unexpected newlines being converted to <br/> tags. The reason for
this is that there's newlines after paragraphs and other block tags.
Could it be possible to specify that you want the HTML to be returned
without these newlines? That the block tags will effectively replace the
newlines that specify them, but any hardbreaks within block tags stay?
An example:
This is a paragraph. Before it there's two hardbreaks, after it as well.
Here's\n
a single hardbreak. And\n
Another one.\n
\n
Paragraph 2\n
\n
At the moment this will return
<p>This is a paragraph. Before it there's two hardbreaks, after it as well.
Here's\n
a single hardbreak. And\n
Another one.\n
</p>\n
\n
<p>Second Paragraph</p>\n
What would be nice, if it could return:
<p>This is a paragraph. Before it there's two hardbreaks, after it as well.
Here's\n
a single hardbreak. And\n
Another one.\n
</p><p>Second Paragraph</p>
As I said, this won't change the syntax or the presentation in any context,
but now I can quite freely execute nl2br on this code, and get what I
expected, except for the extra <br/> at the end of the paragraph:
<p>This is a paragraph. Before it there's two hardbreaks, after it as well.
Here's<br/>
a single hardbreak. And<br/>
Another one.<br/>
</p><p>Second Paragraph</p>
This is then hardbreaks without the two spaces at the end of a line, which
is for me somewhat ungainly.
J
On Fri, Jul 18, 2008 at 1:18 PM, Michel Fortin <michel.fortin at michelf.com>
wrote:
> Le 2008-07-18 à 5:13, Jurgens du Toit a écrit :
>
> Kewl.
>>
>> If you look at a formatter like tidy, it's got a lot of options where you
>> can turn certain behaviour on and off, making it much more useable for a
>> lot
>> of people. Wouldn't it improve the usability of Markdown if these kind of
>> options were present?
>>
>
> The more options, the more difficult to test, because each input can have
> more than one output. There are some configurable things in PHP Markdown,
> but I can attest they are under-tested compared to the regular syntax.
>
> Moreover, with each option affecting how the Markdown source is parsed, you
> multiply per two the number of variants of the language in the wild.
> Currently, if I encounter a text box on a web page claiming to be
> Markdown-formatted I can be pretty sure of the output I'll get for what I
> write. If Markdown had one option turning each newline in one HTML line
> break, then writing in that textbox is guesswork. Hopefully, the form author
> will tell which options are on and which are off -- something like "Markdown
> + automatic line breaks" in our case -- but the more options, the less
> practical it is for authors to write this extra info, or for users to read
> it, because the length of the description would become intimidating.
>
> Which means that if you modify Markdown to change some of its behaviour,
> please don't call it plainly "Markdown". "Markdown + automatic line breaks"
> explains clearly what your text field does differently from Markdown and
> will avoid surprises for your visitors.
>
> - - -
>
> Now, if you still want to do a hard break at each newline with PHP
> Markdown, go to the `doHardBreaks` function and change this expression:
>
> / {2,}\n/
>
> for this one:
>
> /\n/
>
> and I expect it should do the trick. This is totally untested however. And
> I don't plan to add an option like this to future versions.
>
>
>
> Michel Fortin
> michel.fortin at michelf.com
> http://michelf.com/
>
>
> _______________________________________________
> Markdown-Discuss mailing list
> Markdown-Discuss at six.pairlist.net
> http://six.pairlist.net/mailman/listinfo/markdown-discuss
>
--
Jurgens du Toit
Cell: +27 83 511 7932
Fax: +27 86 503 2637
Website: www.jrgns.net
If people never did silly things, nothing intelligent would ever get done.
- Ludwig Wittgenstein
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://six.pairlist.net/pipermail/markdown-discuss/attachments/20080721/fc0cc370/attachment.htm>
More information about the Markdown-Discuss
mailing list