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

Added headings option #562

Closed
wants to merge 1 commit into from
Closed

Conversation

adam-lynch
Copy link

This allows for headings to be disabled (and therefore treated like paragraphs). I know you can do it without a config option but it's awkward, I just did it. You need to:

  • Manually use the lexer and parser.
  • Create your own lexer.
  • Override the lexer rule with a noop after it's instantiated.
  • Make sure you do the above correctly or else any future instantiations will also have this noop instead of the original rule.
  • Make sure you pass your options to the lexer and the parser.
  • Make sure your options were merged with marked.defaults because the lexer and parser don't do it.
  • Do this for each custom renderer / use case you have. I have three.

With this change, you can just set headings: false and it's done. The option defaults to true. I've added a test for ignoring headings, one for testing headings as is (i.e. headings: true) and I've updated marked.min.js.

Best "head"-related GIF I found:

head

@chjj
Copy link
Member

chjj commented May 8, 2015

There might be a better more dynamic way to do this for any rule: see #579

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants