Skip to content

rehype-sanitize has different output than github #159

Answered by ChristianMurphy
RARgames asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @RARgames! 👋
Sorry you ran into some confusion.

rehype-santize does behave as GitHub does.
Make sure you have your remark and rehype configuration setup correctly.
A working example for reference: https://stackblitz.com/edit/github-ozn1qm?file=src%2Fmain.ts

source from sandbox
// ⚠️ Important! Please make sure the dependencies are up to date.

import { unified } from 'unified';
import remarkParse from 'remark-parse';
import remarkRehype from 'remark-rehype';
import rehypeRaw from 'rehype-raw';
import rehypeSanitize from 'rehype-sanitize';
import rehypeStringify from 'rehype-stringify';

const sourceMarkdown = `
<!-- test --> 123

<!-- test --> 456 <!-- test -->
`;

try {
  document.q…

Replies: 1 comment 12 replies

Comment options

You must be logged in to vote
12 replies
@wooorm
Comment options

@RARgames
Comment options

@wooorm
Comment options

@RARgames
Comment options

@RARgames
Comment options

Answer selected by RARgames
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants