showdownjs/showdown

News about the event_refactor branch?

开放

#908 创建于 2022年4月2日

 (2 条评论) (1 个反应) (0 位负责人)JavaScript (1,640 个派生)batch import
help wanted

仓库指标

星标
 (13,700 个星标)
PR 合并指标
 (平均合并 15小时 21分钟) (30 天内合并 3 个 PR)

描述

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

贡献者指南