Comments (6)
Just for my own sake, would you mind explaining why adding text would require the remark parser twice? I think content would be a better option anyways, since it could then be styled.
To begin: we’re working with remark/mdast, so we’re working with markdown in this context. Not html/rehype/hast. So the options are markdown *is* cool
vs [{type: 'text', value: 'markdown'}, {type: 'emphasis', children: [{type: 'text', value: 'is'}]}, {type: 'text', value: 'cool'}]
. What I mean by content is the latter, where a string is the former. Having a string would need to include remark-parse somehow to parse the string to the content / tree. Having remark-parse typically wouldn’t be a problem, because dependencies are only included once in bundles/node, but for cases where someone does not use remark-parse themselves, because they send the virtual tree from a server or because of some other reason, would add a big lot of code/size in the bundle. Which is unneeded for users!
Definitely interested! I will take a closer look tonight, but it does seem pretty straight-forward, especially with remark-autolink-headings as a reference. Thanks!
Oh that’s cool Matsuko! Great, let me know if I can help!
from remark-external-links.
Something like:
var externalLinks = require('remark-external-links')
var s = require('hastscript/svg')
// …
.use(externalLinks, {
target: false,
rel: ['nofollow'],
content: s('svg', {xmlns: 'http://www.w3.org/2000/svg', viewbox: '0 0 500 500'}, [
s('title', 'SVG `<circle>` element'),
s('circle', {cx: 120, cy: 120, r: 100})
])
})
// …
Please in the future don’t comment on old issues. Questions can go on Spectrum
from remark-external-links.
@wooorm Thank you very much!
from remark-external-links.
Oh I like that idea! It would have to be content instead of a string though, as we’d otherwise have to include the remark parser again and that would be too heavy probably.
Would be similar also to remark-autolink-headings’ content
option.
Are you able and interested in working on this?
from remark-external-links.
Oh I like that idea! It would have to be content instead of a string though, as we’d otherwise have to include the remark parser again and that would be too heavy probably.
Just for my own sake, would you mind explaining why adding text would require the remark parser twice? I think content would be a better option anyways, since it could then be styled.
Are you able and interested in working on this?
Definitely interested! I will take a closer look tonight, but it does seem pretty straight-forward, especially with remark-autolink-headings
as a reference. Thanks!
from remark-external-links.
Hi @wooorm and @missmatsuko ,
Could you please give an example of using content
option with an SVG?
from remark-external-links.
Related Issues (11)
- Update for changes in remark HOT 3
- HTML Anchor tags aren't accounted HOT 2
- plugin overwrites node data.hProperties set by other remark plugins HOT 1
- Pass additional properties to a and span elements HOT 9
- Ignoring specific URLs HOT 2
- Add to remarkjs npm org HOT 3
- is it possible to exclude fragment anchors? HOT 3
- Whitelisting domains? HOT 3
- Add more support HOT 2
- mailto links (weird behavior) HOT 11
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 remark-external-links.