Markdown to HTML conversion എന്നത് എന്താണ്?
Markdown minimal punctuation (# headings-ന്, * emphasis-ന്, - list items-ന്) ഉൾക്കൊണ്ട് structured prose encode ചെയ്യുന്ന ഒരു lightweight plain-text format ആണ്. GitHub Flavored Markdown (GFM) tables, strikethrough, task lists, autolinks ഉൾക്കൊണ്ട് CommonMark extend ചെയ്യുന്നു. HTML ബ്രൗസർ display ചെയ്യുന്ന rendered form ആണ്. Markdown HTML-ലേക്ക് convert ചെയ്ത് lightweight syntax-ൽ author ചെയ്ത് rendered surface-ലേക്ക് ship ചെയ്യാം — README, static-site page, email body — tags കൈകൊണ്ട് എഴുതേണ്ടതില്ല.
Supported GitHub Flavored Markdown features ഏതൊക്കെ?
Bundled marked@12.0.2 parser full GFM superset support ചെയ്യുന്നു: ATX-style headings # through ######, ordered, unordered lists nesting ഉൾക്കൊണ്ട്, bold **text**, italic *text*, strikethrough ~~text~~, inline links [text](url), inline images , fenced code blocks (```js), inline code `code`, pipe tables with header rows, GFM task lists - [ ] / - [x], blockquotes >, horizontal rules ---, autolinks. ഓരോ element-ഉം preview pane-ൽ GitHub render ചെയ്യുന്നതു പോലെ render ആകുന്നു.
Markdown to HTML conversion എങ്ങനെ പ്രവർത്തിക്കുന്നു?
ഓരോ conversion-ഉം രണ്ട് bundled libraries ഉൾക്കൊണ്ട് ബ്രൗസറിൽ locally run ആകുന്നു — CDN ഇല്ല, fetch ഇല്ല, telemetry ഇല്ല. High-level steps:
- Parse:
marked.parse(source)Markdown വായിച്ച് HTML string produce ചെയ്യുന്നു. Parser GFM mode-ൽ run ആകുന്നു, tables, task lists, strikethrough, autolinks ഒക്കെ recognise ആകുന്നു. - Sanitize: HTML output
innerHTML-ന് assign ചെയ്യുന്നതിന് മുൻപ്DOMPurify.sanitize(html, { USE_PROFILES: { html: true } })ഉൾക്കൊണ്ട് run ആകുന്നു. DOMPurify Mozilla MDN, Atlassian, Microsoft 365 ഉപയോഗിക്കുന്ന XSS sanitizer ആണ് — HTML parse ചെയ്ത്, DOM walk ചെയ്ത്,<script>elements,on*event handler attributes,javascript:URI schemes remove ചെയ്യുന്നു. - Render: sanitized HTML preview pane-ൽ
innerHTMLഉൾക്കൊണ്ട് write ചെയ്യുന്നു. Raw HTML read-only<textarea>ഉൾക്കൊണ്ട് second pane-ൽ surface ചെയ്ത് markup copy ചെയ്യാം. Live mode 150 ms debounce ഉൾക്കൊണ്ട് type ചെയ്യുന്നതിനിടെ parser thrash ചെയ്യാതെ preview update ചെയ്യുന്നു.
ഈ ടൂൾ ഉൾക്കൊണ്ട് Markdown to HTML convert ചെയ്യേണ്ടത് എന്തുകൊണ്ട്?
- സ്വകാര്യത: ഓരോ parse, sanitize, render pass-ഉം ബ്രൗസറിൽ. Markdown — unreleased blog posts, internal documentation drafts, confidential README content ഉൾക്കൊണ്ടവ — server-ലേക്ക് ഒരിക്കലും reach ആകില്ല.
- XSS-safe by default: rendered preview pane ഓരോ HTML string-ഉം
innerHTML-ന് മുൻപ് DOMPurify ഉൾക്കൊണ്ട് run ആകുന്നു. Markdown-ൽ stray<script>tag അല്ലെങ്കിൽonerror=handler ഉണ്ടെങ്കിൽ inert preview — execute ആകില്ല. Raw pane unsanitized output inspection-ന് show ചെയ്യുന്നു,<textarea>-ൽvalueഉൾക്കൊണ്ട് — ഒരിക്കലും execute ആകില്ല. - GFM-complete: tables, strikethrough, task lists, autolinks ഒക്കെ GitHub render ചെയ്യുന്ന രീതിയിൽ render ആകുന്നു. Markdown pipe-table
<thead>,<tbody>ഉൾക്കൊണ്ട് HTML<table>ആകുന്നു — dropped rows ഇല്ല, flattened structure ഇല്ല.
Markdown to HTML conversion-ന്റെ സാധാരണ ഉപയോഗങ്ങൾ ഏതൊക്കെ?
Markdown HTML-ലേക്ക് convert ചെയ്യൽ documentation, static-site work, email authoring ഉടനീളം കാണുന്നു:
- GitHub README authoring: project README Markdown ആക്കി locally draft ചെയ്ത് push ചെയ്യുന്നതിന് മുൻപ് rendered HTML preview ചെയ്യൽ. Preview tables, task lists, fenced code-ന് GitHub-ന്റെ GFM renderer-ന് match ചെയ്യുന്നു.
- Static-site content: Markdown post paste ചെയ്ത് Markdown source-ന് പകരം markup expect ചെയ്യുന്ന CMS field അല്ലെങ്കിൽ templating engine-ന് HTML grab ചെയ്യൽ.
- Email templates: transactional-email body Markdown ആക്കി write ചെയ്ത് email service provider-ന്റെ templating engine-ന് HTML-ലേക്ക് convert. Output plain semantic HTML — inline styles ഇല്ല, email-client quirks ഇല്ല.
Markdown to HTML ഉദാഹരണം എങ്ങനെ?
# Title\n\n- item 1\n- item 2\n\n[link](https://example.com) paste ചെയ്ത് <h1>Title</h1>, two-item unordered list, <a href="https://example.com">link</a> ഉൾക്കൊള്ളുന്ന preview pane produce ചെയ്യുന്നു. Raw pane exact HTML string show ചെയ്ത് template-ൽ copy-paste ചെയ്യാം. |---|---| alignment row ഉൾക്കൊണ്ട് pipe table <thead>, <tbody> ഉൾക്കൊണ്ട് full <table> ആകുന്നു — GFM tables GitHub render ചെയ്യുന്ന രീതിയിൽ render ആകുന്നു.
ഈ Markdown to HTML converter ബ്രൗസറിൽ run ആകുമോ?
അതെ. ഓരോ parse, sanitize, render pass-ഉം browser tab-ൽ JavaScript ആക്കി locally run ആകുന്നു. Bundled libraries — marked@12.0.2, DOMPurify@3.1.7 — page-ന്റെ same origin-ൽ ship ചെയ്ത് — CDN ഇല്ല, fetch ഇല്ല, XMLHttpRequest ഇല്ല, navigator.sendBeacon ഇല്ല. Page load ആയ ശേഷം offline work ചെയ്യുന്നു. Unreleased posts, internal docs, confidential READMEs device-ൽ.
Rendered preview pane XSS-safe ആണോ?
അതെ. innerHTML-ന് assign ചെയ്യുന്ന ഓരോ HTML string-ഉം ആദ്യം DOMPurify.sanitize(html, { USE_PROFILES: { html: true } }) ഉൾക്കൊണ്ട് pass ആകുന്നു. DOMPurify Cure53 maintain ചെയ്യുന്ന open-source XSS sanitizer; Mozilla MDN, Atlassian, Microsoft 365 ഉപയോഗിക്കുന്ന library. Default html profile <script> elements, on* event-handler attributes (onerror, onclick etc.), javascript: URI schemes inside href / src, known-dangerous CSS expressions remove ചെയ്യുന്നു. <img src=x onerror=alert(1)> paste ചെയ്ത് inert preview, alert fire ആകില്ല.
GFM tables supported ആണോ?
അതെ. Markdown → HTML direction marked-ന്റെ GFM mode ഉൾക്കൊണ്ട് pipe tables natively handle ചെയ്യുന്നു — header row |---|---| alignment row ഉൾക്കൊണ്ട് separate ചെയ്ത് data rows follow ചെയ്ത് <thead> + <tbody> ഉൾക്കൊണ്ട് <table> produce ചെയ്യുന്നു. Strikethrough (~~text~~ → <del>text</del>), task lists (- [ ] / - [x] → <input type="checkbox">) GitHub render ചെയ്യുന്ന പ്രകാരം render ആകുന്നു.
Markdown losslessly convert ആകുമോ?
Canonical GFM feature set-ന് — headings h1 through h6, ordered, unordered lists nesting ഉൾക്കൊണ്ട്, bold / italic / strikethrough, inline links, images, fenced code blocks with language tags, inline code spans, pipe tables, task lists, blockquotes, horizontal rules, autolinks — HTML output stable, GitHub renderer-ൻ match ചെയ്യുന്നു. Knowing-worth behaviours: raw inline HTML Markdown-ൽ (e.g. <sub>text</sub>) output-ൽ unchanged pass ആകുന്നു; CommonMark setext headings (=== underlines), ATX headings (# Title) ഒരേ <h1> produce ചെയ്യുന്നു. ഇവ documented marked behaviours ആണ്, bugs അല്ല. Reverse direction — rendered HTML Markdown-ലേക്ക് — ആണ് വേണ്ടതെങ്കിൽ HTML to Markdown ടൂൾ ഉപയോഗിക്കുക.
Fenced code blocks-ൽ syntax highlighting supported ആണോ?
v1-ൽ ഇല്ല. Fenced code blocks monospaced font, subtle background ഉൾക്കൊണ്ട് render ചെയ്യുന്നു, per-language token highlighting ഇല്ല. Syntax highlighting add ചെയ്യൽ Prism അല്ലെങ്കിൽ highlight.js bundle ചെയ്യണം — ഓരോന്നും 15–40 KB add ചെയ്ത് per-language grammar file, Workshop Terminal palette-ൽ align ചെയ്യേണ്ട theme matrix. ഇപ്പോൾ renderer correctness, XSS-safety-ൽ focus ചെയ്യുന്നു; user demand ഉണ്ടെങ്കിൽ opt-in toggle tractable follow-up.
ഈ Markdown to HTML Converter marked@12.0.2, DOMPurify@3.1.7 same origin-ൽ bundled ആക്കി ship ചെയ്ത്, full GFM feature set support ചെയ്ത്, DOM touch ആകുന്നതിന് മുൻപ് ഓരോ rendered HTML string-ഉം sanitize ചെയ്യുന്നു. Upload ഇല്ല, CDN ഇല്ല, telemetry ഇല്ല — ഓരോ byte-ഉം ബ്രൗസറിൽ.