Markdown Annotations

Marked & DOMPurify

Jedison supports Markdown formatting in various text fields including titles, descriptions, and info content. This is enabled by the marked.js library and activated by setting parseMarkdown: true in the Jedison configuration.

For security, all HTML output is sanitized using DOMPurify. This prevents XSS attacks while preserving safe HTML content. Sanitization is enabled with purifyHtml: true in the Jedison configuration.

Example

const jedison = new Jedison.Create({
    "parseMarkdown": true,
    "purifyHtml": true,
    "domPurifyOptions": {},
    "schema": {
      "title": "Example Field with Markdown",
      "type": "object",
      "properties": {
        "email": {
          "title": "**Email Address** *(required)*",
          "type": "string",
          "format": "email",
          "description": "Please provide a valid email address.\n\nWe'll use this for:\n- Account verification\n- Important notifications\n- Password recovery",
          "x-info": {
            "variant": "modal",
            "title": "**About Email Requirements**",
            "content": "Your email must:\n\n- Be a valid format (e.g., `user@example.com`)\n- Be accessible to you\n- Not be shared with other users\n\n*We will never sell your email to third parties*"
          }
        }
      }
    }
  })

Exposing dependencies

When using ES modules it may be necessary to expose, DOMPurify and marked as global variables in the window object.

import marked from 'marked'
import DOMPurify from 'dompurify'

window.marked = marked
window.DOMPurify = DOMPurify