0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

asciidocのhtml->PDF変換で(リンク)表示を消す

Posted at

やりたいこと

asciidocが生成したhtmlをPDFに変換するときに
後ろにリンク表示をしない

これを
image.png

こうしたい
image.png

手順

htmlをテキストエディタで開いて @media printを探す

これを

@media print{*{box-shadow:none!important;text-shadow:none!important}
html{font-size:80%}
a{color:inherit!important;text-decoration:underline!important}
a.bare,a[href^="#"],a[href^="mailto:"]{text-decoration:none!important}
a[href^="http:"]:not(.bare)::after,a[href^="https:"]:not(.bare)::after{content:"(" attr(href) ")";display:inline-block;font-size:.875em;padding-left:.25em}

こうする

@media print{*{box-shadow:none!important;text-shadow:none!important}
html{font-size:80%}
a{color:inherit!important;text-decoration:underline!important}
a.bare,a[href^="#"],a[href^="mailto:"]{text-decoration:none!important}
a[href^="http:"]:not(.bare)::after,a[href^="https:"]:not(.bare)::after{content:"";display:inline-block;font-size:.875em;padding-left:.25em}

差分をdiff形式で表示するとこんな感じ

404c404
< a[href^="http:"]:not(.bare)::after,a[href^="https:"]:not(.bare)::after{content:"(" attr(href) ")";display:inline-block;font-size:.875em;padding-left:.25em}
---
> a[href^="http:"]:not(.bare)::after,a[href^="https:"]:not(.bare)::after{content:"";display:inline-block;font-size:.875em;padding-left:.25em}

つまり after{content: で指定されているのでそれを削除する

あとは今までと同じようにブラウザで開いて印刷->PDF

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?