Word and Character Counts for UI Copy, SEO, and Reviews
How to count words and characters the way products and platforms do — limits, diffs, Markdown pitfalls, and a practical editing workflow for developers who ship copy.
A practical GFM workflow for developers — preview Markdown safely, convert HTML when needed, and understand the caveats of Markdown ↔ HTML round-trips.
By codefunc
Markdown is the default for READMEs, docs sites, PR descriptions, and many CMS fields. HTML is what browsers and email clients actually render. Moving between them looks trivial until tables, nested lists, or inline HTML diverge across parsers. A solid preview-and-convert workflow saves review cycles and prevents "it looked fine in my editor" bugs.
Bottom line: Author in GitHub Flavored Markdown (GFM) when your destination is GitHub, many static site generators, or GFM-compatible docs. Preview before you merge. Treat HTML → Markdown as a lossy import, not a perfect round-trip. Beautify HTML when you need to read structure — not as a substitute for semantic cleanup.
Developers writing docs, changelog entries, blog drafts, or CMS content who bounce between Markdown sources and HTML previews. Designers and PMs who paste rich text into Markdown fields will hit the same round-trip issues.
CommonMark is the widely adopted base spec. GitHub Flavored Markdown extends it with features teams rely on daily:
| Feature | CommonMark | GFM |
|---|---|---|
| Headings, lists, emphasis, links, code | Yes | Yes |
| Fenced code blocks | Yes | Yes |
| Tables | No (extensions vary) | Yes |
Task lists - [ ] |
No | Yes |
Strikethrough ~~ |
No | Yes |
| Autolinks for URLs | Limited | Yes |
| Disallowed raw HTML (sanitized on GitHub) | N/A | Sanitized render |
If your pipeline claims "Markdown" but means a different dialect (old Markdown.pl, strict CommonMark without tables, MDX), previews will disagree. Align the preview engine with the shipping renderer.
Use the Markdown Preview tool to render GFM-style content locally in the browser — useful when you are offline, reviewing a snippet from chat, or do not want to push a branch just to see formatting.
Example GFM snippet:
## Release notes
- [x] Ship formatter fixes
- [ ] Update docs screenshots
| Env | URL |
|-----|-----|
| Staging | `https://staging.example.com` |
| Prod | `https://example.com` |
Inline code uses `backticks`. Fenced blocks specify a language:
~~~ts
export function greet(name: string) {
return `Hello, ${name}`;
}
~~~
## then ####)|---|Markdown is not ideal for:
In those cases, keep a Markdown source of truth when possible, and emit HTML at the boundary (static site generator, MDX, or a documented convert step). When you inherit HTML and need a maintainable draft, convert carefully.
The HTML to Markdown converter is for import and cleanup, not bit-perfect archival.
| HTML construct | Typical Markdown result | Caveat |
|---|---|---|
<h2>, <p>, <ul> |
Headings, paragraphs, lists | Usually clean |
<table> |
GFM table | Complex rowspan/colspan often flatten |
<div class="…"> |
Often dropped or flattened | Classnames and layout lost |
| Inline styles | Usually stripped | Visual design does not survive |
<span> wrappers |
May disappear | Semantic/CSS hooks gone |
| Comments / scripts | Removed or unsafe to keep | Good — do not round-trip scripts |
Workflow that works:
Round-trip test: HTML → Markdown → HTML will rarely match the original DOM. Optimize for readable source, not DOM equality.
Messy minified HTML is hard to diff in PR review. The HTML Beautifier expands structure so you can see nesting, stray tags, and accidental inline scripts before you convert or ship.
Use beautify when:
main, article, headings)Do not beautify as a production optimization — formatting whitespace can matter in rare cases (inline elements, <pre>, some email clients). Beautify for humans; let your bundler or email inliner handle shipping format.
MDX and component-heavy docs look like Markdown but are not portable to a plain GFM preview:
<Callout type="warning">Do not paste API keys.</Callout>
A standard Markdown preview will show that as a paragraph or fail. Strategy:
| Situation | Prefer |
|---|---|
| GitHub README / PR body | GFM + Markdown Preview for snippets |
| Inherited marketing HTML | HTML Beautifier then HTML to Markdown |
| Email template | Stay in HTML; do not force Markdown |
| API docs with tables | GFM tables; verify in preview |
| Blog on a static site | Match the site's Markdown engine (often CommonMark + GFM tables) |
Keep secrets out of public Markdown (tokens in sample curl commands). Prefer placeholders like YOUR_API_KEY.
Write toward the dialect you ship — usually GFM for GitHub-centric teams. Preview before merge with Markdown Preview. When importing legacy pages, beautify with HTML Beautifier, convert with HTML to Markdown, then fix tables and structure by hand. Assume Markdown ↔ HTML round-trips are lossy, and keep Markdown as the editable source whenever you can.
How to count words and characters the way products and platforms do — limits, diffs, Markdown pitfalls, and a practical editing workflow for developers who ship copy.
How to use Lorem Ipsum, fake user data, and Markdown fixtures effectively — when placeholder text helps layouts, when it hides product problems, and how to generate it locally.
When to use XPath vs CSS selectors, how to write stable queries, and a browser-side workflow for testing against real HTML without shipping brittle scrapers.
Find a developer tool