Markdown Codeblock Syntax

lesson tools active tools/markdown-codeblock-syntax.md View on GitHub

Markdown Codeblock Syntax

Rule

Always specify language tags for markdown codeblocks (txt, csv, ascii, diagram) to prevent parsing cut-offs.

Context

When writing markdown files with code blocks, especially in save/append operations for journals, documentation, or data files.

Detection

Observable signals that indicate this rule is needed:

Pattern

Always specify appropriate language tag:

# ✅ Correct: Explicit language tags
```txt
Plain text content
Multiple lines preserved
```

```csv
header1,header2,header3
value1,value2,value3
```

```ascii
┌─────────┐
│ Diagram │
└─────────┘
```

```diagram
flowchart TD
    A --> B
```

❌ Wrong: No language tag

```
Content here
Gets cut off

Outcome

Following this pattern prevents:

Benefits:

What happens without language tags: Parser may misinterpret closing ```, cutting content early. Your attention should recognize this pattern when seeing incomplete saves or files ending with ":" or "**".

Related

Match Keywords

file content getting cut off mid-codeblock files ending with incomplete content codeblock without language tag causing parse errors save operation truncating content unclosed code block code block that's not closed there's no closing