You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2025/02/18 00:26:47 UTC
(skywalking-website) branch master updated: feat: Support for parsing json5 (#766)
This is an automated email from the ASF dual-hosted git repository.
wusheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking-website.git
The following commit(s) were added to refs/heads/master by this push:
new ca2fa4c76a6 feat: Support for parsing json5 (#766)
ca2fa4c76a6 is described below
commit ca2fa4c76a61ac897ab46a3be54c3dd3d1d8459b
Author: Juntao Zhang <71...@qq.com>
AuthorDate: Tue Feb 18 08:26:42 2025 +0800
feat: Support for parsing json5 (#766)
---
themes/docsy/assets/scss/_code.scss | 9 +++++++--
themes/docsy/layouts/partials/head-css.html | 1 +
themes/docsy/layouts/partials/scripts.html | 17 +++++++++++++++++
themes/docsy/static/css/highlight-github.css | 10 ++++++++++
4 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/themes/docsy/assets/scss/_code.scss b/themes/docsy/assets/scss/_code.scss
index 74b5308736f..0e9c6cc6f04 100644
--- a/themes/docsy/assets/scss/_code.scss
+++ b/themes/docsy/assets/scss/_code.scss
@@ -5,9 +5,10 @@
.highlight {
@extend .card;
- margin: 2rem 0;
+ margin: 1rem 0 1.5rem;
padding: 1rem;
- background-color: $gray-100;
+ background-color: #f6f8fa;
+ border: none;
pre, div {
background-color: inherit !important;
@@ -18,6 +19,10 @@
padding: 0;
}
}
+ pre:has(.language-json5) {
+ padding: 0;
+ margin: 1rem 0 1.5rem;
+ }
// Inline code
p code, li > code, table code {
diff --git a/themes/docsy/layouts/partials/head-css.html b/themes/docsy/layouts/partials/head-css.html
index cc9225bb743..86952b18395 100644
--- a/themes/docsy/layouts/partials/head-css.html
+++ b/themes/docsy/layouts/partials/head-css.html
@@ -13,4 +13,5 @@
{{ end }}
{{ if .Site.Params.algolia_docsearch }}
<link rel="stylesheet" href="/css/docSearch.css" />
+<link rel="stylesheet" href="/css/highlight-github.css" />
{{ end }}
diff --git a/themes/docsy/layouts/partials/scripts.html b/themes/docsy/layouts/partials/scripts.html
index 27f68b57ca1..e74c8885b45 100644
--- a/themes/docsy/layouts/partials/scripts.html
+++ b/themes/docsy/layouts/partials/scripts.html
@@ -15,9 +15,26 @@
<script src="{{ $js.RelPermalink }}" integrity="{{ $js.Data.Integrity }}" crossorigin="anonymous"></script>
{{ end }}
+<script src="/js/highlight.min.js"></script>
<script src="/js/mermaid.min.js"></script>
<script>
window.onload = () => mermaid.init(undefined, ".language-mermaid");
</script>
+<script>
+ document.addEventListener('DOMContentLoaded', () => {
+ document.querySelectorAll('pre code.language-json5').forEach((block) => {
+ if (block.classList.contains('language-json5')) {
+ try {
+ hljs.registerLanguage('json5', function(hljs) {
+ return hljs.getLanguage('json');
+ });
+ hljs.highlightElement(block);
+ } catch (error) {
+ console.error("Error parsing JSON5:", error);
+ }
+ }
+ });
+ });
+</script>
{{ partial "hooks/body-end.html" . }}
diff --git a/themes/docsy/static/css/highlight-github.css b/themes/docsy/static/css/highlight-github.css
new file mode 100644
index 00000000000..c19c53e353f
--- /dev/null
+++ b/themes/docsy/static/css/highlight-github.css
@@ -0,0 +1,10 @@
+pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}/*!
+ Theme: GitHub
+ Description: Light theme as seen on github.com
+ Author: github.com
+ Maintainer: @Hirse
+ Updated: 2021-05-15
+
+ Outdated base version: https://github.com/primer/github-syntax-light
+ Current colors taken from GitHub's CSS
+*/.hljs{color:#24292e;}.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-template-tag,.hljs-template-variable,.hljs-type,.hljs-variable.language_{color:#d73a49}.hljs-title,.hljs-title.class_,.hljs-title.class_.inherited__,.hljs-title.function_{color:#6f42c1}.hljs-number{color:#099}.hljs-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-operator,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id,.hljs-variable{color:#000080}.hljs-meta .hljs-string,.hljs-regexp,.hljs-stri [...]