Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move to marked extension #64

Closed
2 tasks
azu opened this issue May 3, 2023 · 0 comments · Fixed by #80
Closed
2 tasks

Move to marked extension #64

azu opened this issue May 3, 2023 · 0 comments · Fixed by #80
Labels
help wanted Extra attention is needed

Comments

@azu
Copy link
Owner

azu commented May 3, 2023

marked@5 deprecated some options.

safe-marked approach is a wrapper of marked.
However, marked limit the this approach.
In the future, safe-marked user can not extends marked.

It is possible to continue using the WRAPPER approach, but it will be dirty code.
// ugly approach
import { createMarkdown } from "safe-marked";
const markdown = createMarkdown({
  marked: (marked) => {
    // extends marked
    marked.use(someExtension);
    return {
      // options
    }
  }
});
const html = markdown(`# Header

This is [CommonMark](https://commonmark.org/) text.
`);
console.log(html); 

So, We need to move this sanitizer function to marked extension like markedSanitizer

e.g.

import { marked } from "marked";
import { markedSanitizer } from "marked-sanitizer";
marked.use(markedSanitizer());

As a result, we will deprecate safe-marked.

TODO

  • create? or find? sanitizer extension for marked
  • deprecated safe-marked and recommened to use the extension
    • As possible, provide migration tool

If you have any opinions, please feel free to write to us.

@azu azu added the help wanted Extra attention is needed label May 3, 2023
@azu azu linked a pull request Feb 7, 2024 that will close this issue
@azu azu closed this as completed in #80 Feb 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant