{"id":16380693,"url":"https://github.com/notslang/tidy-markdown","last_synced_at":"2025-09-05T06:31:39.552Z","repository":{"id":19152712,"uuid":"22383409","full_name":"notslang/tidy-markdown","owner":"notslang","description":"Beautify Markdown, fixing formatting mistakes and standardizing syntax","archived":false,"fork":false,"pushed_at":"2020-01-13T04:46:45.000Z","size":149,"stargazers_count":74,"open_issues_count":32,"forks_count":11,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-08-08T16:30:46.876Z","etag":null,"topics":["cli","markdown-equivalents"],"latest_commit_sha":null,"homepage":"https://npmjs.com/package/tidy-markdown","language":"CoffeeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/notslang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-07-29T14:47:07.000Z","updated_at":"2025-06-08T01:51:24.000Z","dependencies_parsed_at":"2022-07-26T23:46:20.227Z","dependency_job_id":null,"html_url":"https://github.com/notslang/tidy-markdown","commit_stats":null,"previous_names":["slang800/tidy-markdown"],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/notslang/tidy-markdown","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/notslang%2Ftidy-markdown","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/notslang%2Ftidy-markdown/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/notslang%2Ftidy-markdown/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/notslang%2Ftidy-markdown/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/notslang","download_url":"https://codeload.github.com/notslang/tidy-markdown/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/notslang%2Ftidy-markdown/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273722711,"owners_count":25156300,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-05T02:00:09.113Z","response_time":402,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","markdown-equivalents"],"created_at":"2024-10-11T03:52:10.182Z","updated_at":"2025-09-05T06:31:39.173Z","avatar_url":"https://github.com/notslang.png","language":"CoffeeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tidy Markdown\n\n[![Build Status](http://img.shields.io/travis/slang800/tidy-markdown.svg?style=flat-square)](https://travis-ci.org/slang800/tidy-markdown) [![NPM version](http://img.shields.io/npm/v/tidy-markdown.svg?style=flat-square)](https://www.npmjs.org/package/tidy-markdown) [![NPM license](http://img.shields.io/npm/l/tidy-markdown.svg?style=flat-square)](https://www.npmjs.org/package/tidy-markdown)\n\nBeautify Markdown, fixing formatting mistakes and converting basic HTML \u0026 Unicode into their Markdown equivalents. Based on the conventions in [Carrot Creative's Markdown Styleguide](https://github.com/carrot/markdown-styleguide) and built on [Marked](https://github.com/chjj/marked).\n\nThere is also an [Atom Plugin](https://atom.io/packages/tidy-markdown) to run this entirely within your editor.\n\n## Install\n\nTidy Markdown is an [npm](http://npmjs.org/package/tidy-markdown) package, so it can be installed like this:\n\n```bash\nnpm install tidy-markdown -g\n```\n\n## CLI\n\nTidy Markdown includes a simple CLI. It operates entirely over STDIN/STDOUT. For example:\n\n```bash\n$ echo \"# a header #\" | tidy-markdown\n# a header\n```\n\nOr using a file:\n\n```bash\n$ tidy-markdown \u003c ./ugly-markdown\n# Some markdown\n\nLorem ipsum dolor adipiscing\n\n- one\n- two\n- three\n```\n\nAnd, of course, we can output to a file too:\n\n```bash\n$ tidy-markdown \u003c ./ugly-markdown \u003e ./clean-markdown\n```\n\n### Editing In-place\n\nIf you want to rewrite a file in-place, you can use `sponge` from [moreutils](https://joeyh.name/code/moreutils/). If you did `tidy-markdown \u003c ./README.md \u003e ./README.md` you'd end up with an empty file.\n\n```bash\n$ tidy-markdown \u003c ./README.md | sponge ./README.md\n```\n\n### Docs\n\nThe `--help` arg will make it show a usage page:\n\n```\n$ tidy-markdown --help\nusage: tidy-markdown [-h] [-v] [--no-ensure-first-header-is-h1]\n\nFix ugly markdown. Unformatted Markdown is read from STDIN, formatted, and\nwritten to STDOUT.\n\nOptional arguments:\n  -h, --help            Show this help message and exit.\n  -v, --version         Show program's version number and exit.\n  --no-ensure-first-header-is-h1\n                        Disable fixing the first header when it isn't an H1.\n                        This is useful if the markdown you're processing\n                        isn't a full document, but rather a piece of a larger\n                        document.\n```\n\n## API\n\nTidy Markdown only exports one function. Here's an example of how it can be used:\n\n```coffee\ntidyMarkdown = require 'tidy-markdown'\n\nuglyMarkdown = '''\n# Some markdown #\n\nLorem ipsum dolor adipiscing\n\n\n- one\n*  two\n+ three\n'''\n\ncleanMarkdown = tidyMarkdown(uglyMarkdown)\nconsole.log cleanMarkdown\n```\n\nwhich outputs:\n\n```markdown\n# Some markdown\n\nLorem ipsum dolor adipiscing\n\n- one\n- two\n- three\n```\n\nYou can also pass options through a 2nd arg, like `tidyMarkdown(uglyMarkdown, {ensureFirstHeaderIsH1: false})`. The option `ensureFirstHeaderIsH1` is the only one right now.\n\n## Features\n\n- Standardize syntactical elements to use a single way of being written (for example, all unordered lists are formatted to start with hyphens, rather than allowing asterisks and/or addition signs to be mixed in).\n- Fix numbering - making ordered lists count naturally from 1 to _n_ and reference links do the same (based on first occurance).\n- Make headers move from `h1` to smaller without gaps (like an `h1` followed by an `h4` would be corrected to an `h1` followed by an `h2`).\n- Decode Unicode characters that have markdown equivalents (like a horizontal ellipsis becomes \"...\" and an em-dash becomes \"--\").\n- Format YAML front-matter and Markdown tables.\n- Convert HTML elements into their Markdown equivalents. For example, `\u003cem\u003etext\u003c/em\u003e` becomes `_text_`.\n\n## Minimal Configuration\n\nTidy Markdown works hard to keep configuration to a minimum. The goal is to create a highly readable, canonical representation of Markdown, much like [gofmt](https://golang.org/cmd/gofmt/) has done for Go. Having extra configuration would defeat that purpose and add extra maintenance work.\n\nThat's not to say you shouldn't open issues if you find the output ugly, that's encouraged, especially in the [styleguide repo](https://github.com/slang800/markdown-styleguide) because without criticism it won't get better. However, you should provide examples and a good argument to support the change.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnotslang%2Ftidy-markdown","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnotslang%2Ftidy-markdown","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnotslang%2Ftidy-markdown/lists"}