GithubHelp home page GithubHelp logo

Comments (6)

wooorm avatar wooorm commented on June 16, 2024 1

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.

wooorm avatar wooorm commented on June 16, 2024 1

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.

iloveip avatar iloveip commented on June 16, 2024 1

@wooorm Thank you very much!

from remark-external-links.

wooorm avatar wooorm commented on June 16, 2024

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.

missmatsuko avatar missmatsuko commented on June 16, 2024

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.

iloveip avatar iloveip commented on June 16, 2024

Hi @wooorm and @missmatsuko ,

Could you please give an example of using content option with an SVG?

from remark-external-links.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.