Urgent.News

What's breaking now, across thousands of outlets.

Tech

Markdown Is Not HTML, But It Was Born to Become It

Markdown Is Not HTML, But It Was Born to Become It Every README, every GitHub issue, every docs page you have ever written in Markdown ends up as HTML. That is not an accident. Markdown was designed in 2004 by John Gruber as a writing syntax that converts cleanly to HTML, nothing more. If you have ever wondered what actually happens between the # you type and the <h1> the browser renders, this…

Markdown is a writing syntax that converts cleanly to HTML. It was designed in 2004 by John Gruber as a simple way to format text that becomes HTML when rendered. Each Markdown construct maps directly to a single HTML element. For example, a title written with # becomes an h1 tag, bold text with ** becomes a strong tag, and a list item with - becomes a list item tag inside an unordered list.

The conversion process is straightforward. A Markdown-to-HTML converter reads the Markdown, understands the structure line by line, and outputs the corresponding HTML tags. No magic is involved, and no server is required. This conversion happens purely through text processing, which is why it can be done instantly in a browser.

GitHub Flavored Markdown, as used by platforms like GitHub and Dev.to, expands upon plain Markdown. It adds support for tables, task lists, and autolinks. A table written with pipes (|) becomes a real HTML table with thead and tbody, rather than a picture of a table. A checklist written with checkmarks becomes a list item with a checked checkbox. And a bare URL becomes a clickable link without any extra syntax.

However, not all Markdown converters handle these additional features. If a converter fails to handle tables, task lists, or autolinks, it is essentially converting 2004 Markdown, not the Markdown used today.

A key safety consideration is that a converter that passes raw HTML through will also pass a script tag. If you paste a document containing a script tag into such a converter and copy the output into your content management system, you could inadvertently ship executable code to your readers. To prevent this, a safe converter should escape source HTML before parsing, ensuring that only tags generated by the parser itself appear in the output.

This is crucial when pasting Markdown written by others into your own site, as it can help prevent malicious code from being executed.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

I made ER diagrams with the fewest line crossings, and proved it

I was modelling the ER diagram for a new project, and it got messy quickly once I had to share it with other people. Lines crossed everywhere, and nobody could follow which table pointed where.

  • Author developed ER diagram layout tool called erlayout
  • Tool minimizes line crossings and proves optimality
  • Demonstrated 2 crossings for Sakila database vs 8 standard

Let your computer read your draft back to you

I can reread a paragraph five times and still miss the word I typed twice. My eyes know what I meant to write, so they fill in the gaps. My ears are much less forgiving.

  • Computer text-to-speech reveals draft errors
  • Convert Markdown to plain text for reading
  • Automate reading process for consistent edits

More from Saturday 31 October →