remove highlight js

This commit is contained in:
Reorx 2022-04-14 21:39:30 +08:00
parent e71ceac1c7
commit 60380fe684
6 changed files with 3 additions and 140 deletions

View File

@ -1,63 +0,0 @@
.hljs-comment,
.hljs-quote {
color: #b6b18b;
}
.hljs-deletion,
.hljs-name,
.hljs-regexp,
.hljs-selector-class,
.hljs-selector-id,
.hljs-tag,
.hljs-template-variable,
.hljs-variable {
color: #eb3c54;
}
.hljs-built_in,
.hljs-builtin-name,
.hljs-link,
.hljs-literal,
.hljs-meta,
.hljs-number,
.hljs-params,
.hljs-type {
color: #e7ce56;
}
.hljs-attribute {
color: #ee7c2b;
}
.hljs-addition,
.hljs-bullet,
.hljs-string,
.hljs-symbol {
color: #4fb4d7;
}
.hljs-section,
.hljs-title {
color: #78bb65;
}
.hljs-keyword,
.hljs-selector-tag {
color: #b45ea4;
}
.hljs {
display: block;
overflow-x: auto;
background: #1c1d21;
color: #c0c5ce;
padding: .5em;
}
.hljs-emphasis {
font-style: italic;
}
.hljs-strong {
font-weight: 700;
}

File diff suppressed because one or more lines are too long

View File

@ -250,15 +250,7 @@ ex.
## Using Hugo's Syntax highlighter "chroma" ## Using Hugo's Syntax highlighter "chroma"
1. Disable Highlight.js in site `config.yml` 1. Set hugo's markdown styling in site `config.yml`
```yml
params:
assets:
disableHLJS: true
```
2. Set hugo's markdown styling in site `config.yml`
```yml ```yml
markup: markup:
@ -271,7 +263,7 @@ ex.
style: monokai style: monokai
``` ```
3. If you want `lineNos: true`, the background won't be proper. 2. If you want `lineNos: true`, the background won't be proper.
This will only work with `noClasses: false` or `pygmentsUseClasses: true`. This will only work with `noClasses: false` or `pygmentsUseClasses: true`.
Read [Generate Syntax Highlighter CSS](https://gohugo.io/content-management/syntax-highlighting/#generate-syntax-highlighter-css) Read [Generate Syntax Highlighter CSS](https://gohugo.io/content-management/syntax-highlighting/#generate-syntax-highlighter-css)

View File

@ -169,7 +169,6 @@ params:
tocopen: false tocopen: false
assets: assets:
# disableHLJS: true # to disable highlight.js
# disableFingerprinting: true # disableFingerprinting: true
favicon: "<link / abs url>" favicon: "<link / abs url>"
favicon16x16: "<link / abs url>" favicon16x16: "<link / abs url>"
@ -283,9 +282,7 @@ hidemeta: false
comments: false comments: false
description: "Desc Text." description: "Desc Text."
canonicalURL: "https://canonical.url/to/page" canonicalURL: "https://canonical.url/to/page"
disableHLJS: true # to disable highlightjs
disableShare: false disableShare: false
disableHLJS: false
hideSummary: false hideSummary: false
searchHidden: true searchHidden: true
ShowReadingTime: true ShowReadingTime: true

View File

@ -94,7 +94,6 @@ profileMode:
| name | type | example | Description | | name | type | example | Description |
| ------------------------------ | ------- | ------------- | -------------------------------------------- | | ------------------------------ | ------- | ------------- | -------------------------------------------- |
| `assets.favicon` | string | 'icon.ico' | To set favicon, can be path or external link | | `assets.favicon` | string | 'icon.ico' | To set favicon, can be path or external link |
| `assets.disableHLJS` | boolean | true \| false | To disable Highlight.js loading |
| `assets.disableFingerprinting` | boolean | true \| false | To disable Sub-Resource integrity for assets | | `assets.disableFingerprinting` | boolean | true \| false | To disable Sub-Resource integrity for assets |
#### cover #### cover
@ -163,7 +162,6 @@ editPost:
| `description` | string | 'description text' | Show Post Description under Title | | `description` | string | 'description text' | Show Post Description under Title |
| `canonicalURL` | string | "https://canonical.url/to/page" | To add canonical URL to posts | | `canonicalURL` | string | "https://canonical.url/to/page" | To add canonical URL to posts |
| `disableShare` | boolean | true \| false | To hide/show share icons under a page | | `disableShare` | boolean | true \| false | To hide/show share icons under a page |
| `disableHLJS` | boolean | true \| false | To disable Highlight.js loading |
| `disableAnchoredHeadings` | boolean | true \| false | To disable Anchored Headings | | `disableAnchoredHeadings` | boolean | true \| false | To disable Anchored Headings |
| `searchHidden` | boolean | true \| false | Hide page from search | | `searchHidden` | boolean | true \| false | Hide page from search |
| `hideSummary` | boolean | true \| false | To Hide summary being shown in list pages | | `hideSummary` | boolean | true \| false | To Hide summary being shown in list pages |

View File

@ -39,12 +39,8 @@
{{- $media := (resources.Get "css/core/zmedia.css") }} {{- $media := (resources.Get "css/core/zmedia.css") }}
{{- $common := (resources.Match "css/common/*.css") | resources.Concat "assets/css/common.css" }} {{- $common := (resources.Match "css/common/*.css") | resources.Concat "assets/css/common.css" }}
{{- /* include `an-old-hope` if hljs is on */}}
{{- $isHLJSdisabled := (site.Params.assets.disableHLJS | default false) }}
{{- $hljs := (cond ($isHLJSdisabled) (" " | resources.FromString "assets/css/hljs-blank.css") (resources.Get "css/hljs/an-old-hope.min.css")) }}
{{- /* order is important */}} {{- /* order is important */}}
{{- $core := (slice $theme_vars $reset $common $hljs $media) | resources.Concat "assets/css/core.css" }} {{- $core := (slice $theme_vars $reset $common $media) | resources.Concat "assets/css/core.css" }}
{{- $extended := (resources.Match "css/extended/*.css") | resources.Concat "assets/css/extended.css" }} {{- $extended := (resources.Match "css/extended/*.css") | resources.Concat "assets/css/extended.css" }}
{{- /* bundle all required css */}} {{- /* bundle all required css */}}
@ -58,19 +54,6 @@
<link crossorigin="anonymous" href="{{ $stylesheet.RelPermalink }}" rel="preload stylesheet" as="style"> <link crossorigin="anonymous" href="{{ $stylesheet.RelPermalink }}" rel="preload stylesheet" as="style">
{{- end }} {{- end }}
{{- /* Highlight.js */}}
{{- $isHLJSdisabled := (site.Params.assets.disableHLJS | default .Params.disableHLJS ) }}
{{- if (and (eq .Kind "page") (ne .Layout "archives") (ne .Layout "search") (not $isHLJSdisabled)) }}
{{- if not site.Params.assets.disableFingerprinting }}
{{- $highlight := slice (resources.Get "js/highlight.min.js") | resources.Concat "assets/js/highlight.js" | minify | fingerprint }}
<script defer crossorigin="anonymous" src="{{ $highlight.RelPermalink }}" integrity="{{ $highlight.Data.Integrity }}"
onload="hljs.initHighlightingOnLoad();"></script>
{{- else }}
{{- $highlight := slice (resources.Get "js/highlight.min.js") | resources.Concat "assets/js/highlight.js" | minify }}
<script defer crossorigin="anonymous" src="{{ $highlight.RelPermalink }}" onload="hljs.initHighlightingOnLoad();"></script>
{{- end }}
{{- end }}
{{- /* Favicons */}} {{- /* Favicons */}}
<link rel="icon" href="{{ site.Params.assets.favicon | default "favicon.ico" | absURL }}"> <link rel="icon" href="{{ site.Params.assets.favicon | default "favicon.ico" | absURL }}">
<link rel="icon" type="image/png" sizes="16x16" href="{{ site.Params.assets.favicon16x16 | default "favicon-16x16.png" | absURL }}"> <link rel="icon" type="image/png" sizes="16x16" href="{{ site.Params.assets.favicon16x16 | default "favicon-16x16.png" | absURL }}">