UnmarkdownDocs

Raw HTML

Use inline HTML for advanced formatting when Markdown syntax is not sufficient. HTML is processed through rehype-raw and sanitized for security.

Overview

Unmarkdown supports a subset of HTML tags embedded directly in your Markdown via rehype-raw. All HTML is sanitized through rehype-sanitize with a custom schema that balances functionality and security.

Allowed Elements

Text Formatting

  • <strong>, <em>: Bold and italic
  • <mark>: Highlighted text
  • <del>, <ins>: Deleted and inserted text
  • <sup>, <sub>: Superscript and subscript
  • <kbd>: Keyboard key caps

Structure

  • <details>, <summary>: Collapsible content sections
  • <section>: Semantic sections
  • <br>, <hr>: Line breaks and horizontal rules
  • <colgroup>, <col>: Table column styling

Media and SVG

  • <img>: Images with src, alt, width, height attributes
  • <svg> and children (<path>, <circle>, <line>, <polyline>, <rect>): Inline SVG graphics

Tables

  • <table>, <thead>, <tbody>, <tr>, <th>, <td>: Full table support

Lists and Semantic

  • <ul>, <ol>, <li>: Lists
  • <abbr>, <cite>, <dfn>, <time>: Semantic elements
  • <input>: Checkbox inputs (for task lists)

Allowed Attributes

The following attributes are permitted on HTML elements:

  • style: Inline styles (partially supported, may be stripped in some export destinations)
  • class: CSS class names
  • dir: Text direction (ltr, rtl)
  • aria-*: Accessibility attributes
  • data-*: Custom data attributes
  • SVG attributes: stroke, fill, viewBox, width, height, d (on path), and other SVG-specific attributes

Blocked Elements

The following elements and attributes are stripped during rendering for security:

  • <script>: JavaScript execution
  • <style>: CSS injection
  • <iframe>: Embedded frames
  • <embed>, <object>, <applet>: Plugin content
  • <form>: Form elements (except input for task lists)
  • on* event handlers: onclick, onload, onerror, etc.
Warning
Any element or attribute not in the allow list is silently removed during rendering. This includes JavaScript URLs (javascript:) in href attributes.

Practical Examples

Collapsible Sections

markdown
<details>
<summary>Click to expand</summary>

This content is hidden by default and revealed when the user
clicks the summary. You can include **Markdown** inside.

- List items work
- `Code` works too

</details>

Keyboard Shortcuts

markdown
Press <kbd>Cmd</kbd> + <kbd>Shift</kbd> + <kbd>P</kbd> to publish.

HTML Tables with Spanning

When you need cell spanning or more complex table layouts than Markdown tables support:

html
<table>
  <thead>
    <tr>
      <th>Feature</th>
      <th>Free</th>
      <th>Pro</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Documents</td>
      <td>3</td>
      <td>Unlimited</td>
    </tr>
    <tr>
      <td>Templates</td>
      <td>8</td>
      <td>62</td>
    </tr>
  </tbody>
</table>

Text Direction

html
<p dir="rtl">This text renders right-to-left for Arabic or Hebrew content.</p>

Export Compatibility

Raw HTML is rendered faithfully when publishing to the web. When exporting to other destinations, HTML elements are converted to the closest equivalent format:

  • Google Docs and Word: Most HTML elements have direct equivalents
  • Slack: Limited to text formatting (bold, italic, strikethrough, code)
  • Email: Most HTML preserved, but rendering depends on the email client
  • Plain Text: HTML tags are stripped, only text content remains