Expose default_features as class-level attributes #11

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants
@takluyver
Contributor

takluyver commented Jun 21, 2014

This makes it possible to add feature types to subclasses of BlockLexer and InlineLexer, without having to copy-paste the methods where their default feature orders are defined.

Background: We're investigating using mistune for rendering markdown in IPython notebooks (ipython/ipython#6028). One of our requirements is to pass through code in $-delimited mathematical expressions ($inline$ and $$block$$), without trying to render it as markdown (they are rendered by mathjax in the browser). At present, we do this by replacing all such expressions with numbered tokens like @@1@@, sending it to a renderer, and then filling them back in in the HTML. I hope that by using mistune, we can have a more elegant solution where the parser itself knows about these expressions. I think I can see how to do this, but I need a way to add a feature to the lexers.

Expose default_features as class-level attributes
This makes it possible to add feature types to BlockLexer and
InlineLexer without having to copy-paste the methods where their default
feature orders are defined.
@lepture

This comment has been minimized.

Show comment
Hide comment
@takluyver

This comment has been minimized.

Show comment
Hide comment
@takluyver

takluyver Jun 22, 2014

Contributor

Thanks for the heads up - I'll have a go at it, and send you more PRs if I find I need them.

Contributor

takluyver commented Jun 22, 2014

Thanks for the heads up - I'll have a go at it, and send you more PRs if I find I need them.

@takluyver

This comment has been minimized.

Show comment
Hide comment
@takluyver

takluyver Jun 24, 2014

Contributor

Closing this, because the commit was already merged.

Contributor

takluyver commented Jun 24, 2014

Closing this, because the commit was already merged.

@takluyver takluyver closed this Jun 24, 2014

@takluyver takluyver referenced this pull request Jun 24, 2014

Closed

Math expressions #8

lepture added a commit that referenced this pull request Jun 27, 2014

Define list_features and footnote_features for BlockLexer, so that one
can custom the parsing process of list and footnote.

Related issues:
- #8
- #11

@pyup-bot pyup-bot referenced this pull request in rochacbruno/quokka Feb 6, 2018

Closed

Pin mistune to latest version 0.8.3 #547

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment