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
Add tests for parsing of inline HTML when rendering markdown as HTML (#1379)
* Add test about parsing inline HTML except for comments
* Extract inner HTML parsing code into a private function
* Fix minor spelling in code comment
Co-authored-by: Pat Shaughnessy <pat_shaughnessy@apple.com>
---------
Co-authored-by: Pat Shaughnessy <pat_shaughnessy@apple.com>
rendering:"This is a <!-- inline comment --><strong>formatted</strong> paragraph.",
555
+
matches:"<p>This is a <strong>formatted</strong> paragraph.</p>"
556
+
)
557
+
558
+
assert(
559
+
rendering:"This<br/> is a <em><!-- multi\n line\n comment-->formatted</em>paragraph.",
560
+
matches:"<p>This<br/> is a <em>formatted</em> paragraph.</p>"
561
+
)
562
+
563
+
assert(
564
+
rendering:"This is a <span style=\"color: red\"><!-- before -->custom formatted<!-- after --></span> paragraph.",
565
+
matches:"<p>This is a <span style=\"color: red\">custom formatted</span> paragraph.</p>"
566
+
)
567
+
568
+
// This markup doesn't properly close the `<strong>` tag (it uses an `</em>` tag.
569
+
// In this case we drop both tags but not their content in between. This matches what DocC does for inline HTML with regards to the Render JSON output.
570
+
assert(
571
+
rendering:"This is a <strong>custom formatted</em> paragraph.",
572
+
matches:"<p>This is a custom formatted paragraph.</p>"
573
+
)
574
+
575
+
// Any content _within_ HTML tags in the markdown isn't parsed as markdown content.
576
+
assert(
577
+
rendering:"This is a <span>custom **not** formatted</span> paragraph.",
578
+
matches:"<p>This is a <span>custom **not** formatted</span> paragraph.</p>"
579
+
)
580
+
581
+
assert(
582
+
rendering:"""
583
+
<details>
584
+
<summary>Some summary<!-- comment in summary--></summary>
585
+
<!-- comment between elements -->
586
+
<p><!-- comment before -->Some longer<!-- comment between words --> description<!-- comment after --></p>
0 commit comments