Syntax Questions

2008-07-17 Thread Jurgens du Toit
Hey :)

Is it a bug or a feature that the following two texts get formatted
differently?

My shopping list
+ Bread
+ Milk
+ Cheese

My shopping list

+ Bread
+ Milk
+ Cheese

In the first one, the list doesn't get converted to an unordered list, while
in the second, it does...


It occurs in both markdown and markdown extra, btw.

J

-- 
Website: www.jrgns.net

If people never did silly things, nothing intelligent would ever get done.
- Ludwig Wittgenstein
___
Markdown-Discuss mailing list
Markdown-Discuss@six.pairlist.net
http://six.pairlist.net/mailman/listinfo/markdown-discuss


Re: Syntax Questions

2008-07-17 Thread Jurgens du Toit
Ok.

Is it possible to modify the code to do that? Can you point me in the right
direction?

It's something I'd realy like to be able to do, even if it is a configurable
options.

Another thing, is it possible to convert newlines to  tags? I tried
nl2br before and after passing the string to markdown, but either way
there's to many br tags then.

Thanx!
J

On Thu, Jul 17, 2008 at 3:31 PM, Aristotle Pagaltzis <[EMAIL PROTECTED]>
wrote:

> * Jurgens du Toit <[EMAIL PROTECTED]> [2008-07-17 14:25]:
> > Is it a bug or a feature that the following two texts get
> > formatted differently?
>
> That's on purpose. To make a list, it needs to be in a separate
> paragraph.
>
> Regards,
> --
> Aristotle Pagaltzis // <http://plasmasturm.org/>
> ___
> Markdown-Discuss mailing list
> Markdown-Discuss@six.pairlist.net
> http://six.pairlist.net/mailman/listinfo/markdown-discuss
>



-- 
Website: www.jrgns.net

If people never did silly things, nothing intelligent would ever get done.
 - Ludwig Wittgenstein
___
Markdown-Discuss mailing list
Markdown-Discuss@six.pairlist.net
http://six.pairlist.net/mailman/listinfo/markdown-discuss


Re: Syntax Questions

2008-07-17 Thread Jurgens du Toit
On Thu, Jul 17, 2008 at 4:11 PM, John Gabriele <[EMAIL PROTECTED]> wrote:

> On Thu, Jul 17, 2008 at 9:49 AM, Jurgens du Toit
> <[EMAIL PROTECTED]> wrote:
> > Ok.
> >
> > Is it possible to modify the code to do that?
>
> Very probably, but you may not want to. My impression is that there's
> a lot of tradeoffs in Markdown between it trying to do what you mean
> and it requiring non-ambiguous markup. For example, if you've got a
> paragraph with a plus sign in it, and you have your editor re-wrap it,
> you might end up with a line starting with that plus sign. You
> wouldn't want Markdown to think it's a one-item list.


I understand it to be tricky. I'll play around, and, if I don't like it,
adapt and learn!

>
>
> It's also not terribly easy to read without that leading newline.
>
> > Can you point me in the right
> > direction?
>
> You might look in the `_DoLists` function.

Schweet, will do.

>
>
> > It's something I'd realy like to be able to do, even if it is a
> configurable
> > options.
> >
> > Another thing, is it possible to convert newlines to  tags? I tried
> > nl2br before and after passing the string to markdown, but either way
> > there's to many br tags then.
>
> You can end a line with 2 or more spaces and it will create a  for
> you.


Didn't know that one, but, once again, not exactly what I want. Darn 'it,
looks like I'll have to adapt...

Any special reason why single newlines don't get converted to ? I'm
thinking that if it happens right at the end of the manipulations, and
newlines between closing and opening block tags (such as <\p>\n) get
ignored, it will work? Or, actually more simple, only newlines between
certain tags, such as p and div?

J

>
>
> ---John
> ___
> Markdown-Discuss mailing list
> Markdown-Discuss@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
___
Markdown-Discuss mailing list
Markdown-Discuss@six.pairlist.net
http://six.pairlist.net/mailman/listinfo/markdown-discuss


Re: Syntax Questions

2008-07-17 Thread Jurgens du Toit
Exactly that, yes.

On Thu, Jul 17, 2008 at 10:00 PM, Jan Erik Moström <[EMAIL PROTECTED]>
wrote:

