Skip to content
This repository

Customize inline lexer #105

Open
ForbesLindesay opened this Issue · 4 comments

5 participants

Forbes Lindesay Ivo Wetzel Adam Pritchard insanehong Ognian
Forbes Lindesay

I'd like to be able to customize the inline lexer with an additional type (specifically math). At the moment it's not extendable. There as an implementation of this in #71 but that request was closed by the OP for some reason.

Ivo Wetzel

I'd also like to see something along this line (plus a custom block lexer too).

I'm currently working on a documentation parser / generator for based on markdown formatted comments and I need to both filter out the parameter / type annotations from the token stream, as well as convert them to HTML later on.

Right now I'm using a custom patched version of marked which just utilizes a couple of callbacks and other small modifications (i.e. storing the raw text of a process nodes e.g. "storing the full "### heading title" for a heading).

Adam Pritchard
adam-p commented

I figured I'd throw my use cases into my +1 for this issue as well. (Ref: adam-p/markdown-here)

  1. I've hacked math support into my copy of marked.js. It's inline-only and looks like $...$. It translates TeX into an image that uses the Google Chart API. (MathJax and MathML don't work in email.)

  2. I need to add the scheme to URLs. Some email clients can't copy with links that don't provide a scheme (adam-p/markdown-here#57), so "http://" should be added at start of any such URL.

    • So... I implemented that by pre-parsing MD links and adding the scheme. But, of course, that introduced another bug -- I didn't exclude MD links inside code blocks (adam-p/markdown-here#83). I guess I'll have to hack into marked.js again.

I'm sure I could come up with more examples, but those are probably representative. Some things are extensions of MD, and some things are hacks to help people use MD in the weird environment of email better.

Adam Pritchard adam-p referenced this issue in adam-p/markdown-here
Closed

[a](b) links shouldn't expand inside of a code block #83

Ognian

Any news on this? I would need the feature of #114 . I understand that it is not added to marked but it should be possible to add it as a custom extension.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.