-
Notifications
You must be signed in to change notification settings - Fork 71
Conversation
The main reason I'm proposing this is that I'm working on a live in-browser marky testing app, and having access to the parser made it possible to get access to the markdown-it token stream so I could do a Debug view. It also ends up addressing #247, which is nice. If everybody likes this change, I can update the documentation and add some tests. |
return githubLinkify(parser) | ||
} | ||
|
||
render.renderPackageDescription = function (description) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does PackageDescription
mean here? feel like we may soon be removing this when we get rid of packagize.js
with #282
otherwise this is a misleading name. shouldn't affect this PR, but we should change that if it means the full README
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's the name this method has had since before I started working on marky; last I saw many months ago, the npm web site was using it for rendering package.json description
fields into HTML for use in on package pages.
If they're not using it anymore, I'd be in favor of deprecating/removing it. People will be able to do basically the same thing by calling marky.getParser().renderInline(markdownSnippet)
, but honestly it wouldn't surprise me if nobody at all is using it anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh yeah, and this has absolutely nothing to do with the packagize stuff!
and finally, the only reason it shows up in the diff here is because I moved it up earlier in the file so it grouped the module exports together 😕
yay legacy
haha ok cool so- i think this looks awesome and i'm really excited about it. gonna add getting rid of that package description thing to #282 since we (cc/ @jefflembeck @aredridel ) are planning on getting rid of that pesky readme + desc weirdness anyways omg 10.0.0 is gonna be so good |
ok! travis is FINALLY green lol. mergin' |
Here's a speculative change that adds a new public API:
getParser([options])
Returns a marky-markdown-flavored markdown-it parser object. You can attach other markdown-it plugins, inspect the internals for debugging, etc... For example:
marky.getParser(options).render(markdown)
is the exact same thing as the existingmarky.render(markdown, options)