Markdown
viewer.
Write or paste Markdown and see it formatted as you type, then copy the clean HTML.
Website relaunch
The new site goes live on November 18. This page tracks what is left and who owns it.
To do
- Write the page copy
- Add product screenshots
- Test the contact form on phones
Keep every page under 2 MB so it loads fast on a phone.
Owners
| Task | Owner | Due |
|---|---|---|
| Screenshots | Priya | Nov 10 |
| Form testing | Marcus | Nov 12 |
Deploy
Run the build, then copy the out folder to the server:
npm run build
Questions go to the project board.
83 words under 4 headings, with 1 list and 1 table. The headings step down one level at a time, and every link is a web, email or page link.
Document map
4 sections; the longest is “To do” with 27 words. Each bar is the words under a heading, up to the next heading. Pick a row to select that heading in the source.
Outline
| Heading | ||
|---|---|---|
| H1 | 19 | |
| H2 | 27 | |
| H2 | 12 | |
| H2 | 19 |
Table builder
Copy cells from a spreadsheet and paste them into the grid. The first row becomes the header.
| # | Column 1 | Column 2 | Column 3 |
|---|---|---|---|
| 1 | |||
| 2 | |||
| 3 |
| Release | Platform | Date | | --- | --- | --- | | 2.4 | iOS \| Android | Nov 3 | | 2.5 | Web | Dec 1 |
Keyboard shortcuts
- Ctrl or ⌘ + B makes the selection bold.
- Ctrl or ⌘ + I makes it italic.
- Ctrl or ⌘ + K turns it into a link and selects the address.
- Ctrl or ⌘ + E marks it as code.
- They work while the Markdown box has focus, as in GitHub's editor.
How it's worked out
The viewer reads your text one line at a time. A line that starts with # is a heading, a line that starts with a dash or a number is a list item, three backticks open and close a code block, and a line of pipes with a row of dashes under it starts a table. Everything else is a paragraph, and lines with no blank line between them join into one paragraph.
Before any formatting, every character that could start HTML is escaped. That is why <script>alert(1)</script> comes out as the text <script>alert(1)</script> and never runs. Link addresses must start with http, https, mailto, # or /, an allow-list of the kind the OWASP cheat sheet on cross-site scripting recommends. Any other address, such as javascript:, is replaced by #.
Inline marks follow CommonMark: two asterisks for bold, one for italic, backticks for code. **Hello**, *world* becomes <p><strong>Hello</strong>, <em>world</em></p>. Tables, task lists and strikethrough follow GitHub Flavored Markdown.
The page already has its own main title, so the preview moves each heading down one level: # Title shows as <h2 class="md-h1">Title</h2>, styled like a top heading. When you copy or export, the HTML keeps your real levels.
The word count strips Markdown symbols and code blocks, then counts what is left. Reading time divides it by 238 words a minute, the average for silent reading of nonfiction in a 2019 review by Marc Brysbaert.
Worked examples
A README with a skipped heading
A developer writes a README for a small map tool. Under "Usage" (8 words) the options go under #### Options. The structure check flags that heading: it jumps from level 2 to level 4. A table of contents or a screen reader would show a gap there. Changing it to ### Options fixes it. The map also shows that the options section, at 14 words, is the longest part of the file.
A release plan from a spreadsheet
A project lead copies 3 rows and 3 columns from a sheet into the table builder. One cell reads "iOS | Android", and a bare pipe would split it into two columns. The builder escapes it, so the table reads:
| Release | Platform | Date | | --- | --- | --- | | 2.4 | iOS \| Android | Nov 3 | | 2.5 | Web | Dec 1 |
Rendered, it has 6 body cells, the same as the sheet, with "iOS | Android" kept in one cell. Insert at the cursor drops it into the document with a blank line on each side.
An email pasted with its HTML
A support agent pastes a shipping update that still carries its email markup. The check counts 4 HTML tags, the opening and closing div and b tags, and shows them as text. Of the 2 links, 1 uses javascript:, so the preview points it at # and the check says so. The carrier link keeps its address.
Reading your result
The status panel gives the word count, the reading time and whether the document is saved. "Saved in this browser" means the text sits in this browser's local storage on this device. It stays after a reload, but it is not on your other devices.
The sentence under the figures is the structure check. Headings should step down one level at a time, as the W3C heading tutorial advises, because tables of contents and screen readers build their lists from them. One # heading per document is usual for a README or an article. A section pasted from a longer file often starts at ##, so a missing # title is not flagged.
The document map draws a bar for each section, sized by the words under that heading. The longest bar is brass. A section far longer than the rest is often two topics. Pick any row to jump to that heading in the source.
Images show as links in the preview, because loading a picture from another site would tell that site you opened the page. HTML tags show as text for the same safety reason. If you need either one, paste the copied HTML into a page that allows it.
Common mistakes
- No blank line before a list or table. Many renderers, GitHub's among them, read a list typed right under a paragraph as part of that paragraph. Leave a blank line before lists, tables and code blocks.
- Expecting one Enter to start a new line. Two lines with no blank line between them join into one paragraph. Leave a blank line to start a new paragraph.
- A table without its dash row. The second line of a table must be dashes between pipes, such as
| --- | --- |. Without it the rows show as plain text. - A bare pipe inside a cell. It starts a new column. Write
\|instead, or let the table builder do it. - Nested lists and footnotes. This viewer shows the common subset used in READMEs and notes. Indented sub-items show as one flat list, and footnotes stay as typed.