Vuepress: Option to disable svg in external links

Created on 24 Jun 2018  路  7Comments  路  Source: vuejs/vuepress

<OutboundLink> generates an icon like this:

image

There should be an option to turn this off.

feature request next

Most helpful comment

If you only want to hide the outbound link icon only in certain cases you can hide it with CSS. For example, in my site I sometimes wrap images in external links, e.g.

[![some img](/assets/images/some.png)](http://someothersite.com)

The HTML rendered by this looks something like:

<a href="http://someothersite.com" target="_blank" rel="noopener noreferrer">
  <img src="/assets/images/some.png" alt="some img">
  <svg class="icon outbound">... this is the external link icon ...</svg>
</a>

And results in an image with the external link icon after it like this:

some img

In my CSS, I can use a sibling selector to hide the icon like this:

img + .icon.outbound {
  display: none;
}

This is pretty flexible and wouldn't require you to disable all of markdown-it. HTH!

All 7 comments

It make sense to include it in the theme, however including it in the default markdown renderer and not offering anyway to turn it off is forcing this icon to everyone, even those who's not using the default theme.

@octref Opened a PR at #614.

What is the status of this feature? I would like to be able to disable the OutboundLink component and think it should be rather opt-in with a plugin.

How to disable svg in external links? The web site has removed svg, https://vuepress.vuejs.org/config/, but I can't find config option.

If you only want to hide the outbound link icon only in certain cases you can hide it with CSS. For example, in my site I sometimes wrap images in external links, e.g.

[![some img](/assets/images/some.png)](http://someothersite.com)

The HTML rendered by this looks something like:

<a href="http://someothersite.com" target="_blank" rel="noopener noreferrer">
  <img src="/assets/images/some.png" alt="some img">
  <svg class="icon outbound">... this is the external link icon ...</svg>
</a>

And results in an image with the external link icon after it like this:

some img

In my CSS, I can use a sibling selector to hide the icon like this:

img + .icon.outbound {
  display: none;
}

This is pretty flexible and wouldn't require you to disable all of markdown-it. HTH!

  markdown: {
    externalLinkSymbol: false,
  },

image

do not work yet. Any thing wrong?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cfjedimaster picture cfjedimaster  路  3Comments

shaodahong picture shaodahong  路  3Comments

kid1412621 picture kid1412621  路  3Comments

genedronek picture genedronek  路  3Comments

tinchox5 picture tinchox5  路  3Comments