Bold and italics

I want to make sure that the stack overflows, so you can do _italics_and *bold*, and it changes it to <em>italics</em>and <strong>bold</strong>, however, I am a beginner for regular expression, and I can hardly write a regular expression for this.

Thanks in advance → Will

+3
source share
1 answer

StackOverflow uses Markdown to convert the syntax you reference (and much more!) To HTML markup. It would be wise for you to use this infrastructure, or, for example, one like this, and not turn it off yourself - why go to all these efforts to reproduce something that works well?

Markdown is a text-to-HTML conversion tool for web writers. Markdown allows you to write using an easy-to-read, easy-to-use text format, and then convert it to structurally correct XHTML (or HTML).

If you decide to knock over your own, use something other than regular expressions, like

+7
source

Source: https://habr.com/ru/post/1781080/


All Articles