Comments (4)
getTokensText
is released as part of v8.6.0!
from markdown-it-anchor.
Interesting! I'm thinking I could use a blacklist approach instead of the current whitelist approach, e.g. doing .filter(token => token.type !== 'html_inline' && token.type !== 'image')
instead of .filter(token => token.type === 'text' || token.type === 'code_inline')
.
This yields the same output with all my tests using native markdown-it tokens but in the case of the KaTeX plugin, that would include the expression as well. This would be a breaking change though and that behavior might be undesirable with other plugins, so I guess it's safer to leave it as is and introduce a configuration option...
Probably something like:
md.use(anchor, {
getTokensText: tokens => tokens.filter(t => t.type !== 'html_inline' && t.type !== 'image').map(t => t.content).join('')
})
I'll give it some more thoughts and get back to you :)
from markdown-it-anchor.
Awesome, that would be great!
Thanks a ton for taking care
from markdown-it-anchor.
Awesome! Thank you very much for your effort!
from markdown-it-anchor.
Related Issues (20)
- Add container around heading and anchor HOT 3
- Expose custom options regardless of permalink styles HOT 4
- Headings containing a hashtag yield invalid hrefs HOT 2
- Headers in html_block Tokens aren't given slugs HOT 11
- Add <span> inside permalink.headerLink style until safari reader more is fixed HOT 1
- incorrect type for permalink.headerLink() HOT 2
- Feature request: container option for linkAfterHeader HOT 5
- Should return type for `PermalinkGenerator` be `void` instead of `string`? HOT 1
- Missing `wrapper` property in `LinkAfterHeaderPermalinkOptions` type HOT 1
- Add brief description of what plugin does to top of readme. HOT 1
- Types invalid with `"type": "module"` and `"moduleResolution": "Node16"` HOT 7
- @types in peerDeps HOT 2
- TypeError: c.attrGet is not a function HOT 1
- Curly braces anchor definitions HOT 2
- Improvement: render a nbsp instead of a space HOT 2
- Issue with linkAfterHeader
- Update typescript types HOT 1
- styleOfPermalinks is not a function HOT 2
- Advice for keeping permalink symbol token stable HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from markdown-it-anchor.