Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: code line number (close: #365) #379

Merged
merged 26 commits into from
May 13, 2018
Merged
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
6316058
feat: support line number
ulivz May 9, 2018
8c6f7c6
style: tweaks
ulivz May 9, 2018
d779750
refactor: simplify patch code
ulivz May 9, 2018
37c66a5
chore: tweaks
ulivz May 9, 2018
2b086d4
refactor: simplify code
ulivz May 9, 2018
4b19b86
refactor: hack line number middle align at all browsers
ulivz May 9, 2018
1e305e6
chore: add some comments
ulivz May 9, 2018
1b0ad8e
chore: rename highlightLines to line
ulivz May 9, 2018
eccf61a
chore: tweaks
ulivz May 9, 2018
54b4bad
Merge branch 'master' into line-number-support
ulivz May 10, 2018
ad58290
merge master
ulivz May 13, 2018
fa8aa12
chore: remove unexpected change
ulivz May 13, 2018
8352408
chore: remove unexpected change - 2
ulivz May 13, 2018
0a1b1d9
chore: chore: remove unexpected change - 3
ulivz May 13, 2018
0d27c4f
Merge branch 'master' into line-number-support
ulivz May 13, 2018
103da0c
chore: chore: chore: remove unexpected change - 4
ulivz May 13, 2018
8d1006e
Merge branch 'master' into line-number-support
ulivz May 13, 2018
a1f19b3
feat: hoist lineNumbers as a separate plugin
ulivz May 13, 2018
538ea1d
chore: tweaks
ulivz May 13, 2018
43072df
Merge branch 'master' into line-number-support
ulivz May 13, 2018
2f29ffa
Merge branch 'master' into line-number-support
ulivz May 13, 2018
b2702d1
style: enhancement
ulivz May 13, 2018
228f91e
refactor(pre-wrapper): change attr to class
ulivz May 13, 2018
be5d675
docs: add doc for line numbers
ulivz May 13, 2018
41f7362
chore: recover config.
ulivz May 13, 2018
3880629
fix: missing language tip
ulivz May 13, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
style: enhancement
  • Loading branch information
ulivz committed May 13, 2018
commit b2702d1ebee72c85bd9c8a909c347f3df448ac38
38 changes: 31 additions & 7 deletions lib/default-theme/styles/code.styl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ div[class*="language-"]
user-select none
padding-top 1.3rem
position absolute
z-index 0
top 0
left 0
width 100%
line-height 1.4
.highlighted
Expand All @@ -46,23 +47,46 @@ div[class*="language-"]
font-size 0.75rem
color rgba(255, 255, 255, 0.4)
&[line-numbers-mode]
position relative
&::after
content ''
position absolute
z-index 2
top 0
left 0
width $lineNumbersWrapperWidth
height 100%
border-radius 6px 0 0 6px
border-right 1px solid rgba(0, 0, 0, 66%)
background-color $codeBgColor
.highlight-lines
.highlighted
position relative
&:before
content ' '
position absolute
z-index 3
left 0
top 0
display block
width $lineNumbersWrapperWidth
height 100%
background-color rgba(0, 0, 0, 66%)
pre
padding-left $lineNumbersWrapperWidth
padding-left $lineNumbersWrapperWidth + 1 rem
vertical-align middle
.line-numbers-wrapper
position absolute
background-color $codeBgColor
top 0
width $lineNumbersWrapperWidth
border-radius 6px
text-align center
color rgba(255, 255, 255, 0.4)
color rgba(255, 255, 255, 0.3)
padding 1.25rem 0
top 0
line-height 1.4
br
user-select none
.line-number
position relative
z-index 4
user-select none
font-size 0.85em

Expand Down