codeHighlight.scss 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. @import './variables.scss';
  2. $module: #{$prefix}-codeHighlight;
  3. .#{$module}{
  4. &-defaultTheme{
  5. /**
  6. * prism.js default theme for JavaScript, CSS and HTML
  7. * Based on dabblet (http://dabblet.com)
  8. * @author Lea Verou
  9. */
  10. pre[class*="language-"],
  11. code[class*="language-"]{
  12. color: var(--semi-color-text-0);
  13. font-size: 13px;
  14. text-shadow: none;
  15. // font-family: 'Inconsolata', Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace;
  16. font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
  17. direction: ltr;
  18. text-align: left;
  19. white-space: pre;
  20. word-spacing: normal;
  21. word-break: normal;
  22. line-height: 1.5;
  23. -moz-tab-size: 4;
  24. -o-tab-size: 4;
  25. tab-size: 4;
  26. -moz-hyphens: none;
  27. hyphens: none;
  28. }
  29. pre[class*="language-"]::selection,
  30. code[class*="language-"]::selection,
  31. pre[class*="language-"]::mozselection,
  32. code[class*="language-"]::mozselection {
  33. text-shadow: none;
  34. background: #b3d4fc;
  35. }
  36. pre[class*="language-"]{
  37. padding: 1em;
  38. margin: .5em 0;
  39. overflow: auto;
  40. background: var(--semi-color-tertiary-light-default);
  41. }
  42. :not(pre)>code[class*="language-"] {
  43. // padding: .1em .3em;
  44. display: block;
  45. border-radius: .3em;
  46. color: #895fe2;
  47. background: #f9f7f9;
  48. }
  49. pre{
  50. .namespace {
  51. opacity: .7;
  52. }
  53. .token.comment,
  54. .token.prolog,
  55. .token.doctype,
  56. .token.cdata {
  57. color: #6b7075;
  58. }
  59. .token.punctuation {
  60. color: rgba(var(--semi-grey-8), 1),
  61. }
  62. .token.property,
  63. .token.tag,
  64. .token.boolean,
  65. .token.number,
  66. .token.constant,
  67. .token.symbol,
  68. .token.deleted {
  69. color: rgba(var(--semi-purple-6), 1);
  70. }
  71. .token.selector,
  72. .token.attr-name,
  73. .token.string,
  74. .token.char,
  75. .token.builtin,
  76. .token.inserted {
  77. color: rgba(var(--semi-green-6), 1);
  78. }
  79. .token.operator,
  80. .token.entity,
  81. .token.url,
  82. .language-css .token.string,
  83. .style .token.string {
  84. color: rgba(var(--semi-grey-8), 1),
  85. }
  86. .token.atrule,
  87. .token.attr-value,
  88. .token.keyword {
  89. color: rgba(var(--semi-purple-6), 1);
  90. }
  91. .token.function {
  92. color: rgba(var(--semi-violet-6), 1);
  93. }
  94. .token.regex,
  95. .token.important,
  96. .token.variable {
  97. color: #d0955f;
  98. }
  99. .token.important,
  100. .token.bold {
  101. font-weight: bold;
  102. }
  103. .token.italic {
  104. font-style: italic;
  105. }
  106. .token.entity {
  107. cursor: help;
  108. }
  109. }
  110. pre[data-line] {
  111. position: relative;
  112. }
  113. pre[class*="language-"]>code[class*="language-"] {
  114. position: relative;
  115. z-index: 1;
  116. }
  117. .line-highlight {
  118. position: absolute;
  119. left: 0;
  120. right: 0;
  121. padding: inherit 0;
  122. margin-top: 1em;
  123. background: #ebf4ff;
  124. box-shadow: inset 5px 0 0 #0064d2;
  125. z-index: 0;
  126. pointer-events: none;
  127. line-height: inherit;
  128. white-space: pre;
  129. }
  130. }
  131. //---- line number ----
  132. pre[class*="language-"].line-numbers {
  133. position: relative;
  134. padding-left: 3.8em;
  135. counter-reset: linenumber;
  136. }
  137. pre[class*="language-"].line-numbers > code {
  138. position: relative;
  139. white-space: inherit;
  140. }
  141. .line-numbers .line-numbers-rows {
  142. position: absolute;
  143. pointer-events: none;
  144. top: 0;
  145. font-size: 100%;
  146. left: -3.8em;
  147. width: 3em; /* works for line-numbers below 1000 lines */
  148. letter-spacing: -1px;
  149. border-right: 1px solid #999;
  150. -webkit-user-select: none;
  151. -moz-user-select: none;
  152. -ms-user-select: none;
  153. user-select: none;
  154. }
  155. .line-numbers-rows > span {
  156. display: block;
  157. counter-increment: linenumber;
  158. }
  159. .line-numbers-rows > span:before {
  160. content: counter(linenumber);
  161. color: #999;
  162. display: block;
  163. padding-right: 0.8em;
  164. text-align: right;
  165. }
  166. }