snow-editor

small markdown and org-mode editor
Log | Files | Refs | README

sanitize.js (294B)


      1 import DOMPurify from 'dompurify';
      2 import { ORG_SANITIZE_OPTIONS } from './constants.js';
      3 
      4 export function sanitizeOrgHtml(html) {
      5   if (!html) return '';
      6   if (typeof window === 'undefined' || !window.document) {
      7     return html;
      8   }
      9   return DOMPurify.sanitize(html, ORG_SANITIZE_OPTIONS);
     10 }