A desktop utility for cleaning ChatGPT-style Markdown code fences.
It removes unwanted id="..." attributes from fenced code blocks and normalizes text / markdown fences while preserving all other language identifiers.
Available as:
- Python source
- Standalone Linux AppImage
- PyInstaller executable
-
Recursive folder scanning
-
Processes entire Markdown documentation repositories
-
Preview files before modification
-
Shows the first matching fence that triggered detection
-
Optional backup creation (
.bakfiles) -
Backup discovery and cleanup tools
-
Supports:
```text```markdown```python id="..."```json id="..."- Any other fenced language
-
Preserves original line endings
-
Standalone GUI application (Tkinter)
-
Linux AppImage distribution
Transforms:
```text id="a1b2c3"
hello
```Into:
```
hello
```And transforms:
```json id="cdctex"
{
"hello": "world"
}
```Into:
```json
{
"hello": "world"
}
```Language identifiers are removed entirely.
Example:
```text id="abc"
example
```becomes:
```
example
```And:
```markdown id="xyz"
example
```becomes:
```
example
```The language identifier is preserved.
Only the id="..." attribute is removed.
Example:
```python id="abc123"
print("hello")
```becomes:
```python
print("hello")
```Launch the application:
python clean_md_v2.py- Select a file or folder.
- Click Scan.
- Review files that will be modified.
- Click Clean.
- Optionally create backups.
- Optionally remove backups after verification.
When enabled, backups are created as:
README.md.bak
guide.md.bak
api.md.bak
The application can:
- Find backup files
- Display backup files
- Delete backup files
A standalone AppImage is available from the GitHub Releases page:
https://github.com/TSltd/clean_md_fences/releases/tag/v1.0.0
Download:
MarkdownFenceCleaner-x86_64.AppImage
Make executable:
chmod +x MarkdownFenceCleaner-x86_64.AppImageRun:
./MarkdownFenceCleaner-x86_64.AppImageNo Python installation is required.
Create a virtual environment:
python3 -m venv venv
source venv/bin/activateInstall build tools:
pip install pyinstallerBuild:
pyinstaller \
--onefile \
--windowed \
--name MarkdownFenceCleaner \
clean_md_v2.pyResult:
dist/MarkdownFenceCleaner
```text id="a1b2c3"
Define runtime semantic contracts
```
```json id="cdctex"
{
"capability": "reassure"
}
``````
Define runtime semantic contracts
```
```json
{
"capability": "reassure"
}
```- Python 3.8+
No dependencies required.
MIT