pngwn / MDsveX

A markdown preprocessor for Svelte.
https://mdsvex.pngwn.io
MIT License
2.46k stars 102 forks source link

remark-github-alerts doesn't work with MDsveX #665

Open ryoppippi opened 1 month ago

ryoppippi commented 1 month ago

https://github.com/hyoban/remark-github-alerts

Reproduction:

version:

    "mdsvex": "^0.12.3"
    "remark-gh-alerts": "^0.0.3"
import { compile } from 'mdsvex';
import remarkGithubAlerts from 'remark-gh-alerts'

const transformed_code = await compile(`
> [!NOTE]
> Highlights information that users should take into account, even when skimming.

> [!TIP]
> Optional information to help a user be more successful.

> [!IMPORTANT]
> Crucial information necessary for users to succeed.

> [!WARNING]
> Critical content demanding immediate user attention due to potential risks.

> [!CAUTION]
> Negative potential consequences of an action.
`,
  {
    remarkPlugins: [remarkGithubAlerts]
  }
);

console.log(transformed_code.code);

output

<blockquote>
<p>[!NOTE]
Highlights information that users should take into account, even when skimming.</p>
</blockquote>
<blockquote>
<p>[!TIP]
Optional information to help a user be more successful.</p>
</blockquote>
<blockquote>
<p>[!IMPORTANT]
Crucial information necessary for users to succeed.</p>
</blockquote>
<blockquote>
<p>[!WARNING]
Critical content demanding immediate user attention due to potential risks.</p>
</blockquote>
<blockquote>
<p>[!CAUTION]
Negative potential consequences of an action.</p>
</blockquote>

The expected result should include blockquotes with a class like markdown-alert markdown-alert-warning, but the result is not.

Works with other markdown parser plugin (like svelte-exmarkdown), but not MDsveX.

Good Result -> https://svelte-5-preview.vercel.app/#H4sIAAAAAAAAE2WSTW8iMQyG_4o3Fy7Q3ilUQtWqy6EDqljtgSA1JJ6ZiMSZTRzaCvHfV5kZsV-XyHlf-7El-yJq6zCJ-f4iSHkUc7HqOjEV_NmVTzqjYxRTkUKOuiiLpKPt-FGSZOu7EBleVDyZ8E5Qx-BhMtTM8MOP-uRB0pgasYjPltt8XDmMnMaiwZg17Uz18qTwHTJ4A0t4kyzpEfZfqs3u66GE32zTOtu0nMBSHaJXbAMBt4ohJ4wJUhuyM8DqhGCJAyitQyaeAp6R4L1FgnSy3ltq7iQN_N162-M3XcEp9zc8QIuuA9V3gCOCDxEhZa0xpTq7G2b9st287lbVroc9xaztPyzCUqPiJ9QhjhNzGFhobqAfq9dqXT2PGMtWKwc6ECMxGPSKjKUGrPdorGIcJlNc_NLGZCzYLvSCchBtOqUb_mn1fbfeVD2-wkaxPeMfyTpQwp8ZSWOCUIMiULpw7yS9PUgqPoPkzuXGUlrCvmztUh7Jw0a3vTWH_f-bP5S8q6SDpMX976uiBeMHq4gKjpbM_KxcxuXFmyvA_aOkxe3ceu0yNr_2ppgKH4ytLRox55jxerj-Ar7bqD3kAgAA

ryoppippi commented 1 month ago

Looks like https://github.com/pngwn/MDsveX/issues/533 is related the issue