idyll-lang/idyll

Insert em-dashes when there are three hyphens

オープン

#748 opened on 2021/10/01

 (2 件のコメント) (0 件のリアクション) (0 人の担当者)JavaScript (97 件のフォーク)batch import
CompilerGood First PRhelp wanted

Repository metrics

Stars
 (1,977 個のスター)
PR merge metrics
 (30d に merged PR はありません)

説明

Is your feature request related to a problem? Please describe. It is common for CMSs to automatically replace three hyphens (e.g. ---) with an em-dash ().

Describe the solution you'd like Similar to how Idyll will automatically insert smart quotes, it should also convert hyphens to em-dashes, possibly with an option for users to opt-in/out of this behavior.

This logic should be added to the compiler in the same spot the smartquote logic currently exists (https://github.com/idyll-lang/idyll/blob/master/packages/idyll-compiler/src/processors/post.js#L26-L32).

This can be added via a compiler plugin. It should be added to the list of default plugins; the smartquote plugin would be a good starting point to copy, as that also modifies an article's text.

コントリビューターガイド