-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handles various Discord markdowns #114
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
今回追加したreplacerに対応するテストを書いてください。
const MARKDOWN2_REPLACER = [/([*_~`])\1(.+?)\1\1/gs, '$2 '] as const; | ||
const MARKDOWN1_REPLACER = [/([_`])(.+?)\1/gs, '$2 '] as const; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/([*_~`]{2}|[_`])(.+?)\1/gs
とすれば一つにまとめられるのでは?
const MARKDOWN1_REPLACER = [/([_`])(.+?)\1/gs, '$2 '] as const; | ||
const ITALIC_REPLACER = [/\*(.+?)\*/g, '$1 '] as const; | ||
// eslint-disable-next-line no-irregular-whitespace | ||
const QUOTE_REPLACER = [/^> (.*[^\s ])$/g, '$1 '] as const; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
これだと末尾に空白文字のある行だけが置換されません。
例:
> a
> b
(> a
の行の末尾にだけスペースがある)
だと、> b
の行はマッチしますが、> a
の行はマッチしません。
@femshima (略).test.js にということでよろしいですか? |
@arx-ein リマインド. |
Discord markdown の記号が読まれないように