Zettt / km-markdown-library

Markdown library for Keyboard Maestro.
193 stars 10 forks source link

List *, *, * fails to make list when first item is number #30

Closed Zettt closed 9 years ago

Zettt commented 10 years ago

I have this list:

1.618 The Antikythera Mechanism

Which I'd like to turn into an unordered list, but it produces this as a result:

  1. The Antikythera Mechanism

I hope @pslobo can help me with this. Please.

Zettt commented 10 years ago

Also a problem for recipes where first item is 1/2 spoon of sugar or something similar.

pslobo commented 10 years ago

Hey, sorry about the delay (first notification slipped through the cracks). I'll have a look at tweaking the regex as soon as I can.

Zettt commented 9 years ago

Any update, @pslobo? I just provided some improvements here and there, and I'd love to ship v2.3 before Christmas.

pslobo commented 9 years ago

So this is a tricky one and I'm not entirely sure how you'd want to tackle it. Currently, we're matching the fist character in the clipboard to identify if this is already a list or not. If it uses *-+ then we consider it an unordered list. If it starts with a number, we consider this an ordered list.

In the example you gave, the fist item in the clipboard is a number, so it immediately considers this to be an ordered list (which it is not).

I could instead check every line, but that would defeat the point of this macro. (convert between list types and convert a paragraph to list). Is there a compromise you'd feel comfortable with?

Zettt commented 9 years ago

Well, as far as I'm concerned, and looking at the Markdown syntax, it's an ordered/numbered list when it starts with 1. text. Notice the space at the end. Is that something you can use here?

I agree that checking each line defeats the purpose.

Zettt commented 9 years ago

Fixed as per https://github.com/Zettt/km-markdown-library/commit/620f6e3a767bc8257149bc17107f4a28a0185f85.

Thanks, @rjames86.