> Jurgens du Toit <[EMAIL PROTECTED]> 08-07-17 20.12
>
>  Any special reason why single newlines don't get converted to ? I'm
>> thinking that if it happens right at the end of the manipulations, and
>> newlines between closing and opening block tags (such as <\p>\n) get
>> ignored, it will work? Or, actually more simple, only newlines between
>> certain tags, such as p and div?
>>
>
> I'm not sure I understand, do you mean that you want a text like this:
>
> This is just
> an example
> text
>
> to be translated into
>
> 
> This is just
> an example
> text
> 
>
> Or am I misunderstanding things?
>
>jem
> --
> Jan Erik Moström, www.mostrom.pp.se
>
>
> ___
> Markdown-Discuss mailing list
> Markdown-Discuss@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
___
Markdown-Discuss mailing list
Markdown-Discuss@six.pairlist.net
http://six.pairlist.net/mailman/listinfo/markdown-discuss


Re: Syntax Questions

2008-07-18 Thread Jurgens du Toit
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?

J

On Fri, Jul 18, 2008 at 3:50 AM, Michel Fortin <[EMAIL PROTECTED]>
wrote:

> Le 2008-07-17 à 16:41, Jan Erik Moström a écrit :
>
>  Well, there is a good reason why Markdown doesn't do this. Many prefer to
>> use a plain text editor which doesn't wrap text (I for example prefer my
>> text files this way) and we insert hard new lines to keep the lines from
>> becoming too long. If those hard newlines were translated into 
>> Markdown would be useless for a lot of people.
>>
>
> That's one reason. Personally, I often generally don't write hard-wrapped
> paragraphs... except inside lists and blockquotes where I wants things
> aligned properly in the source text.
>
> For instance, I don't want my text editor to wrap automatically my like
> item like this:
>
>1.  First item of a list with two lines worth wasted text
>for your reading pleasure.
>
> So I indent correctly the second line to make it better looking and easier
> to write:
>
>1.  First item of a list with two lines worth wasted text
>for your reading pleasure.
>
> By doing this, I'm inserting a newline character at the end of each line.
> If Markdown was adding a line break there, then I'd be forced to write the
> bad-looking version, reducing readability of the source text.
>
> The same applies to blockquotes:
>
>> This and that and this and that and this
>> and that and this.
>
> You couldn't indent each line with a ">" if Markdown was to convert every
> newline to a ``.
>
>
>  (and I don't think there is an option to get it to behave the way you
>> want)
>>
>
>
> No there isn't one.
>
>
> Michel Fortin
> [EMAIL PROTECTED]
> http://michelf.com/
>
>
> ___
> Markdown-Discuss mailing list
> Markdown-Discuss@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
___
Markdown-Discuss mailing list
Markdown-Discuss@six.pairlist.net
http://six.pairlist.net/mailman/listinfo/markdown-discuss


Re: Syntax Questions

2008-07-21 Thread Jurgens du Toit
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  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

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
\n
Second Paragraph\n

What would be nice, if it could return:

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
Second Paragraph

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  at the end of the paragraph:

This is a paragraph. Before it there's two hardbreaks, after it as well.
Here's
a single hardbreak. And
Another one.
Second Paragraph

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 <[EMAIL PROTECTED]>
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
> [EMAIL PROTECTED]
> http://michelf.com/
>
>
> ___
> Markdown-Discuss mailing list
> Markdown-Discuss@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
___
Markdown-Discuss mailing list
Markdown-Discuss@six.pairlist.net
http://six.pairlist.net/mailman/listinfo/markdown-discuss


Re: Syntax Questions

2008-07-21 Thread Jurgens du Toit
I mean that "difficulty to test" must not impair the development process.
Yes, sure, don't roll out software that hasn't been tested, but, as Markdown
is issued under an open source license, there's who knows how many people
who might want the untested functionality, and who will be willing to test
it, and probably improve on it as well. Me included.

J

On Mon, Jul 21, 2008 at 12:00 PM, Aristotle Pagaltzis <[EMAIL PROTECTED]>
wrote:

> * Jurgens du Toit <[EMAIL PROTECTED]> [2008-07-21 09:05]:
> > I don't think that if something is difficult to test, it
> > shouldn't be implemented.
>
> You mean it's fine for people to give you software that might or
> might not work, and they don't know which? What happens if you
> report a bug and they can't test whether their bugfix breaks
> previously working stuff?
>
> Regards,
> --
> Aristotle Pagaltzis // <http://plasmasturm.org/>
> ___
> Markdown-Discuss mailing list
> Markdown-Discuss@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
___
Markdown-Discuss mailing list
Markdown-Discuss@six.pairlist.net
http://six.pairlist.net/mailman/listinfo/markdown-discuss


Re: Syntax Questions

2008-07-21 Thread Jurgens du Toit
I understand the answers. I'm just looking for more :)

J

On Mon, Jul 21, 2008 at 6:23 PM, Tom Humiston <[EMAIL PROTECTED]> wrote:

> I think the answers you're getting here will make more sense if you re-read
> John Gruber's description of Markdown's history and purpose, at
> daringfireball.net.
>
>
>
> On 21 Jul 2008, at 6:32 AM, Jurgens du Toit wrote:
>
>  I mean that "difficulty to test" must not impair the development process.
>> Yes, sure, don't roll out software that hasn't been tested, but, as
>> Markdown
>> is issued under an open source license, there's who knows how many people
>> who might want the untested functionality, and who will be willing to test
>> it, and probably improve on it as well. Me included.
>>
>> J
>>
>> On Mon, Jul 21, 2008 at 12:00 PM, Aristotle Pagaltzis <[EMAIL PROTECTED]>
>> wrote:
>>
>>  * Jurgens du Toit <[EMAIL PROTECTED]> [2008-07-21 09:05]:
>>>
>>>> I don't think that if something is difficult to test, it
>>>> shouldn't be implemented.
>>>>
>>>
>>> You mean it's fine for people to give you software that might or
>>> might not work, and they don't know which? What happens if you
>>> report a bug and they can't test whether their bugfix breaks
>>> previously working stuff?
>>>
>>> Regards,
>>> --
>>> Aristotle Pagaltzis // <http://plasmasturm.org/>
>>> ___
>>> Markdown-Discuss mailing list
>>> Markdown-Discuss@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
>> ___
>> Markdown-Discuss mailing list
>> Markdown-Discuss@six.pairlist.net
>> http://six.pairlist.net/mailman/listinfo/markdown-discuss
>>
>
> ___
> Markdown-Discuss mailing list
> Markdown-Discuss@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
___
Markdown-Discuss mailing list
Markdown-Discuss@six.pairlist.net
http://six.pairlist.net/mailman/listinfo/markdown-discuss


Re: Syntax Questions

2008-07-21 Thread Jurgens du Toit
At the end of the day I probably will maintain my own copy, with some
changes, of Markdown. I also don't want to break the syntax. One of my
previous mails I mentioned a way that makes the Markdown more useable (by
being able to usefully use nl2br on the Markdown'ed string) without breaking
the syntax or HTML and plain text presentation.

J

On Tue, Jul 22, 2008 at 1:09 AM, Michel Fortin <[EMAIL PROTECTED]>
wrote:

> Le 2008-07-21 à 6:32, Jurgens du Toit a écrit :
>
>  I mean that "difficulty to test" must not impair the development process.
>> Yes, sure, don't roll out software that hasn't been tested, but, as
>> Markdown
>> is issued under an open source license, there's who knows how many people
>> who might want the untested functionality, and who will be willing to test
>> it, and probably improve on it as well. Me included.
>>
>
> No doubt about that: testing shouldn't impair development. As you've seen,
> I'm not against experiments; I've even told you what to change to get what
> you requested.
>
> But I'm not interested in *publishing* this as a feature of PHP Markdown
> because I don't want to test and maintain a new optional feature. Not to
> mention that I think it breaks the syntax. If you wish to do the maintenance
> and testing it requires and handle the bug reports that will come (or ignore
> them), feel free to fork PHP Markdown and publish that; the license allows
> it.
>
>
> Michel Fortin
> [EMAIL PROTECTED]
> http://michelf.com/
>
>
> _______
> Markdown-Discuss mailing list
> Markdown-Discuss@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
___
Markdown-Discuss mailing list
Markdown-Discuss@six.pairlist.net
http://six.pairlist.net/mailman/listinfo/markdown-discuss


Re: Syntax Questions

2008-07-22 Thread Jurgens du Toit
Mmm, yes. Didn't think about that. Another solution would perhaps be to
split the string into an array by using the start and end tags of block
elements, and then only nl2br specific elements of this array, and then put
the string back together again.

J

On Tue, Jul 22, 2008 at 12:35 PM, Michel Fortin <[EMAIL PROTECTED]>
wrote:

> Le 2008-07-22 à 2:47, Jurgens du Toit a écrit :
>
>  At the end of the day I probably will maintain my own copy, with some
>> changes, of Markdown. I also don't want to break the syntax. One of my
>> previous mails I mentioned a way that makes the Markdown more useable (by
>> being able to usefully use nl2br on the Markdown'ed string) without
>> breaking
>> the syntax or HTML and plain text presentation.
>>
>
> Have you considered what will happen to code blocks with `nl2br`? Won't
> this:
>
>function a() {
>return 1;
>}
>
> be turned into this:
>
>function a() {
>return 1;
>}
>
> effectively doubling the newlines?
>
>
>
> Michel Fortin
> [EMAIL PROTECTED]
> http://michelf.com/
>
>
> ___
> Markdown-Discuss mailing list
> Markdown-Discuss@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
___
Markdown-Discuss mailing list
Markdown-Discuss@six.pairlist.net
http://six.pairlist.net/mailman/listinfo/markdown-discuss