redcarpet icon indicating copy to clipboard operation
redcarpet copied to clipboard

Disable headings or other specific elements of markdown syntax

Open collimarco opened this issue 2 years ago • 2 comments

I have a text field in markdown, but I don't want to allow the use of headings (h1, h2, etc.).

Is it possible to disable headings recognition in redcarpet?

Is it possible to selectively enable what parts of the markdown syntax we want to allow? (e.g. allow: "bold", "italic", "list", "link" and nothing else).

collimarco avatar Oct 17 '23 14:10 collimarco

there're two options:

  • create your own renderer
  • apply sanitize from sanitize gem with a list of desired tags

denkozlovs avatar Nov 26 '23 12:11 denkozlovs