comark icon indicating copy to clipboard operation
comark copied to clipboard

Markdown rendering is broken for special patterns like `[$imagegen](...)` and `$skill-name`

Open comfuture opened this issue 7 months ago • 4 comments

Summary

Markdown rendering is broken for special patterns like [$imagegen](/Users/user01/.codex/skills/.system/imagegen/SKILL.md) and tokens such as $skill-name.

Details

In OpenAI Codex and similar tools, special text patterns like $skill-name are often used. Currently, comark misinterprets these as unclosed tags, resulting in ugly rendering in the output. These are not intended to be treated as raw markdown tags or links but as literal text.

Expected Behavior

  • Patterns such as [$imagegen](path) or $skill-name should be rendered as plain text or links as appropriate.
  • Markdown renderer should not interpret $...-style strings as incomplete tags and must not produce broken or malformed output.

Steps to Reproduce

  1. Paste [$imagegen](/Users/user01/.codex/skills/.system/imagegen/SKILL.md) into a markdown file/preview with comark.
  2. Observe that rendering is broken/ugly.
  3. Try the same with text like $skill-name.

Environment

  • comarkdown/comark (latest version)

Additional Context

This issue affects many users coming from OpenAI Codex or similar platforms. Addressing this would substantially improve the compatibility and readability for code or skill-related markdown content.


Please let me know if more information or examples are needed!

comfuture avatar Apr 17 '26 07:04 comfuture

This should be fixed in main branch. Do you mind testing with branch release and validate it? https://pkg.pr.new/comarkdown/comark@7e378be

farnabaz avatar Apr 17 '26 13:04 farnabaz

This should be fixed in main branch. Do you mind testing with branch release and validate it? https://pkg.pr.new/comarkdown/comark@7e378be

Ofcourse I will. Thanks for fixing my issue.

comfuture avatar Apr 20 '26 06:04 comfuture

@farnabaz The fix looks partially successful:

  • [$image_gen](...) is now rendered correctly.
  • But $skill-name is still not fully fixed with the default behavior.
  • A mixed sentence like Codex uses [$imagegen](...) and $skill-name. still ends up with an extra trailing $.

What I observed with the preview build:

<p><a href="/Users/user01/.codex/skills/.system/imagegen/SKILL.md">$imagegen</a></p>
<p>$skill-name$</p>
<p>Codex uses <a href="/Users/user01/.codex/skills/.system/imagegen/SKILL.md">$imagegen</a> and $skill-name.$</p>

So the broken link rendering seems fixed, but the $... token case still appears to be affected.

I also checked one more thing: if parsing is done with autoClose: false, then $skill-name and the mixed sentence render correctly. That suggests the remaining issue may still be related to the auto-close logic.

comfuture avatar Apr 20 '26 06:04 comfuture

Indeed this is related to auto-close. By default auto-close detects $ as math blocks and close it. This only happens in the last paragraph of document.

In following example it should render fine.

First P $skill-name 

Second P

I'll also add \ (escape char support) to mark $ as ignored char

farnabaz avatar Apr 20 '26 11:04 farnabaz