/* Add a Font Awesome "up-right-from-square" icon after all non-relative links.
 * Do not add the icon whenever the link contains and image.
 *
 * mdBook 0.5 no longer loads Font Awesome as a webfont (icons are embedded as
 * inline SVG instead), so the icon glyph is painted here as a mask image and
 * colored with `currentColor` to keep following the surrounding text/link color.
 *
 * mdBook copies the glyph from `src/external-link.svg` to
 * `<dest>/external-link.svg`. This stylesheet is copied to
 * `<dest>/theme/external-links.css`, so `url()` references
 * the parent directory.
 *
 * https://stackoverflow.com/a/20782415
 * https://webkit.org/blog/13096/css-has-pseudo-class/
 * https://stackoverflow.com/a/18168287
 */
a[href^="http://"]:not(:has(img))::after,
a[href^="https://"]:not(:has(img))::after {
  content: "";
  display: inline-block;
  width: 0.75em;
  height: 0.75em;
  margin-left: 0.2em;
  vertical-align: middle;
  background-color: currentColor;
  -webkit-mask-image: url("../external-link.svg");
  mask-image: url("../external-link.svg");
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: contain;
  mask-size: contain;
}
