如何用JavaScript正则实现食谱内容的正确格式化与换行?
Here are the standard Markdown formatting conventions to apply to content:
Headings: Use number signs (
#) at the start of the line. The count of#determines the heading hierarchy:# Level 1 Heading(largest)## Level 2 Heading### Level 3 Heading(smaller)
List Items: Begin each list entry with a dash (
-). For nested lists, indent the items:- Main list item
- Sub-list item
- Main list item
Emphasized Text: Wrap text with asterisks (
*):- Italicize text:
*this text is italic*→ this text is italic - Bold text:
**this text is bold**→ this text is bold
- Italicize text:
Code/Commands: Enclose code snippets with backticks (
`):- Inline code:
`npm install`→npm install - Multi-line code blocks: Use three backticks (
```) on lines before and after the code:def hello(): print("Hello World")
- Inline code:
Quoted Text: Prefix lines with greater than signs (
>):> This is a quoted paragraph.
This is a quoted paragraph.
Links: Format as
[Display Text](Target URL)— wrap the visible link text in square brackets, followed by the URL in parentheses.Images: Format as
— start with an exclamation mark, then wrap descriptive alt text in square brackets, followed by the image's URL in parentheses.
内容的提问来源于stack exchange,提问作者Rakitha

