GithubHelp home page GithubHelp logo

Comments (9)

iloveip avatar iloveip commented on June 19, 2024 1

I need to have something like this:

<a href="link_url" target="_blank" rel="nofollow noopener noreferrer" class="external">link_title
  <span role="img" class="anticon">
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="64 64 896 896" focusable="false" width="1em" height="1em" fill="currentColor" aria-hidden="true">
      <path></path>
    </svg>
  </span>
</a>

So I need to be able to pass className to a and to span. I also need to pass role="img" to span.

At the moment I have the following for the content:

content: h('span', {role: 'img', class: 'anticon'}, s('svg', {xmlns: 'http://www.w3.org/2000/svg', viewBox: '64 64 896 896', focusable: 'false', width: '1em', height: '1em', fill: 'currentColor', ariaHidden: 'true'}, s('path', {d: ''})))

But without classes and the span is wrapped in another span

from remark-external-links.

iloveip avatar iloveip commented on June 19, 2024 1

No, we use icons only for external links. Internal links are managed by gatsby-plugin-catch-links.

from remark-external-links.

wooorm avatar wooorm commented on June 19, 2024 1

Would the CSS selector a[rel] or a[target] be a potential solution to use instead of the class?

from remark-external-links.

iloveip avatar iloveip commented on June 19, 2024 1

Yes, sure, I've created the PR above. But I'm new to programming, so I don't really know what's the right way to do it.

from remark-external-links.

wooorm avatar wooorm commented on June 19, 2024

πŸ‘‹

Could you tell us more about the higher-level thing you want to achieve? Maybe that’s better done in a custom-made plugin?

from remark-external-links.

wooorm avatar wooorm commented on June 19, 2024

Might your case also in the end need for example classes or icons for local/internal links (#heading or /same/site)?

from remark-external-links.

iloveip avatar iloveip commented on June 19, 2024

Yes, a[rel] works.

from remark-external-links.

wooorm avatar wooorm commented on June 19, 2024

Ah great!!

For the properties, that can be done! Would you be interested in working on a PR for that? Something like:

  contentProperties = settings.contentProperties || {}

  // ...

  data: {hName: 'span', hProperties: extend(true, contentProperties), hChildren: extend(true, content)}

In index.js?

from remark-external-links.

wooorm avatar wooorm commented on June 19, 2024

Closed by GH-16.

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.