Whenever I start a paragraph with "1." it gets converted into a numbered list.
Can I somehow escape the 1 to make markdown treat it as regular text?
As documented in the CommonMark Spec, you can escape it with a backslash before the period.
1\. Example
See:
1. Example
I don't know of any way to escape it, but you can easily trick the parser:
1. Do you want this?
2.<!---->
Here's how.
3.<!>
You can also use invalid HTML.
4.<z>
There are a number of variations of bad HTML that work.
<!---->
(4 hyphens) would be a valid HTML comment. <!--->
(3 hyphens) is not, so markdown removes it. Something like <idontwantlist>
would work too.
<!>
seems to work fine for me.
<!>
is not a legal construct in any flavor of HTML, neither HTML5 nor SGML HTML (or SGML, really). Not even XML, which shares the same comment syntax as HTML. If you're used to writing markup the Right Way™, such invalid constructs don't usually spring to mind.
Commented
Apr 29, 2016 at 16:37
The original Markdown rules (by the creator of Markdown) address this directly:
It’s worth noting that it’s possible to trigger an ordered list by accident, by writing something like this:
1986. What a great season.
In other words, a number-period-space sequence at the beginning of a line. To avoid this, you can backslash-escape the period:
1986\. What a great season.
Why escape the period/dot and not the number? The rules later state:
Markdown provides backslash escapes for the following characters:
\ backslash ` backtick * asterisk _ underscore {} curly braces [] square brackets () parentheses # hash mark + plus sign - minus sign (hyphen) . dot ! exclamation mark
Notice that the dot is listed as an escapable character, however, numbers are not on the list. Therefore, you have to escape the period.
1:
,2:
and so on.1.