showdownjs/showdown

News about the event_refactor branch?

Open

#908 opened on Apr 2, 2022

View on GitHub
 (2 comments) (1 reaction) (0 assignees)JavaScript (13,700 stars) (1,640 forks)batch import
help wanted

Description

Hello @tivie

I'm a user of Showdown: in my application, users create memory cards with Markdown, and the cards are rendered thanks to Showdown. Works perfectly nice, very convenient.

I'm trying to beautify the user's text, with two ideas (I have more, this is the current iteration):

  • Replacing some spaces with nbsp, to prevent carriage returns before punctuation (in French, there is a space before some punctuation marks).
  • Automatically adding thousand separators.

Implementing this (specially the latter) with the current release of Showdown (2.0) and its implementation of extensions and listeners is complicated, because the regex to write are awful since I have to consider the whole text (I don't want to alter URLs or citations, for example).

I dug into the code of the event_refactor branch: the new event system looks brilliant. Being able to work on the text caught by a subparser should be a game changer (captureStart).

  • Do you think I will be able to catch an event to work on plain text, ie text which is not of a specific type? Maybe I'm just talking about the paragraph subparser, but if there is a link in a paragraph, will the event include the link in the caught text of this subparser?
  • The /dist/showdown.js file in the branch is not in line with the source code. This prevents me from playing with the implementation. How can I build it? Or, will you update it?
  • Do you have an idea about when this branch will make it to production release?

Thanks a lot and congrats for this excellent work.

Vincent

Contributor guide