Skip to content

How to properly only allow e.g. style color using rehype-sanitize? - Custom schema syntax #158

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

You must be logged in to vote

It's for the end users, so they could have text of any color (not just a few from the preset) from the input in the text area (Markdown Editor)

I would strongly recommend giving users a set of well known preset colors rather than any arbitrary color.
Websites usually go through a design refresh every 1-3 years, all of the user generated content was chosen by users to fit with the look at the time.
When the theme changes, all the custom user generated content, at best looks out of place, more often than not it becomes an accessibility and readability nightmare.

**Styled bold text**<!--rehype:style=color: red; fontSize: 42px;-->

I would also strongly advise using directives, over encour…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@RARgames
Comment options

@ChristianMurphy
Comment options

Answer selected by RARgames
@RARgames
Comment options

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