You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+21-3Lines changed: 21 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -137,6 +137,24 @@ Here's a few pointers to get you started:
137
137
138
138
## Frequently Asked Questions
139
139
140
+
### Why does mdformat backslash escape special syntax specific to MkDocs / Hugo / Obsidian / GitHub / some other Markdown engine?
141
+
142
+
Mdformat is a CommonMark formatter.
143
+
It doesn't have out-of-the-box support for syntax other than what is defined in [the CommonMark specification](https://spec.commonmark.org/current/).
144
+
145
+
The custom syntax that these Markdown engines introduce typically reinvents the meaning of
146
+
angle brackets, square brackets, parentheses, hash characters — characters that have a special meaning in CommonMark.
147
+
Mdformat often resorts to backslash escaping these characters to ensure the formatting changes it makes never alters a rendered document.
148
+
149
+
Additionally some engines, namely MkDocs, [do not support](https://github.com/mkdocs/mkdocs/issues/1835) CommonMark to begin, so incompatibilities are unavoidable.
150
+
151
+
Luckily mdformat is extensible by plugins.
152
+
For many Markdown engines you'll find support by searching
or [mdformat GitHub topic](https://github.com/topics/mdformat).
155
+
156
+
You may also want to consider a documentation engine that adheres to CommonMark as its base syntax e.g. [mdBook](https://rust-lang.github.io/mdBook/) or [Sphinx with Markdown](https://www.sphinx-doc.org/en/master/usage/markdown.html).
157
+
140
158
### Why not use [Prettier](https://github.com/prettier/prettier) instead?
141
159
142
160
Mdformat is pure Python code!
@@ -157,10 +175,10 @@ according to the author themselves,
157
175
is [inferior to markdown-it](https://github.com/remarkjs/remark/issues/75#issuecomment-143532326) used by mdformat.
158
176
`remark-parse` v9.x is advertised as CommonMark compliant
159
177
and presumably would fix many of the issues,
160
-
but is not used by Prettier (v2.4.0) yet.
178
+
but is not used by Prettier (v3.3.3) yet.
161
179
162
-
Prettier (v2.4.0), being able to format many languages other than Markdown,
163
-
is a large package with 65 direct dependencies
180
+
Prettier (v3.3.3), being able to format many languages other than Markdown,
0 commit comments