Last active
November 24, 2015 07:14
-
-
Save okmanideep/55419a959b7fd39a1c89 to your computer and use it in GitHub Desktop.
Adds line numbers to your pre blocks using css counters (enable lineanchors for pygments)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pre { | |
counter-reset: line-numbering; | |
border: solid 1px #d9d9d9; | |
border-radius: 0; | |
background: #fff; | |
padding: 0; | |
line-height: 23px; | |
margin-bottom: 30px; | |
white-space: pre; | |
overflow-x: auto; | |
word-break: normal; | |
word-wrap: normal; | |
} | |
pre a::before { | |
content: counter(line-numbering); | |
counter-increment: line-numbering; | |
padding-right: 1em; /* space after numbers */ | |
width: 20px; | |
text-align: right; | |
opacity: 0.7; | |
display: inline-block; | |
color: #aaa; | |
margin-right: 16px; | |
border-right: 1px solid #ccc; | |
padding: 2px 6px 2px 3px; | |
font-size: 12px; | |
-webkit-touch-callout: none; | |
-webkit-user-select: none; | |
-khtml-user-select: none; | |
-moz-user-select: none; | |
-ms-user-select: none; | |
user-select: none; | |
} | |
pre a:first-of-type::before { | |
padding-top: 10px; | |
} | |
pre a:last-of-type::before { | |
padding-bottom: 10px; | |
} | |
pre a:only-of-type::before { | |
padding: 10px; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment