Skip to content

fix(convert): preserve unlabelled TLDR code blocks - #84

Merged
Gubarz merged 1 commit into
cheatmd-dev:mainfrom
echo8134:fix/tldr-unlabelled-fences
Sep 30, 2026
Merged

Gubarz merged 1 commit into
cheatmd-dev:mainfrom
echo8134:fix/tldr-unlabelled-fences

Conversation

@echo8134

Copy link
Copy Markdown
Contributor

Summary

cheatmd convert tldr replaces a command in an unlabelled fenced block with a single backtick. The inline-command check consumes the opening fence before the fenced-block check can read its body.

Check for fenced blocks first. Add an exact-output regression test for a multiline command followed by another example.

Related issues

No linked issue.

Verification

The regression fails before the fix and passes afterward. Built CLI conversion followed by dump --json preserves bare, multiline, language-tagged and inline commands, including a following example.

The optional real-world TLDR fixture sweep skips because this checkout lacks pkg/convert/testdata/tldr. The new regression uses an inline fixture and runs.

Local checks passed on Go 1.27.1. The CI workflow uses Go 1.26.3.

Checklist

  • go build ./... and go test ./... pass
  • gofmt -l . and go vet ./... are clean
  • Added regression tests for the changed behavior
  • cheatmd --lint examples/ passes
  • Docs/wiki changes are not needed for this fix

@Gubarz
Gubarz marked this pull request as ready for review September 30, 2026 14:47
@Gubarz
Gubarz merged commit 8c57f63 into cheatmd-dev:main Sep 30, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants