-
-
Notifications
You must be signed in to change notification settings - Fork 378
Open
Description
For example:
const linksidx = md.inline.ruler.__find__('links')
const oldlinks = md.inline.ruler.__rules__[linksidx].fn
const links = function (state, startLine, endLine, silent) {
console.log(state)
const ret = oldlinks(state, silent)
if (!ret) return false
console.log(state) /* This just returns the cumulative
state object, without the ability to modify the
particular link instance that was just captured. */
return true
}
md.inline.ruler.at("links", links)But to add custom attributes, one would need to import all the dependencies in lib/rules_inline/links.js and basically copy/paste the function, but the lib dir does not come with the node package. Also, this API seems to be a roundabout way to override or extend parser rules. Is there a better way?
Example case: add dimensions to images with a custom extension:
[alt text](https://example.com/image.jpg)[500x300]I guess I will have to add it to the ALT text like:
[@500x300,alt text here](https://example.com/image.jpg)but this use case could apply to any custom token such as a heading, URL, even a table with attributes, etc.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels