yyoon / Journaley

A simple and elegant open-source journal keeping software for Windows
http://journaleyapp.com/
Other
115 stars 19 forks source link

Markdown strikethrough support #130

Open yyoon opened 8 years ago

yyoon commented 8 years ago

Continuation of #124, as the strikethrough support was not implemented there.

crxtrdude commented 8 years ago

I'll repost this as reference:

I understand why you did that, but I still think it was incorrect for a few reasons.

First, it wouldn't necessarily match the opening / closing strikethrough mark pairs. Take the following example.

~~Line1
Line2
Line3

GitHub renders it as:

~~Line1 Line2 Line3

, because there is no closing ~~ mark at the end.

However, the current code seems like it would just add the opening <del> and then never close it. Processing the opening / closing mark separately will cause all sorts of this problems.

Second, it seems to me that it would only handle the ~~ marks that appear right after <p>and right before </p> am I right? This may not be able to handle the following case:

Normal text ~~strikethrough
should be applied here~~ and not here.
GitHub renders it as:

Normal text ~~strikethrough should be applied here~~ and not here.

, but I think our previous code would probably not handle this correctly.

These are the reasons why I suggested to process at the paragraph level, not at the line level.

Therefore the code here needs to be:

crxtrdude commented 8 years ago

I need to find a way to do so, is there a more systematic way of doing it without using regex or something? The reason I don't want to use a Regex for now is that it's more flexible to accomplish this, and it can fulfill more than just the single lined ones.