使用Python正则表达式匹配标题拆分文本文档为章节
Hey there! Let's lay out these Markdown formatting rules in a clear, easy-to-follow way:
Headings
Use number signs (#) to define headings—more signs mean smaller heading sizes:
# Heading 1(the largest, main section title)## Heading 2(subsections)### Heading 3(sub-subsections)- Keep going up to
###### Heading 6(the smallest heading level)
List Items
Start every list item with a dash (-). For nested lists, just indent the items with spaces or tabs:
- Main list item
- Nested list item
- Deeply nested item (indent even more!)
- Nested list item
Emphasized Text
Wrap text with asterisks (*) to add emphasis:
- Italicize text with one pair of asterisks:
*italicized text* - Bold text with two pairs of asterisks:
**bolded text**
Code & Commands
Surround code snippets or terminal commands with backticks (`):
- Inline code (like a single command):
git commit -m "Update README" - Multi-line code blocks use three backticks (
```) before and after the code—you can even specify a language for syntax highlighting:
function calculateSum(a, b) { return a + b; }
Quoted Text
Use greater than signs (>) to create blockquotes, perfect for citing text or pulling out important notes:
This is a quoted block of text.
Each new line in the quote just needs its own>at the start.
Links
Format links by putting the text you want to display in square brackets ([]), then the URL in parentheses (()):
- Example: Check out this helpful guide
Images
For images, use square brackets ([]) for descriptive alt text (so screen readers can understand it), then the image URL in parentheses (()). You can add an optional title by putting it in quotes inside the parentheses:
- Basic image: A photo of a cat
- Image with title: A photo of a cat
内容的提问来源于stack exchange,提问作者sfortney




