Skip to content

markdown.md 4-backtick rule is over-applied to standalone code blocks (e.g. mermaid) #26487

Description

@bryanchen-d

Problem

The rule in actions/setup/md/markdown.md:

<markdown-generation><rule>Use 4-backtick fences (not 3) for outer markdown blocks containing nested
code blocks. Use GitHub Flavored Markdown.</rule></markdown-generation>

is being over-applied by the model. It uses 4-backtick fences for all code blocks (e.g. ````mermaid) even when they don't contain any nested triple-backtick fences inside.

This breaks rendering on GitHub — for example, a mermaid diagram wrapped in 4 backticks does not render as a diagram; it shows as raw text.

Observed behavior

In a workflow run (example), the generated comment contained:

````mermaid
graph TD
    A --> B
````

instead of the correct:

```mermaid
graph TD
    A --> B
```

The 4-backtick fence prevents GitHub from recognizing the mermaid block, so the diagram is not rendered.

Additionally, the model sometimes only upgrades the opening fence to 4 backticks while leaving the closing fence at 3, which further breaks formatting.

Expected behavior

The 4-backtick rule should only apply when the code block literally contains triple-backtick fences (```) inside its content. Standalone code blocks like ```mermaid, ```js, ```yaml, etc. should continue to use standard 3-backtick fences.

Suggested fix

Make the rule more precise, for example:

<markdown-generation><rule>Only use 4-backtick fences when the block literally contains triple-backtick
fences inside it. Otherwise use standard 3-backtick fences. Use GitHub Flavored Markdown.</rule></markdown-generation>

This avoids the model conservatively over-applying 4 backticks to blocks that don't need it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions