Skip to content

Replace emoji preprocessor with a cmark-gfm inline extension #47

Done

Description

@djmsampson

Summary

Replace the raw-Markdown emoji preprocessor with a project-owned cmark-gfm inline extension. Keep emoji expansion always enabled for local cmark conversion. Do not add an enable/disable option to the MEX or MATLAB API.

Problem

src/emoji.c expands aliases before cmark parses the document, so it uses hand-written checks to approximate Markdown syntax. MATLAB MCP checks confirmed these issues:

  • :smile: inside a tilde-fenced code block nested in a block quote or list is expanded, even though cmark renders the content as code.
  • Aliases in reference-link destinations and bare URLs are expanded into emoji, changing the resulting link target. Inline link destinations are currently preserved.
  • Escape and HTML tag handling are also scanner heuristics rather than cmark parser behavior.

Proposed behavior

  • Expand known gemoji aliases in Markdown text, including tables and link labels.
  • Preserve aliases in fenced, indented, and inline code; link destinations (inline, reference, and bare autolinks); and escaped shortcode syntax.
  • Preserve current HTML behavior: do not expand tag syntax or attributes, while text content remains eligible.
  • Keep emoji expansion always on, consistent with the hosted GitHub and GitLab converters. No new public option is needed.

Acceptance criteria

  • Integrate the extension in DocMaker-owned C sources without modifying the cmark-gfm submodule.
  • Retain the generated gemoji lookup table and Unicode output.
  • Add regression coverage for the nested tilde-fence, reference-link, and bare-URL failures, plus escaped shortcodes and existing supported contexts.
  • Keep existing fence, code-span, table, and LF/CRLF behavior passing.

Activity

  1. djmsampson commented on Dec 3, 2026

    @djmsampson
    CollaboratorAuthor

    Implemented on emoji_x:

    • Replaced raw-Markdown emoji preprocessing with an always-enabled cmark-gfm inline extension using the existing generated gemoji lookup table.
    • Updated the MEX to attach the extension to each parser and pass the original Markdown directly to cmark. The MEX and MATLAB interfaces are unchanged.
    • Added regression coverage for nested tilde fences, reference and bare URL destinations, escaped and unknown aliases, HTML text, and link labels.

    Validation: the MEX build succeeded through MATLAB MCP; the full MATLAB suite passed (40 passed, 0 failed, 0 incomplete).

  2. djmsampson commented on Dec 3, 2026

    @djmsampson
    CollaboratorAuthor

    The inline extension replacement was implemented and merged in PR #48. The follow-up cleanup aligning DocMaker's extension interface with cmark-gfm conventions was tracked separately in #49 and completed in commit 8dd9d22. Closing this issue as complete.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions