code.styl 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. {$contentClass}
  2. code
  3. color lighten($textColor, 20%)
  4. padding 0.25rem 0.5rem
  5. margin 0
  6. font-size 0.85em
  7. background-color rgba(27,31,35,0.05)
  8. border-radius 3px
  9. .token
  10. &.deleted
  11. color #EC5975
  12. &.inserted
  13. color $accentColor
  14. {$contentClass}
  15. pre, pre[class*="language-"]
  16. line-height 1.4
  17. padding 1.25rem 1.5rem
  18. margin 0.85rem 0
  19. background-color $codeBgColor
  20. border-radius 6px
  21. overflow auto
  22. code
  23. color #fff
  24. padding 0
  25. background-color transparent
  26. border-radius 0
  27. div[class*="language-"]
  28. position relative
  29. background-color $codeBgColor
  30. border-radius 6px
  31. .highlight-lines
  32. user-select none
  33. padding-top 1.3rem
  34. position absolute
  35. top 0
  36. left 0
  37. width 100%
  38. line-height 1.4
  39. .highlighted
  40. background-color rgba(0, 0, 0, 66%)
  41. pre, pre[class*="language-"]
  42. background transparent
  43. position relative
  44. z-index 1
  45. &::before
  46. position absolute
  47. z-index 3
  48. top 0.8em
  49. right 1em
  50. font-size 0.75rem
  51. color rgba(255, 255, 255, 0.4)
  52. &:not(.line-numbers-mode)
  53. .line-numbers-wrapper
  54. display none
  55. &.line-numbers-mode
  56. .highlight-lines .highlighted
  57. position relative
  58. &:before
  59. content ' '
  60. position absolute
  61. z-index 3
  62. left 0
  63. top 0
  64. display block
  65. width $lineNumbersWrapperWidth
  66. height 100%
  67. background-color rgba(0, 0, 0, 66%)
  68. pre
  69. padding-left $lineNumbersWrapperWidth + 1 rem
  70. vertical-align middle
  71. .line-numbers-wrapper
  72. position absolute
  73. top 0
  74. width $lineNumbersWrapperWidth
  75. text-align center
  76. color rgba(255, 255, 255, 0.3)
  77. padding 1.25rem 0
  78. line-height 1.4
  79. br
  80. user-select none
  81. .line-number
  82. position relative
  83. z-index 4
  84. user-select none
  85. font-size 0.85em
  86. &::after
  87. content ''
  88. position absolute
  89. z-index 2
  90. top 0
  91. left 0
  92. width $lineNumbersWrapperWidth
  93. height 100%
  94. border-radius 6px 0 0 6px
  95. border-right 1px solid rgba(0, 0, 0, 66%)
  96. background-color $codeBgColor
  97. for lang in $codeLang
  98. div{'[class~="language-' + lang + '"]'}
  99. &:before
  100. content ('' + lang)
  101. div[class~="language-javascript"]
  102. &:before
  103. content "js"
  104. div[class~="language-typescript"]
  105. &:before
  106. content "ts"
  107. div[class~="language-markup"]
  108. &:before
  109. content "html"
  110. div[class~="language-markdown"]
  111. &:before
  112. content "md"
  113. div[class~="language-json"]:before
  114. content "json"
  115. div[class~="language-ruby"]:before
  116. content "rb"
  117. div[class~="language-python"]:before
  118. content "py"
  119. div[class~="language-bash"]:before
  120. content "sh"
  121. div[class~="language-php"]:before
  122. content "php"
  123. @import '~prismjs/themes/prism-tomorrow.css'