About Markdown to HTML Converter
Markdown is a lightweight markup syntax designed to be readable as plain text while also converting cleanly into HTML. It was created to let people write formatted documents — READMEs, forum posts, documentation, blog drafts, chat messages — without touching HTML tags directly, using conventions like `# ` for a heading or `**bold**` for emphasis that most people pick up within minutes. It has since become the default authoring format for GitHub, GitLab, most static site generators, developer forums, and countless chat and note-taking apps, which makes converting a chunk of Markdown into ready-to-paste HTML a genuinely common task.
This tool includes a small, hand-written Markdown parser and renderer, built from scratch rather than pulling in a library like `marked.js` or `markdown-it`. It walks the input line by line and block by block, recognising ATX-style headings (`#` through `######`), bold (`**text**` or `__text__`) and italic (`*text*` or `_text_`) inline emphasis, inline code spans (`` `code` ``), fenced code blocks (triple backticks, with the language hint after the opening fence preserved as a class but not syntax-highlighted), links (`[text](url)`), images (``), unordered lists (`-`, `*`, or `+` bullets), ordered lists (`1.`, `2.`, …), blockquotes (`>`), horizontal rules (`---`, `***`, or `___` on their own line), and paragraphs separated by blank lines.
Be honest with yourself about scope: this is a compact, common-case converter, not a full CommonMark or GitHub Flavored Markdown implementation. Nested lists (a bullet list inside another bullet list, or a list inside a blockquote), tables, footnotes, definition lists, strikethrough, task-list checkboxes, and reference-style links (`[text][ref]` with a separate `[ref]: url` definition) are not supported — a best-effort attempt is made to render them as plain paragraphs rather than crashing, but the structure will not be preserved. For anything beyond the common-case list above, a full Markdown library is the right tool; this converter is aimed at quick one-off conversions of straightforward documents.
Security is treated as a first-class concern, not an afterthought. Markdown input frequently comes from untrusted or semi-trusted sources — a colleague's pasted text, a scraped README, a form submission — and Markdown itself permits raw HTML to be embedded inline. If that raw HTML were passed straight through into the rendered preview, a `<script>` tag typed into the input box would execute in your browser the moment the preview updated, which is a textbook cross-site scripting vulnerability. This tool avoids that entirely: text content is never inserted into the preview as raw HTML. Instead, the parser extracts structure (this is a heading, this is a paragraph, this is a link with this text and this href) and every text fragment is HTML-escaped (`&`, `<`, `>`, `"` converted to entities) before the tool's own safe tags are wrapped around it. The output HTML you see and copy is built entirely from the tool's own template strings — the parser never concatenates a user's raw text into an unescaped position, so anything that looks like an HTML tag in your Markdown source is rendered as visible text in the output, not executed as a tag.