Journaley icon indicating copy to clipboard operation
Journaley copied to clipboard

Markdown strikethrough support

Open yyoon opened this issue 9 years ago • 2 comments

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

yyoon avatar Nov 26 '15 18:11 yyoon

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:

  • Satisfies inline strikethrough with newlines, while ...
  • Checks the entire paragraph to see if it's terminated or not.
  • Checks if there are no spaces for the strkethroughs before parsing them as <del> tags.

crxtrdude avatar Nov 27 '15 00:11 crxtrdude

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.

crxtrdude avatar Nov 27 '15 00:11 crxtrdude