THE GITHTML FIELD GUIDE
Why Markdown inside an HTML block stops formatting
Markdown inside a raw HTML block is not automatically interpreted as ordinary Markdown by every processor. Reduce the page to a small fixture and check the target parser's documented behavior. Prefer native Markdown structure where possible; use a supported extension or explicit HTML only when the publishing pipeline deliberately requires it.
Separate a source-language boundary from a styling problem
When a paragraph displays literal asterisks inside a div, the stylesheet may be working perfectly. The parser may have treated that region as raw HTML instead of Markdown. Identify where the HTML block begins and ends, including blank lines around it. Compare the same sentence outside the wrapper. If emphasis works outside but not inside, you have isolated the parsing boundary. Avoid changing theme styles or enabling unrelated plugins before this check. Also distinguish ordinary raw HTML from MDX, where angle brackets may represent JSX and obey a different set of rules entirely.
Choose one supported authoring convention
Try the small fixture below in the project's actual preview. Do not assume that adding a markdown attribute to an element is portable; some processors provide such behavior through extensions, while others ignore it. If the wrapper exists only to create a visual callout, consider the generator's documented callout syntax or a plain blockquote with an explicit label. If the wrapper is essential, write the inner content in the supported language and keep the boundary clear. Record the relevant extension in the project configuration and contributor instructions so another author can reproduce the result without guessing.
<div>
**Does this become emphasis in your renderer?**
</div>
**This is ordinary Markdown outside the block.**Test the smallest necessary HTML surface
Review the output for both content and unwanted markup. A publishing surface can sanitize raw HTML, remove attributes, or treat it differently from a local preview. The fact that an HTML block appears on GitHub does not make every tag or behavior available elsewhere. Keep essential information outside optional interactive wrappers, and avoid introducing scripts to solve a formatting issue. After repair, check the next heading and paragraph as well: an unclosed or unexpectedly continued block can affect later content. Preserve the fixture as a regression case if the documentation uses raw HTML repeatedly. Keep a copy of the original fixture when testing parser upgrades. If a previously supported wrapper changes behavior, you can identify the regression without comparing a large, heavily styled page.
- Render the same emphasized sentence inside and outside the wrapper to isolate the language boundary.
- Check the configured parser and extensions before adding nonstandard attributes.
- Inspect the following section for content swallowed by the block.
- Prefer a simpler native construct when the HTML wrapper adds only decoration and no essential meaning.
Sources and further reading
AI-assisted writing with source-linked guidance and illustrative examples. Read our editorial approach or report a correction.