You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maka.apache.org by "sunrioa (via GitHub)" <gi...@apache.org> on 2026/09/14 17:27:33 UTC

[I] Markdown: escaped brackets in link labels are rendered as display math [maka]

sunrioa opened a new issue, #5310:
URL: https://github.com/apache/maka/issues/5310

   ### What happened
   
   A Markdown link label containing escaped brackets is interpreted as display math. The link remains present, but part of its label becomes a block-level KaTeX formula instead of ordinary text.
   
   The original affected link was:
   
   ```markdown
   [\[DISCUSS\] Clarify Maka sandbox contracts and runtime dependency access](https://github.com/apache/maka/discussions/5304)
   ```
   
   **Expected:** a single inline link with the visible label:
   
   ```text
   [DISCUSS] Clarify Maka sandbox contracts and runtime dependency access
   ```
   
   **Actual:** `DISCUSS` is rendered as mathematical italic letters inside a display-math element within the link. In the attached Desktop screenshot, it appears centered separately from the remaining title, disrupting the surrounding inline layout.
   
   Maka intentionally supports `\[...\]` as display-math syntax. This report concerns its interaction with Markdown link labels, where the same characters can represent literal escaped brackets.
   
   ### How to reproduce
   
   Render this source through Maka’s `MarkdownBody`:
   
   ```markdown
   最新一条是 **#5304**:[\[DISCUSS\] Clarify Maka sandbox contracts and runtime dependency access](https://github.com/apache/maka/discussions/5304),作者 [zhiiw](https://github.com/zhiiw)。
   ```
   
   The following component-level reproduction uses imports relative to `packages/ui/src`:
   
   ```tsx
   import {createElement} from 'react';
   import {renderToStaticMarkup} from 'react-dom/server';
   import {LocaleProvider} from './locale-context.js';
   import {MarkdownBody} from './markdown-body.js';
   
   const text =
     '[\\[DISCUSS\\] Clarify](https://example.com)';
   
   const markup = renderToStaticMarkup(
     createElement(
       LocaleProvider,
       {locale: 'zh-CN'},
       createElement(MarkdownBody, {text}),
     ),
   );
   
   console.log(markup);
   ```
   
   The generated HTML contains this structure, with unrelated attributes omitted:
   
   ```html
   <a href="https://example.com">
     <span>
       <span class="maka-math maka-math-display">
         <span class="katex-display">
           <!-- DISCUSS rendered as mathematical letters -->
         </span>
       </span>
       Clarify
     </span>
   </a>
   ```
   
   The formula and remaining title are inside the same anchor; the result is not two separate links.
   
   ### Environment
   
   - Surface: Desktop Markdown rendering
   - Local component reproduction: Maka commit `a9b4f21afb17e0ef310d076382e69ddda3a441d7`
   - Local dependency: `@astryxdesign/core@0.5.2`
   - macOS
   - Node.js `v24.19.0`
   
   The local `packages/ui/src/markdown-math.tsx` was compared with `main` at `c22768c3b0dc47518f6f8584e864f86f0b1e5379`; their SHA-256 hashes match.
   
   The exact build used for the original Desktop screenshot has not been independently verified. The component reproduction was performed separately.
   
   ### Logs, screenshots, or additional context
   
   ### Source observation
   
   `MarkdownBody` applies `prepareMarkdownMath()` through Astryx’s `transformSource` before Markdown parsing.
   
   The preprocessor recognizes `\[DISCUSS\]` as display math and replaces it with a transport token. Astryx then parses the outer link successfully. Maka’s math plugin renders the token with KaTeX using `displayMode: true`, inside the link label.
   
   Relevant source:
   
   - [`markdown-math.tsx`](https://github.com/apache/maka/blob/c22768c3b0dc47518f6f8584e864f86f0b1e5379/packages/ui/src/markdown-math.tsx): delimiter recognition and KaTeX rendering.
   - [`markdown-body.tsx`](https://github.com/apache/maka/blob/a9b4f21afb17e0ef310d076382e69ddda3a441d7/packages/ui/src/markdown-body.tsx): source transformation and math plugin integration.
   - [`styles.css`](https://github.com/apache/maka/blob/a9b4f21afb17e0ef310d076382e69ddda3a441d7/packages/ui/src/styles.css): `.maka-math-display` uses `display: block`.
   
   Existing tests cover standalone display math. This report is specifically about its interpretation inside an inline link label.
   
   ### Verification scope
   
   The preprocessing result and generated component HTML were reproduced locally. The attached screenshot shows the observed Desktop rendering. The full Desktop layout was not reproduced pixel-for-pixel.
   
   ### Screenshot
   
   <img width="1380" height="222" alt="DISCUSS rendered as display math inside a link label in Maka" src="https://github.com/user-attachments/assets/5b891665-5ae2-41a3-ba85-8433d0bb39ca" />
   
   AI assistance: OpenAI Codex assisted with source inspection, component-level reproduction, and drafting this issue. I reviewed and approved the final report before submission.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org


Re: [I] Markdown: escaped brackets in link labels are rendered as display math [maka]

Posted by "dedsec-terminal (via GitHub)" <gi...@apache.org>.
dedsec-terminal commented on issue #5310:
URL: https://github.com/apache/maka/issues/5310#issuecomment-5669500167

   Opened #5311 with a fix.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org


Re: [I] Markdown: escaped brackets in link labels are rendered as display math [maka]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #5310:
URL: https://github.com/apache/maka/issues/5310#issuecomment-6183966524

   <!-- maka-lifecycle:stale-warning -->
   This issue has had no human activity for 30 days and has been marked stale. It will be closed in 30 days unless someone comments.
   
   If the issue is still current, please confirm it against the latest `main` and add any information that would help move it forward. Assigned issues and issues labelled `pinned` are exempt from this policy.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org


Re: [I] Markdown: escaped brackets in link labels are rendered as display math [maka]

Posted by "Yx01-me (via GitHub)" <gi...@apache.org>.
Yx01-me commented on issue #5310:
URL: https://github.com/apache/maka/issues/5310#issuecomment-5668991734

   take
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org


Re: [I] Markdown: escaped brackets in link labels are rendered as display math [maka]

Posted by "dedsec-terminal (via GitHub)" <gi...@apache.org>.
dedsec-terminal commented on issue #5310:
URL: https://github.com/apache/maka/issues/5310#issuecomment-5669441546

   I would like to work on this. The display-math preprocessor picks up `\[...\]` inside link labels before Markdown parsing, and I have a fix in progress.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org