Mark It Down
Got a README, a spec, or release notes in Markdown? Turn it into one good-looking, self-contained HTML page — syntax highlighting and all — and share it as a link in seconds.
pastehtml.dev publishes one thing: a single HTML file. Markdown is not HTML — so to share a
.md we wrap it in a thin HTML shell that renders the Markdown in the reader's browser.
The raw Markdown rides along inside the file (easy to view-source and copy), and a tiny script turns it into the
pretty page you see.
Embed the raw Markdown in a non-executed <script type="text/markdown"> block →
parse it with marked → scrub the result with DOMPurify →
colorize code with highlight.js → drop it into a comic-styled body. All three libraries
load from a CDN, which pastes are explicitly allowed to do.
How it works
- Your Markdown is stored verbatim in a
<script type="text/markdown">tag — the browser never executes it, and any</script>inside it is safely escaped. - On load, marked converts that Markdown (GitHub-flavored: tables, task lists, fenced code) into HTML.
- DOMPurify sanitizes the generated HTML, stripping anything dangerous so a malicious snippet in the source can't run.
- Each code block is highlighted with highlight.js, and the comic prose styles make headings, tables, and quotes pop.
Try it. Paste Markdown below and watch it render live; then build a self-contained page you can publish.
The Markdown Forge
The page renders in the browser, so readers need JavaScript on. Pin the CDN versions (this forge does)
so your page can't break when a library ships a new major. And keep it self-contained — relative image
links won't resolve on a paste's isolated origin, so use full https:// image URLs or data URIs.
Publish it
Option A — Drag & drop
Drop the downloaded .html onto pastehtml.dev and copy the
https://<token>.pastehtml.dev/ link it hands back.
Option B — The API (one-liner)
Already have your Markdown rendered to a file? Ship it straight from the terminal:
curl -F "[email protected]" https://pastehtml.dev/api/pastes
The 201 response gives you the shareable live_url and a one-time
update_token — keep it to PATCH the same link when the doc changes. Full guide:
pastehtml.dev/llms.txt.
Agents can skip the forge entirely: convert Markdown to this shell server-side, then POST it.
What the forge bakes in
The published file is just your Markdown plus this renderer. Here's the heart of it — the same code runs in the preview above and in every page you build:
<script type="text/markdown" id="md">
# Your Markdown lives here, verbatim
</script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/marked.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/purify.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/highlight.min.js"></script>
<script>
var raw = document.getElementById("md").textContent.replace(/<\/(script)/gi, "</$1");
var html = DOMPurify.sanitize(marked.parse(raw, { gfm: true }));
document.getElementById("doc").innerHTML = html;
document.querySelectorAll("#doc pre code").forEach(function (el) { hljs.highlightElement(el); });
</script>
ماركداون بأناقة
عندك ملفّ README أو مواصفات أو ملاحظات إصدارٍ بصيغة Markdown؟ حوِّله إلى صفحة HTML واحدة أنيقة ومكتفية ذاتيًّا — مع إبراز الشيفرة وما إلى ذلك — وشاركها رابطًا في ثوانٍ.
ينشر pastehtml.dev شيئًا واحدًا: ملفّ HTML واحدًا. وماركداون ليس HTML —
لذا لمشاركة ملفّ .md نلفّه بقشرة HTML رفيعة تُصيِّر الماركداون داخل متصفّح
القارئ. يرافق نصُّ الماركداون الخامّ الملفَّ (يسهل عرض مصدره ونسخه)، وسكربتٌ صغير يحوّله إلى
الصفحة الأنيقة التي تراها.
ضمِّن نصّ الماركداون الخامّ في كتلة <script type="text/markdown"> غير قابلة
للتنفيذ ← حلِّله بمكتبة marked ← نظِّف الناتج بـ DOMPurify ←
لوِّن الشيفرة بـ highlight.js ← أفلِته في جسمٍ بأسلوب الكوميكس. تُحمَّل المكتبات
الثلاث من شبكة توصيل محتوى (CDN)، وهو أمرٌ مسموحٌ به صراحةً للصفحات المنشورة.
كيف تعمل
- يُخزَّن ماركداونك حرفيًّا في وسم
<script type="text/markdown">— لا ينفّذه المتصفّح أبدًا، وأيّ</script>بداخله يُهرَّب بأمان. - عند التحميل، تحوّل marked ذلك الماركداون (بنكهة GitHub: جداول، وقوائم مهامّ، وكتل شيفرة مسوَّرة) إلى HTML.
- تنظّف DOMPurify الـ HTML الناتج فتُزيل كلّ ما هو خطِر، فلا يمكن لمقطعٍ خبيثٍ في المصدر أن يُنفَّذ.
- تُبرَز كلّ كتلة شيفرة بـ highlight.js، وتجعل أنماط الكوميكس العناوينَ والجداول والاقتباسات تبرز للعيان.
جرِّبها. الصِق ماركداون بالأسفل وشاهده يُصيَّر مباشرةً؛ ثمّ ابنِ صفحةً مكتفيةً ذاتيًّا تنشرها.
مِسبَك الماركداون
تُصيَّر الصفحة في المتصفّح، لذا يحتاج القرّاء إلى تفعيل جافاسكربت. ثبِّت إصدارات الـ CDN (تفعل هذه
الأداة ذلك) كي لا تنكسر صفحتك حين تُصدر مكتبةٌ نسخةً رئيسيّةً جديدة. وأبقِها مكتفيةً ذاتيًّا — فالروابط
النسبيّة للصور لن تُحلَّ على النطاق المعزول للصفحة المنشورة، لذا استخدم روابط صورٍ كاملةً بـ https://
أو معرّفات بيانات (data URIs).
انشُرها
الخيار (أ) — السحب والإفلات
أفلِت ملفّ .html المُنزَّل على pastehtml.dev وانسخ
رابط https://<token>.pastehtml.dev/ الذي يمنحك إيّاه.
الخيار (ب) — واجهة الـ API (سطرٌ واحد)
صيَّرتَ ماركداونك إلى ملفّ مسبقًا؟ ارفعه مباشرةً من الطرفيّة:
curl -F "[email protected]" https://pastehtml.dev/api/pastes
ردُّ 201 يمنحك live_url القابل للمشاركة ورمز تحديثٍ update_token
يُكشَف مرّةً واحدة — احفظه لتحدِّث الرابط نفسه بـ PATCH حين يتغيّر المستند. الدليل الكامل:
pastehtml.dev/llms.txt.
يمكن للوكلاء تخطّي المِسبَك تمامًا: حوِّل الماركداون إلى هذه القشرة في الخادم ثمّ انشره عبر POST.
ما الذي تُضمِّنه الأداة
الملفّ المنشور ما هو إلا ماركداونك مضافًا إليه هذا المُصيِّر. وهذا هو قلبه — الشيفرة نفسها تعمل في المعاينة أعلاه وفي كلّ صفحةٍ تبنيها:
<script type="text/markdown" id="md">
# Your Markdown lives here, verbatim
</script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/marked.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/purify.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/highlight.min.js"></script>
<script>
var raw = document.getElementById("md").textContent.replace(/<\/(script)/gi, "</$1");
var html = DOMPurify.sanitize(marked.parse(raw, { gfm: true }));
document.getElementById("doc").innerHTML = html;
document.querySelectorAll("#doc pre code").forEach(function (el) { hljs.highlightElement(el); });
</script>