Closed minht11 closed 7 months ago
Having spaces and newlines or spaces at the end of the paragraph makes it so first characters are not rendered correctly. Given code like this:
--- import { Markdown } from "astro-remote"; // Working as expected const c0 = `Most .`; // 1 space const c1 = `Most .`; // 2 spaces const c2 = `Most .`; // Space at the end const c3 = `Most . `; const content = [c0, c1, c2, c3]; --- <div> {content.map((c) => <Markdown san>{c}</Markdown>)} </div>
Result is
This is not issue with marked since it handles those use cases correctly
So the new PR about to be opened from the branch testing-issue-#7
will include resolutions to some of the issues your facing.
BUT this issue is not entirely related to astro-remote
... aside from the small fix included above,
To preserve the formatting of your strings when they're rendered as Markdown through astro-remote, you might need to escape the trailing spaces and newlines. Here's how you could do that using the example from your Reproduction:
---
import { Markdown } from "astro-remote";
// Working as expected
const c0 = `Most .`;
// 1 space
const c1 = `Most \\
.`;
// 2 spaces
const c2 = `Most \\
.`;
// Space at the end
const c3 = `Most . `;
const content = [c0, c1, c2, c3];
---
<div>
{content.map((c) => <Markdown>{c}</Markdown>)}
</div>
The Above resolved the issues after I updated a internal function
Upgrading from 0.2.4 to 0.3.2 we got major performance issue in production, the only change was updating this dependency. It slowed the whole astro node instance, I don't see it in dev/preview mode/
Having spaces and newlines or spaces at the end of the paragraph makes it so first characters are not rendered correctly. Given code like this:
Result is
Reproduction
This is not issue with marked since it handles those use cases correctly