2.4 KiB
2.4 KiB
| name | description |
|---|---|
| fix-title | Use when a pasted ChatGPT or LLM Markdown reply has heading levels that need to be shifted down before insertion under a parent section such as "## GPT"; also use for Markdown title repair, heading nesting fixes, ATX header adjustment, and adding one or more |
Fix Title
Overview
Fix Markdown heading depth for copied LLM replies before inserting them into a discussion record. Use the bundled script for deterministic file edits instead of asking the model to rewrite the document.
The default operation adds two heading levels, turning # Title into ### Title, which fits content placed under a parent heading like ## GPT.
Workflow
- Confirm the input is a Markdown file containing the raw reply to adjust.
- Choose the number of levels to add. Default to
2unless the user specifies another value. - Run
scripts/fix_markdown_titles.pyon the file. - If the target is important or the requested level shift is unusual, use
--dry-runor--outputfirst and inspect the result. - Report the path modified and the level shift used.
Commands
python scripts/fix_markdown_titles.py path/to/reply.md
python scripts/fix_markdown_titles.py path/to/reply.md --levels 1
python scripts/fix_markdown_titles.py path/to/reply.md --levels 3 --dry-run
python scripts/fix_markdown_titles.py path/to/reply.md --levels 2 --output path/to/fixed.md
On Windows PowerShell, quote paths that contain spaces:
python .\scripts\fix_markdown_titles.py "C:\path with spaces\reply.md" --levels 2
Behavior
| Input | --levels 2 output |
|---|---|
# A |
### A |
## B |
#### B |
###### C |
###### C |
The script only changes ATX headings: lines beginning with up to three spaces followed by # through ###### and then whitespace. It does not change headings inside fenced code blocks, quoted lines such as > # text, or indented code.
Common Mistakes
- Do not use a broad replace like
#to###; it will corrupt code blocks, quoted content, tags, and inline text. - Do not increase headings past level six; Markdown ATX headings stop at
######. - Do not change the recorder's outer headings such as
# 1or## GPTunless the user explicitly points the skill at the recorder file and requests that behavior. - Do not use prompt rewriting for this task when the script can perform the edit directly.