소스 검색

adding syntax highlighting in code using highlight.js

Medowar 1 개월 전
부모
커밋
d7d005bf1e
3개의 변경된 파일과 387개의 추가작업 그리고 0개의 파일을 삭제
  1. 72 0
      themes/tailwind-custom/css/highlight.js.min.css
  2. 312 0
      themes/tailwind-custom/js/highlight.min.js
  3. 3 0
      themes/tailwind-custom/layout.html.php

+ 72 - 0
themes/tailwind-custom/css/highlight.js.min.css

@@ -0,0 +1,72 @@
+/*
+Monokai style - ported by Luigi Maselli - http://grigio.org
+*/
+
+.hljs {
+  /* Inherit the pre background from the theme's prose styles
+     (--tw-prose-pre-bg) instead of Monokai's brown #272822 */
+  background: transparent;
+  color: #ddd;
+}
+
+.hljs-tag,
+.hljs-keyword,
+.hljs-selector-tag,
+.hljs-literal,
+.hljs-strong,
+.hljs-number,
+.hljs-name {
+  color: #f92672;
+}
+
+.hljs-code {
+  color: #66d9ef;
+}
+
+.hljs-attribute,
+.hljs-attr,
+.hljs-symbol,
+.hljs-regexp,
+.hljs-link {
+  color: #bf79db;
+}
+
+.hljs-string,
+.hljs-bullet,
+.hljs-subst,
+.hljs-title,
+.hljs-section,
+.hljs-emphasis,
+.hljs-type,
+.hljs-built_in,
+.hljs-selector-attr,
+.hljs-selector-pseudo,
+.hljs-addition,
+.hljs-variable,
+.hljs-template-tag,
+.hljs-template-variable {
+  color: #a6e22e;
+}
+
+.hljs-title.class_,
+.hljs-class .hljs-title {
+  color: white;
+}
+
+.hljs-comment,
+.hljs-quote,
+.hljs-deletion,
+.hljs-meta {
+  color: #75715e;
+}
+
+.hljs-keyword,
+.hljs-selector-tag,
+.hljs-literal,
+.hljs-doctag,
+.hljs-title,
+.hljs-section,
+.hljs-type,
+.hljs-selector-id {
+  font-weight: bold;
+}

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 312 - 0
themes/tailwind-custom/js/highlight.min.js


+ 3 - 0
themes/tailwind-custom/layout.html.php

@@ -7,6 +7,7 @@
 	<link rel="stylesheet" href="<?php echo theme_path();?>css/typography.css" data-precedence="next" />
 	<link rel="stylesheet" href="<?php echo theme_path();?>css/tailwind.css" data-precedence="next" />
 	<link rel="stylesheet" href="<?php echo theme_path();?>css/style.css" data-precedence="next" />
+	<link rel="stylesheet" href="<?php echo theme_path();?>css/highlight.js.min.css" data-precedence="next" />
 </head>
 <body class="bg-white pl-[calc(100vw-100%)] text-black antialiased dark:bg-gray-950 dark:text-white">
 <?php if (facebook()) { echo facebook(); } ?>
@@ -120,6 +121,8 @@
 		};
 	</script>
 	<script src="<?php echo theme_path();?>js/functions.js"></script>
+	<script src="<?php echo theme_path();?>js/highlight.min.js"></script>
+	<script>hljs.highlightAll();</script>
 	<?php if (analytics()): ?><?php echo analytics() ?><?php endif; ?>
 </body>
 </html>

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.