I checked what markdown-to-image tools actually do with your text

javascript dev.to

Most "markdown to image" tools follow the same basic flow: paste text, click convert, get a PNG back. What's usually invisible is where the conversion happens.

I went looking for one that didn't upload the text to a server first, and mostly came up short — including a couple that describe themselves as "browser-based" while shipping a hosted rendering API under the hood. So I built "MarkVisu", which does the whole thing client-side. Figured the actual implementation might be useful to share, since it's simpler than it sounds.

The core of it is about 15 lines:

`js
// Parse markdown -> HTML (marked.js)
const html = marked.parse(markdownText);
preview.innerHTML = html;

// Render the DOM node -> canvas -> image (html2canvas)
const canvas = await html2canvas(preview, {
backgroundColor: '#ffffff',
scale: 2, // for retina-quality export
});

const link = document.createElement('a');
link.download = 'export.png';
link.href = canvas.toDataURL('image/png');
link.click();`

That's genuinely most of it. marked turns Markdown into HTML, html2canvas rasterises a DOM node into a , and toDataURL gets you the image. No fetch, no backend, no API call in the whole conversion path — which also means no server cost to run this at any scale, and no round-trip latency.

The verification part is the more interesting bit, if you're evaluating a tool like this yourself: don't take a "we don't upload your data" claim at face value from a privacy policy. Open dev tools → Network tab → paste something in → hit convert. If it's genuinely client-side, no request carrying your text should fire. If something POSTs to a server with your content in the payload, it's not local, whatever the marketing copy says.

Wrote up the longer version, including why this matters more than it sounds for things like pasting AI chat responses (which often contain more context than you'd want on someone else's server) → full post here.

Curious if anyone's hit the same "is this actually local" question with other browser tools - happy to be told I missed an existing one that already does this.

Source: dev.to

arrow_back Back to Tutorials