Markdown To Textile (Code Class Style)
When to Use
- User requests Markdown to Textile conversion.
- Target renderer requires
<pre><code class="...">style for syntax highlight. - Source contains many fenced code blocks and inline backticks.
- User wants output in chat without editing files.
Output Rules
- Preserve original meaning, sentence order, and technical identifiers.
- Convert headings:
#->h1.##->h2.###->h3.
- Convert inline code to Textile
@...@. - Convert links:
[text](url)->"text":url- raw URL ->
"url":url
- Convert lists:
- unordered ->
* - ordered ->
# - nested levels by repeated markers (
**,##).
- unordered ->
- Convert every fenced block to:
<pre><code class="CLASS">...</code></pre>
Class Selection Logic
- If user specifies class naming, use that exactly.
- If user does not specify, infer from fence hint.
- If ambiguous, use common defaults:
jsfence ->javascriptsh/bashfence ->shell
Procedure
- Parse source and locate all headings, links, lists, inline code, and fenced blocks.
- Convert prose syntax first (headings, inline code, links, lists).
- Replace each fenced block with HTML code tags and resolved class.
- Keep code body unchanged as much as possible.
- Validate:
- no remaining triple-backtick fences
- all
<pre><code ...>have matching</code></pre> - inline backticks are converted to
@...@
Completion Checklist
- Textile output is copy-paste ready.
- Code highlight format is consistent across all blocks.
- Class names follow user preference.
- No semantic drift in explanatory text.