@@ -1774,4 +1774,55 @@ class Test {}
17741774""" ;
17751775 doFormatTest (input , expected );
17761776 }
1777+
1778+ // TODO: b/346668798 - Test the following Markdown constructs, and make the tests work as needed.
1779+ // We can assume that the CommonMark parser correctly handles Markdown, so the question is whether
1780+ // they are subsequently mishandled by our formatting logic. So for example the CommonMark parser
1781+ // already recognizes <pre>...</pre> and doesn't look for Markdown constructs within such a block,
1782+ // so we should not need to check that that is handled correctly, given that we already check
1783+ // <pre> handling elsewhere. On the other hand, if we don't handle Markdown code spans (`...`)
1784+ // correctly then we might incorrectly recognize HTML tags like `<ul>` inside them.
1785+ //
1786+ // - Backslashes
1787+ // - \<br> is not a break.
1788+ // - \* is not an HTML entity.
1789+ // - \⏎ is a hard line break. https://spec.commonmark.org/0.31.2/#hard-line-break
1790+ // A hard line break can also be written as two or more spaces followed by a newline. I think
1791+ // that is ridiculous and it is absolutely fine to destroy those spaces. However the line
1792+ // break will show up in the CommonMark parse.
1793+ //
1794+ // - Thematic breaks: ---, ***, ___, which are all rendered as <hr> and should presumably have a
1795+ // line break before and after. https://spec.commonmark.org/0.31.2/#thematic-breaks
1796+ //
1797+ // - Setext headings: text, not necessarily all on one line, followed by a line with only hyphens
1798+ // or equals signs. We need to preserve the line breaks before and after that line.
1799+ // https://spec.commonmark.org/0.31.2/#setext-headings
1800+ //
1801+ // - Indented code blocks
1802+ // Clearly evil, but we should not mangle them. *Maybe* rewrite them as fenced code blocks? But
1803+ // I'm sure there are lots of tricky cases, like if the indented code block includes ```.
1804+ // https://spec.commonmark.org/0.31.2/#indented-code-blocks
1805+ //
1806+ // - Link reference definitions should not be joined onto previous lines.
1807+ // [foo]: /url "title"
1808+ // https://spec.commonmark.org/0.31.2/#link-reference-definitions
1809+ //
1810+ // - Loose lists
1811+ // "A list is loose if any of its constituent list items are separated by blank lines, or if any
1812+ // of its constituent list items directly contain two block-level elements with a blank line
1813+ // between them."
1814+ // We should test that we do not remove blank lines from a loose list, which would make it a
1815+ // tight one. https://spec.commonmark.org/0.31.2/#loose
1816+ //
1817+ // - Block quotes
1818+ // > foo
1819+ // > bar
1820+ // We need to ensure that each > stays at the start of its line with appropriate indentation if
1821+ // inside a list. https://spec.commonmark.org/0.31.2/#block-quotes
1822+ //
1823+ // - Code spans
1824+ // `<ul>` should not trigger list handling. https://spec.commonmark.org/0.31.2/#code-spans
1825+ //
1826+ // - Autolinks
1827+ // <http://example.com> should be preserved. https://spec.commonmark.org/0.31.2/#autolink
17771828}
0 commit comments