From 8eae1f5de08deb0253602ee10ce6f011c6c599f3 Mon Sep 17 00:00:00 2001 From: Felix Sun Date: Wed, 9 Feb 2022 16:49:21 +0800 Subject: [PATCH] Fixed {{ and }} can't be in code problem --- ch/code.go | 12 +- ch/codehighlightjs/dist/codehighlight.css | 14 +- .../dist/codehighlight.umd.min.js | 2 +- ch/codehighlightjs/package.json | 7 +- ch/codehighlightjs/src/main.js | 21 +- ch/codehighlightjs/yarn.lock | 5990 +++++++---------- docs/hello-world.html | 4 +- docs/index.css | 14 +- docs/index.html | 86 +- docs/index.js | 2 +- ...ference-with-github-flavored-markdown.html | 14 +- docs/use-with-htmlgo.html | 35 +- docsrc/examples-generated.go | 2 +- docsrc/markdown-difference.go | 4 + 14 files changed, 2516 insertions(+), 3691 deletions(-) diff --git a/ch/code.go b/ch/code.go index 000bfce..1dca9cf 100644 --- a/ch/code.go +++ b/ch/code.go @@ -7,31 +7,27 @@ import ( ) type CodeBuilder struct { - tag *h.HTMLTagBuilder - code string + tag *h.HTMLTagBuilder } func Code(code string) (r *CodeBuilder) { r = &CodeBuilder{ - tag: h.Tag("bran-code"), + tag: h.Tag("highlightjs").Attr(":language", h.JSONString("go")), } r.Code(code) return } func (b *CodeBuilder) Code(v string) (r *CodeBuilder) { - b.code = v + b.tag.Attr(":code", h.JSONString(v)) return b } func (b *CodeBuilder) Language(v string) (r *CodeBuilder) { - b.tag.Attr("language", v) + b.tag.Attr(":language", h.JSONString(v)) return b } func (b *CodeBuilder) MarshalHTML(ctx context.Context) (r []byte, err error) { - b.tag.Children( - h.Template().Text(b.code).Attr("slot", "sourcecode"), - ) return b.tag.MarshalHTML(ctx) } diff --git a/ch/codehighlightjs/dist/codehighlight.css b/ch/codehighlightjs/dist/codehighlight.css index 97b2d14..b1cacdf 100644 --- a/ch/codehighlightjs/dist/codehighlight.css +++ b/ch/codehighlightjs/dist/codehighlight.css @@ -1,10 +1,6 @@ /*! - 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;background:#fff}.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-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-number,.hljs-operator,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id,.hljs-variable{color:#005cc5}.hljs-meta .hljs-string,.hljs-regexp,.hljs-string{color:#032f62}.hljs-built_in,.hljs-symbol{color:#e36209}.hljs-code,.hljs-comment,.hljs-formula{color:#6a737d}.hljs-name,.hljs-quote,.hljs-selector-pseudo,.hljs-selector-tag{color:#22863a}.hljs-subst{color:#24292e}.hljs-section{color:#005cc5;font-weight:700}.hljs-bullet{color:#735c0f}.hljs-emphasis{color:#24292e;font-style:italic}.hljs-strong{color:#24292e;font-weight:700}.hljs-addition{color:#22863a;background-color:#f0fff4}.hljs-deletion{color:#b31d28;background-color:#ffeef0} \ No newline at end of file + * StackOverflow.com light style + * + * @stackoverflow/stacks v0.56.0 + * https://github.com/StackExchange/Stacks + */.hljs{display:block;overflow-x:auto;padding:.5em;color:#2f3337;background:#f6f6f6}.hljs-comment{color:#656e77}.hljs-attr,.hljs-doctag,.hljs-keyword,.hljs-meta,.hljs-meta-keyword,.hljs-section,.hljs-selector-class,.hljs-selector-pseudo,.hljs-selector-tag{color:#015692}.hljs-attribute{color:#803378}.hljs-built_in,.hljs-literal,.hljs-name,.hljs-number,.hljs-quote,.hljs-selector-id,.hljs-template-tag,.hljs-title,.hljs-type{color:#b75501}.hljs-link,.hljs-meta-string,.hljs-regexp,.hljs-selector-attr,.hljs-string,.hljs-symbol,.hljs-template-variable,.hljs-variable{color:#54790d}.hljs-bullet,.hljs-code{color:#535a60}.hljs-deletion{color:#c02d2e}.hljs-addition{color:#2f6f44}.hljs-emphasis{font-style:italic}.hljs-strong{font-weight:700} \ No newline at end of file diff --git a/ch/codehighlightjs/dist/codehighlight.umd.min.js b/ch/codehighlightjs/dist/codehighlight.umd.min.js index 76f41e2..74a79da 100644 --- a/ch/codehighlightjs/dist/codehighlight.umd.min.js +++ b/ch/codehighlightjs/dist/codehighlight.umd.min.js @@ -1 +1 @@ -(function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t(require("Vue")):"function"===typeof define&&define.amd?define(["Vue"],t):"object"===typeof exports?exports["codehighlight"]=t(require("Vue")):e["codehighlight"]=t(e["Vue"])})("undefined"!==typeof self?self:this,(function(e){return function(){var t={7679:function(e,t){var n,a,i;(function(r,o){a=[],n=o,i="function"===typeof n?n.apply(t,a):n,void 0===i||(e.exports=i)})("undefined"!==typeof self&&self,(function(){function e(){var t=Object.getOwnPropertyDescriptor(document,"currentScript");if(!t&&"currentScript"in document&&document.currentScript)return document.currentScript;if(t&&t.get!==e&&document.currentScript)return document.currentScript;try{throw new Error}catch(m){var n,a,i,r=/.*at [^(]*\((.*):(.+):(.+)\)$/gi,o=/@([^@]*):(\d+):(\d+)\s*$/gi,s=r.exec(m.stack)||o.exec(m.stack),l=s&&s[1]||!1,c=s&&s[2]||!1,_=document.location.href.replace(document.location.hash,""),d=document.getElementsByTagName("script");l===_&&(n=document.documentElement.outerHTML,a=new RegExp("(?:[^\\n]+?\\n){0,"+(c-2)+"}[^<]*