markdown-to-html-cli 3.4.2 → 3.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/nodes/github-corners.js +11 -22
- package/lib/nodes/github-corners.js.map +1 -1
- package/lib/nodes/markdown-style.d.ts +1 -1
- package/lib/nodes/markdown-style.js +49 -31
- package/lib/nodes/markdown-style.js.map +1 -1
- package/package.json +3 -3
- package/src/nodes/github-corners.ts +11 -22
- package/src/nodes/markdown-style.ts +51 -32
|
@@ -1,31 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @uiw/github-corners@1.5.
|
|
2
|
+
* @uiw/github-corners@1.5.12
|
|
3
3
|
* https://github.com/uiwjs/react-github-corners
|
|
4
4
|
*/
|
|
5
|
-
const scriptString = `const
|
|
6
|
-
|
|
5
|
+
const scriptString = `const GITHUB_CORNERS_TEMPLATE = document.createElement("template");
|
|
6
|
+
GITHUB_CORNERS_TEMPLATE.innerHTML = \`
|
|
7
7
|
<style>
|
|
8
|
-
:host a:hover .octo-arm {
|
|
9
|
-
animation: octocat-wave 560ms ease-in-out;
|
|
10
|
-
}
|
|
8
|
+
:host a:hover .octo-arm { animation: octocat-wave 560ms ease-in-out; }
|
|
11
9
|
@keyframes octocat-wave {
|
|
12
|
-
0%, 100% {
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
20%, 60% {
|
|
16
|
-
transform: rotate(-25deg);
|
|
17
|
-
}
|
|
18
|
-
40%, 80% {
|
|
19
|
-
transform: rotate(10deg);
|
|
20
|
-
}
|
|
10
|
+
0%, 100% { transform: rotate(0); }
|
|
11
|
+
20%, 60% { transform: rotate(-25deg); }
|
|
12
|
+
40%, 80% { transform: rotate(10deg); }
|
|
21
13
|
}
|
|
22
14
|
@media (max-width:500px) {
|
|
23
|
-
:host a:hover .octo-arm {
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
:host .octo-arm {
|
|
27
|
-
animation: octocat-wave 560ms ease-in-out;
|
|
28
|
-
}
|
|
15
|
+
:host a:hover .octo-arm { animation: none; }
|
|
16
|
+
:host .octo-arm { animation: octocat-wave 560ms ease-in-out; }
|
|
29
17
|
}
|
|
30
18
|
</style>
|
|
31
19
|
<svg width="80" height="80" viewBox="0 0 250 250" aria-hidden="true" style="position: absolute; border: 0px; top: 0px;">
|
|
@@ -43,7 +31,7 @@ export class GithubCorners extends HTMLElement {
|
|
|
43
31
|
super();
|
|
44
32
|
this.right = '0';
|
|
45
33
|
this.shadow = this.attachShadow({ mode: 'open' });
|
|
46
|
-
this.shadow.appendChild(this.ownerDocument.importNode(
|
|
34
|
+
this.shadow.appendChild(this.ownerDocument.importNode(GITHUB_CORNERS_TEMPLATE.content, true));
|
|
47
35
|
this.update();
|
|
48
36
|
}
|
|
49
37
|
static get observedAttributes() {
|
|
@@ -90,6 +78,7 @@ export function githubCorners(opts) {
|
|
|
90
78
|
properties: {
|
|
91
79
|
target: '__blank',
|
|
92
80
|
position: 'fixed',
|
|
81
|
+
'z-index': 999,
|
|
93
82
|
href,
|
|
94
83
|
},
|
|
95
84
|
children: []
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github-corners.js","sourceRoot":"","sources":["../../src/nodes/github-corners.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,MAAM,YAAY,GAAG
|
|
1
|
+
{"version":3,"file":"github-corners.js","sourceRoot":"","sources":["../../src/nodes/github-corners.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wDA+DmC,CAAC;AAEzD,MAAM,UAAU,aAAa,CAAC,IAAmB;IAC/C,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;IACtB,IAAI,CAAC,IAAI,EAAE;QACT,OAAO;KACR;IACD,OAAO;QACL;YACE,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,gBAAgB;YACzB,UAAU,EAAE;gBACV,MAAM,EAAE,SAAS;gBACjB,QAAQ,EAAE,OAAO;gBACjB,SAAS,EAAE,GAAG;gBACd,IAAI;aACL;YACD,QAAQ,EAAE,EAAE;SACb,EAAE;YACD,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,QAAQ;YACjB,UAAU,EAAE;gBACV,IAAI,EAAE,QAAQ;gBACd,uDAAuD;aACxD;YACD,QAAQ,EAAE,CAAC;oBACT,IAAI,EAAE,MAAM;oBACZ,KAAK,EAAE,YAAY;iBACpB,CAAC;SACH;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Element, ElementContent } from 'hast';
|
|
2
|
-
export declare function markdownStyle(child: ElementContent[], markdownStyleTheme
|
|
2
|
+
export declare function markdownStyle(child: ElementContent[], markdownStyleTheme?: 'dark' | 'light'): Element[];
|
|
@@ -1,47 +1,50 @@
|
|
|
1
|
+
const octiconLinkStyle = `
|
|
2
|
+
markdown-style h1:hover a.anchor .octicon-link:before,
|
|
3
|
+
markdown-style h2:hover a.anchor .octicon-link:before,
|
|
4
|
+
markdown-style h3:hover a.anchor .octicon-link:before,
|
|
5
|
+
markdown-style h4:hover a.anchor .octicon-link:before,
|
|
6
|
+
markdown-style h5:hover a.anchor .octicon-link:before,
|
|
7
|
+
markdown-style h6:hover a.anchor .octicon-link:before {
|
|
8
|
+
width: 16px;
|
|
9
|
+
height: 16px;
|
|
10
|
+
content: ' ';
|
|
11
|
+
display: inline-block;
|
|
12
|
+
background-color: currentColor;
|
|
13
|
+
-webkit-mask-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' version='1.1' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg>");
|
|
14
|
+
mask-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' version='1.1' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg>");
|
|
15
|
+
}`;
|
|
1
16
|
/**
|
|
2
|
-
* @wcj/markdown-style@1.0.
|
|
17
|
+
* @wcj/markdown-style@1.0.7
|
|
3
18
|
* https://github.com/jaywcjlove/markdown-to-html/tree/main/packages/markdown-style
|
|
4
19
|
*/
|
|
5
20
|
const scriptString = `const __TEMPLATE__ = document.createElement('template');
|
|
6
21
|
__TEMPLATE__.innerHTML = \`
|
|
7
22
|
<style>
|
|
8
|
-
|
|
9
|
-
.token.comment, .token.prolog, .token.doctype, .token.cdata { color: var(--color-prettylights-syntax-comment); } .token.namespace { opacity: 0.7; } .token.tag, .token.selector, .token.constant, .token.symbol, .token.deleted { color: var(--color-prettylights-syntax-entity-tag); } .token.maybe-class-name { color: var(--color-prettylights-syntax-variable); } .token.property-access, .token.operator, .token.boolean, .token.number, .token.selector .token.class, .token.attr-name, .token.string, .token.char, .token.builtin { color: var(--color-prettylights-syntax-constant); } .token.deleted { color: var(--color-prettylights-syntax-markup-deleted-text); } .token.property { color: var(--color-prettylights-syntax-constant); } .token.punctuation { color: var(--color-prettylights-syntax-markup-bold); } .token.function { color: var(--color-prettylights-syntax-entity); } .code-line .token.deleted { background-color: var(--color-prettylights-syntax-markup-deleted-bg); } .token.inserted { color: var(--color-prettylights-syntax-markup-inserted-text); } .code-line .token.inserted { background-color: var(--color-prettylights-syntax-markup-inserted-bg); } .token.variable { color: var(--color-prettylights-syntax-constant); } .token.entity, .token.url, .language-css .token.string, .style .token.string { color: var(--color-prettylights-syntax-string); } .token.color, .token.atrule, .token.attr-value, .token.function, .token.class-name { color: var(--color-prettylights-syntax-string); } .token.rule, .token.regex, .token.important, .token.keyword { color: var(--color-prettylights-syntax-keyword); } .token.coord { color: var(--color-prettylights-syntax-meta-diff-range); } .token.important, .token.bold { font-weight: bold; } .token.italic { font-style: italic; } .token.entity { cursor: help; }
|
|
10
|
-
:
|
|
11
|
-
.markdown-
|
|
12
|
-
:host a:not([href]) { color: inherit; text-decoration: none; } :host .absent { color: var(--color-danger-fg); } :host .anchor { float: left; padding-right: 4px; margin-left: -20px; line-height: 1; } :host .anchor:focus { outline: none; } :host p, :host blockquote, :host ul, :host ol, :host dl, :host table, :host pre, :host details { margin-top: 0; margin-bottom: 16px; } :host blockquote>:first-child { margin-top: 0; } :host blockquote>:last-child { margin-bottom: 0; } :host sup>a::before { content: "["; } :host sup>a::after { content: "]"; } :host h1 .octicon-link, :host h2 .octicon-link, :host h3 .octicon-link, :host h4 .octicon-link, :host h5 .octicon-link, :host h6 .octicon-link { color: var(--color-fg-default); vertical-align: middle; visibility: hidden; } :host h1:hover .anchor, :host h2:hover .anchor, :host h3:hover .anchor, :host h4:hover .anchor, :host h5:hover .anchor, :host h6:hover .anchor { text-decoration: none; } :host h1:hover .anchor .octicon-link, :host h2:hover .anchor .octicon-link, :host h3:hover .anchor .octicon-link, :host h4:hover .anchor .octicon-link, :host h5:hover .anchor .octicon-link, :host h6:hover .anchor .octicon-link { visibility: visible; } :host h1 tt, :host h1 code, :host h2 tt, :host h2 code, :host h3 tt, :host h3 code, :host h4 tt, :host h4 code, :host h5 tt, :host h5 code, :host h6 tt, :host h6 code { padding: 0 .2em; font-size: inherit; } :host ul.no-list, :host ol.no-list { padding: 0; list-style-type: none; } :host ol[type="1"] { list-style-type: decimal; } :host ol[type=a] { list-style-type: lower-alpha; } :host ol[type=i] { list-style-type: lower-roman; } :host div>ol:not([type]) { list-style-type: decimal; } :host ul ul, :host ul ol, :host ol ol, :host ol ul { margin-top: 0; margin-bottom: 0; } :host li>p { margin-top: 16px; } :host li+li { margin-top: .25em; } :host dl { padding: 0; } :host dl dt { padding: 0; margin-top: 16px; font-size: 1em; font-style: italic; font-weight: 600; } :host dl dd { padding: 0 16px; margin-bottom: 16px; } :host table th { font-weight: 600; } :host table th, :host table td { padding: 6px 13px; border: 1px solid var(--color-border-default); } :host table tr { background-color: var(--color-canvas-default); border-top: 1px solid var(--color-border-muted); } :host table tr:nth-child(2n) { background-color: var(--color-canvas-subtle); } :host table img { background-color: transparent; } :host img[align=right] { padding-left: 20px; } :host img[align=left] { padding-right: 20px; } :host .emoji { max-width: none; vertical-align: text-top; background-color: transparent; } :host span.frame { display: block; overflow: hidden; } :host span.frame>span { display: block; float: left; width: auto; padding: 7px; margin: 13px 0 0; overflow: hidden; border: 1px solid var(--color-border-default); } :host span.frame span img { display: block; float: left; } :host span.frame span span { display: block; padding: 5px 0 0; clear: both; color: var(--color-fg-default); } :host span.align-center { display: block; overflow: hidden; clear: both; } :host span.align-center>span { display: block; margin: 13px auto 0; overflow: hidden; text-align: center; } :host span.align-center span img { margin: 0 auto; text-align: center; } :host span.align-right { display: block; overflow: hidden; clear: both; } :host span.align-right>span { display: block; margin: 13px 0 0; overflow: hidden; text-align: right; } :host span.align-right span img { margin: 0; text-align: right; } :host span.float-left { display: block; float: left; margin-right: 13px; overflow: hidden; } :host span.float-left span { margin: 13px 0 0; } :host span.float-right { display: block; float: right; margin-left: 13px; overflow: hidden; } :host span.float-right>span { display: block; margin: 13px auto 0; overflow: hidden; text-align: right; } :host code, :host tt { padding: .2em .4em; margin: 0; font-size: 85%; background-color: var(--color-neutral-muted); border-radius: 6px; } :host code br, :host tt br { display: none; } :host del code { text-decoration: inherit; } :host pre code { font-size: 100%; } :host pre>code { padding: 0; margin: 0; word-break: normal; white-space: pre; background: transparent; border: 0; } :host .highlight { margin-bottom: 16px; } :host .highlight pre { margin-bottom: 0; word-break: normal; } :host .highlight pre, :host pre { position: relative; padding: 16px; overflow: auto; font-size: 85%; line-height: 1.45; background-color: var(--color-canvas-subtle); border-radius: 6px; } :host pre code, :host pre tt { display: inline; max-width: auto; padding: 0; margin: 0; overflow: visible; line-height: inherit; word-wrap: normal; background-color: transparent; border: 0; } :host .csv-data td, :host .csv-data th { padding: 5px; overflow: hidden; font-size: 12px; line-height: 1; text-align: left; white-space: nowrap; } :host .csv-data .blob-num { padding: 10px 8px 9px; text-align: right; background: var(--color-canvas-default); border: 0; } :host .csv-data tr { border-top: 0; } :host .csv-data th { font-weight: 600; background: var(--color-canvas-subtle); border-top: 0; } :host .footnotes { font-size: 12px; color: var(--color-fg-muted); border-top: 1px solid var(--color-border-default); } :host .footnotes ol { padding-left: 16px; } :host .footnotes li { position: relative; } :host .footnotes li:target::before { position: absolute; top: -8px; right: -8px; bottom: -8px; left: -24px; pointer-events: none; content: ""; border: 2px solid var(--color-accent-emphasis); border-radius: 6px; } :host .footnotes li:target { color: var(--color-fg-default); } :host .footnotes .data-footnote-backref g-emoji { font-family: monospace; } :host .task-list-item { list-style-type: none; } :host .task-list-item label { font-weight: 400; } :host .task-list-item.enabled label { cursor: pointer; } :host .task-list-item+.task-list-item { margin-top: 3px; } :host .task-list-item .handle { display: none; } :host .task-list-item-checkbox, :host input[type="checkbox"] { margin: 0 .2em .25em -1.6em; vertical-align: middle; } :host .contains-task-list:dir(rtl) .task-list-item-checkbox, :host .contains-task-list:dir(rtl) input[type="checkbox"] { margin: 0 -1.6em .25em .2em; } :host ::-webkit-calendar-picker-indicator { filter: invert(50%); }
|
|
23
|
+
${octiconLinkStyle}
|
|
24
|
+
markdown-style[theme*='light'] { --color-prettylights-syntax-comment: #6e7781; --color-prettylights-syntax-constant: #0550ae; --color-prettylights-syntax-entity: #8250df; --color-prettylights-syntax-storage-modifier-import: #24292f; --color-prettylights-syntax-entity-tag: #116329; --color-prettylights-syntax-keyword: #cf222e; --color-prettylights-syntax-string: #0a3069; --color-prettylights-syntax-variable: #953800; --color-prettylights-syntax-brackethighlighter-unmatched: #82071e; --color-prettylights-syntax-invalid-illegal-text: #f6f8fa; --color-prettylights-syntax-invalid-illegal-bg: #82071e; --color-prettylights-syntax-carriage-return-text: #f6f8fa; --color-prettylights-syntax-carriage-return-bg: #cf222e; --color-prettylights-syntax-string-regexp: #116329; --color-prettylights-syntax-markup-list: #3b2300; --color-prettylights-syntax-markup-heading: #0550ae; --color-prettylights-syntax-markup-italic: #24292f; --color-prettylights-syntax-markup-bold: #24292f; --color-prettylights-syntax-markup-deleted-text: #82071e; --color-prettylights-syntax-markup-deleted-bg: #FFEBE9; --color-prettylights-syntax-markup-inserted-text: #116329; --color-prettylights-syntax-markup-inserted-bg: #dafbe1; --color-prettylights-syntax-markup-changed-text: #953800; --color-prettylights-syntax-markup-changed-bg: #ffd8b5; --color-prettylights-syntax-markup-ignored-text: #eaeef2; --color-prettylights-syntax-markup-ignored-bg: #0550ae; --color-prettylights-syntax-meta-diff-range: #8250df; --color-prettylights-syntax-brackethighlighter-angle: #57606a; --color-prettylights-syntax-sublimelinter-gutter-mark: #8c959f; --color-prettylights-syntax-constant-other-reference-link: #0a3069; --color-fg-default: #24292f; --color-fg-muted: #57606a; --color-fg-subtle: #6e7781; --color-canvas-default: #ffffff; --color-canvas-subtle: #f6f8fa; --color-border-default: #d0d7de; --color-border-muted: hsla(210,18%,87%,1); --color-neutral-muted: rgba(175,184,193,0.2); --color-accent-fg: #0969da; --color-accent-emphasis: #0969da; --color-attention-subtle: #fff8c5; --color-danger-fg: #cf222e; } markdown-style[theme*='dark'] { --color-prettylights-syntax-comment: #8b949e; --color-prettylights-syntax-constant: #79c0ff; --color-prettylights-syntax-entity: #d2a8ff; --color-prettylights-syntax-storage-modifier-import: #c9d1d9; --color-prettylights-syntax-entity-tag: #7ee787; --color-prettylights-syntax-keyword: #ff7b72; --color-prettylights-syntax-string: #a5d6ff; --color-prettylights-syntax-variable: #ffa657; --color-prettylights-syntax-brackethighlighter-unmatched: #f85149; --color-prettylights-syntax-invalid-illegal-text: #f0f6fc; --color-prettylights-syntax-invalid-illegal-bg: #8e1519; --color-prettylights-syntax-carriage-return-text: #f0f6fc; --color-prettylights-syntax-carriage-return-bg: #b62324; --color-prettylights-syntax-string-regexp: #7ee787; --color-prettylights-syntax-markup-list: #f2cc60; --color-prettylights-syntax-markup-heading: #1f6feb; --color-prettylights-syntax-markup-italic: #c9d1d9; --color-prettylights-syntax-markup-bold: #c9d1d9; --color-prettylights-syntax-markup-deleted-text: #ffdcd7; --color-prettylights-syntax-markup-deleted-bg: #67060c; --color-prettylights-syntax-markup-inserted-text: #aff5b4; --color-prettylights-syntax-markup-inserted-bg: #033a16; --color-prettylights-syntax-markup-changed-text: #ffdfb6; --color-prettylights-syntax-markup-changed-bg: #5a1e02; --color-prettylights-syntax-markup-ignored-text: #c9d1d9; --color-prettylights-syntax-markup-ignored-bg: #1158c7; --color-prettylights-syntax-meta-diff-range: #d2a8ff; --color-prettylights-syntax-brackethighlighter-angle: #8b949e; --color-prettylights-syntax-sublimelinter-gutter-mark: #484f58; --color-prettylights-syntax-constant-other-reference-link: #a5d6ff; --color-fg-default: #c9d1d9; --color-fg-muted: #8b949e; --color-fg-subtle: #484f58; --color-canvas-default: #0d1117; --color-canvas-subtle: #161b22; --color-border-default: #30363d; --color-border-muted: #21262d; --color-neutral-muted: rgba(110,118,129,0.4); --color-accent-fg: #58a6ff; --color-accent-emphasis: #1f6feb; --color-attention-subtle: rgba(187,128,9,0.15); --color-danger-fg: #f85149; } markdown-style { display: block; -webkit-text-size-adjust: 100%; font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji"; font-size: 16px; line-height: 1.5; word-wrap: break-word; color: var(--color-fg-default); background-color: var(--color-canvas-default); } markdown-style details, markdown-style figcaption, markdown-style figure { display: block; } markdown-style summary { display: list-item; } markdown-style [hidden] { display: none !important; } markdown-style a { background-color: transparent; color: var(--color-accent-fg); text-decoration: none; } markdown-style a:active, markdown-style a:hover { outline-width: 0; } markdown-style abbr[title] { border-bottom: none; text-decoration: underline dotted; } markdown-style b, markdown-style strong { font-weight: 600; } markdown-style dfn { font-style: italic; } markdown-style h1 { margin: .67em 0; font-weight: 600; padding-bottom: .3em; font-size: 2em; border-bottom: 1px solid var(--color-border-muted); } markdown-style mark { background-color: var(--color-attention-subtle); color: var(--color-text-primary); } markdown-style small { font-size: 90%; } markdown-style sub, markdown-style sup { font-size: 75%; line-height: 0; position: relative; vertical-align: baseline; } markdown-style sub { bottom: -0.25em; } markdown-style sup { top: -0.5em; } markdown-style img { border-style: none; max-width: 100%; box-sizing: content-box; background-color: var(--color-canvas-default); } markdown-style code, markdown-style kbd, markdown-style pre, markdown-style samp { font-family: monospace,monospace; font-size: 1em; } markdown-style figure { margin: 1em 40px; } markdown-style hr { box-sizing: content-box; overflow: hidden; background: transparent; border-bottom: 1px solid var(--color-border-muted); height: .25em; padding: 0; margin: 24px 0; background-color: var(--color-border-default); border: 0; } markdown-style input { font: inherit; margin: 0; overflow: visible; font-family: inherit; font-size: inherit; line-height: inherit; } markdown-style [type=button], markdown-style [type=reset], markdown-style [type=submit] { -webkit-appearance: button; } markdown-style [type=button]::-moz-focus-inner, markdown-style [type=reset]::-moz-focus-inner, markdown-style [type=submit]::-moz-focus-inner { border-style: none; padding: 0; } markdown-style [type=button]:-moz-focusring, markdown-style [type=reset]:-moz-focusring, markdown-style [type=submit]:-moz-focusring { outline: 1px dotted ButtonText; } markdown-style [type=checkbox], markdown-style [type=radio] { box-sizing: border-box; padding: 0; } markdown-style [type=number]::-webkit-inner-spin-button, markdown-style [type=number]::-webkit-outer-spin-button { height: auto; } markdown-style [type=search] { -webkit-appearance: textfield; outline-offset: -2px; } markdown-style [type=search]::-webkit-search-cancel-button, markdown-style [type=search]::-webkit-search-decoration { -webkit-appearance: none; } markdown-style ::-webkit-input-placeholder { color: inherit; opacity: .54; } markdown-style ::-webkit-file-upload-button { -webkit-appearance: button; font: inherit; } markdown-style a:hover { text-decoration: underline; } markdown-style hr::before { display: table; content: ""; } markdown-style hr::after { display: table; clear: both; content: ""; } markdown-style table { border-spacing: 0; border-collapse: collapse; display: block; width: max-content; max-width: 100%; overflow: auto; } markdown-style td, markdown-style th { padding: 0; } markdown-style details summary { cursor: pointer; } markdown-style details:not([open])>*:not(summary) { display: none !important; } markdown-style kbd { display: inline-block; padding: 3px 5px; font: 11px ui-monospace,SFMono-Regular,SF Mono,Menlo,Consolas,Liberation Mono,monospace; line-height: 10px; color: var(--color-fg-default); vertical-align: middle; background-color: var(--color-canvas-subtle); border: solid 1px var(--color-neutral-muted); border-bottom-color: var(--color-neutral-muted); border-radius: 6px; box-shadow: inset 0 -1px 0 var(--color-neutral-muted); } markdown-style h1, markdown-style h2, markdown-style h3, markdown-style h4, markdown-style h5, markdown-style h6 { margin-top: 24px; margin-bottom: 16px; font-weight: 600; line-height: 1.25; } markdown-style h2 { font-weight: 600; padding-bottom: .3em; font-size: 1.5em; border-bottom: 1px solid var(--color-border-muted); } markdown-style h3 { font-weight: 600; font-size: 1.25em; } markdown-style h4 { font-weight: 600; font-size: 1em; } markdown-style h5 { font-weight: 600; font-size: .875em; } markdown-style h6 { font-weight: 600; font-size: .85em; color: var(--color-fg-muted); } markdown-style p { margin-top: 0; margin-bottom: 10px; } markdown-style blockquote { margin: 0; padding: 0 1em; color: var(--color-fg-muted); border-left: .25em solid var(--color-border-default); } markdown-style ul, markdown-style ol { margin-top: 0; margin-bottom: 0; padding-left: 2em; } markdown-style ol ol, markdown-style ul ol { list-style-type: lower-roman; } markdown-style ul ul ol, markdown-style ul ol ol, markdown-style ol ul ol, markdown-style ol ol ol { list-style-type: lower-alpha; } markdown-style dd { margin-left: 0; } markdown-style tt, markdown-style code { font-family: ui-monospace,SFMono-Regular,SF Mono,Menlo,Consolas,Liberation Mono,monospace; font-size: 12px; } markdown-style pre { margin-top: 0; margin-bottom: 0; font-family: ui-monospace,SFMono-Regular,SF Mono,Menlo,Consolas,Liberation Mono,monospace; font-size: 12px; word-wrap: normal; } markdown-style .octicon { display: inline-block; overflow: visible !important; vertical-align: text-bottom; fill: currentColor; } markdown-style ::placeholder { color: var(--color-fg-subtle); opacity: 1; } markdown-style input::-webkit-outer-spin-button, markdown-style input::-webkit-inner-spin-button { margin: 0; -webkit-appearance: none; appearance: none; }
|
|
25
|
+
markdown-style .token.comment, markdown-style .token.prolog, markdown-style .token.doctype, markdown-style .token.cdata { color: var(--color-prettylights-syntax-comment); } markdown-style .token.namespace { opacity: 0.7; } markdown-style .token.tag, markdown-style .token.selector, markdown-style .token.constant, markdown-style .token.symbol, markdown-style .token.deleted { color: var(--color-prettylights-syntax-entity-tag); } markdown-style .token.maybe-class-name { color: var(--color-prettylights-syntax-variable); } markdown-style .token.property-access, markdown-style .token.operator, markdown-style .token.boolean, markdown-style .token.number, markdown-style .token.selector markdown-style .token.class, markdown-style .token.attr-name, markdown-style .token.string, markdown-style .token.char, markdown-style .token.builtin { color: var(--color-prettylights-syntax-constant); } markdown-style .token.deleted { color: var(--color-prettylights-syntax-markup-deleted-text); } markdown-style .token.property { color: var(--color-prettylights-syntax-constant); } markdown-style .token.punctuation { color: var(--color-prettylights-syntax-markup-bold); } markdown-style .token.function { color: var(--color-prettylights-syntax-entity); } markdown-style .code-line .token.deleted { background-color: var(--color-prettylights-syntax-markup-deleted-bg); } markdown-style .token.inserted { color: var(--color-prettylights-syntax-markup-inserted-text); } markdown-style .code-line .token.inserted { background-color: var(--color-prettylights-syntax-markup-inserted-bg); } markdown-style .token.variable { color: var(--color-prettylights-syntax-constant); } markdown-style .token.entity, markdown-style .token.url, .language-css markdown-style .token.string, .style markdown-style .token.string { color: var(--color-prettylights-syntax-string); } markdown-style .token.color, markdown-style .token.atrule, markdown-style .token.attr-value, markdown-style .token.function, markdown-style .token.class-name { color: var(--color-prettylights-syntax-string); } markdown-style .token.rule, markdown-style .token.regex, markdown-style .token.important, markdown-style .token.keyword { color: var(--color-prettylights-syntax-keyword); } markdown-style .token.coord { color: var(--color-prettylights-syntax-meta-diff-range); } markdown-style .token.important, markdown-style .token.bold { font-weight: bold; } markdown-style .token.italic { font-style: italic; } markdown-style .token.entity { cursor: help; } markdown-style [data-catalyst] { display: block; }
|
|
26
|
+
markdown-style g-emoji { font-family: "Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"; font-size: 1em; font-style: normal !important; font-weight: 400; line-height: 1; vertical-align: -0.075em; } markdown-style g-emoji img { width: 1em; height: 1em; } markdown-style::before { display: table; content: ""; } markdown-style::after { display: table; clear: both; content: ""; } markdown-style>*:first-child { margin-top: 0 !important; } markdown-style>*:last-child { margin-bottom: 0 !important; } markdown-style a:not([href]) { color: inherit; text-decoration: none; } markdown-style .absent { color: var(--color-danger-fg); } markdown-style .anchor { float: left; padding-right: 4px; margin-left: -20px; line-height: 1; } markdown-style .anchor:focus { outline: none; } markdown-style p, markdown-style blockquote, markdown-style ul, markdown-style ol, markdown-style dl, markdown-style table, markdown-style pre, markdown-style details { margin-top: 0; margin-bottom: 16px; } markdown-style blockquote>:first-child { margin-top: 0; } markdown-style blockquote>:last-child { margin-bottom: 0; } markdown-style sup>a::before { content: "["; } markdown-style sup>a::after { content: "]"; } markdown-style h1 .octicon-link, markdown-style h2 .octicon-link, markdown-style h3 .octicon-link, markdown-style h4 .octicon-link, markdown-style h5 .octicon-link, markdown-style h6 .octicon-link { color: var(--color-fg-default); vertical-align: middle; visibility: hidden; } markdown-style h1:hover .anchor, markdown-style h2:hover .anchor, markdown-style h3:hover .anchor, markdown-style h4:hover .anchor, markdown-style h5:hover .anchor, markdown-style h6:hover .anchor { text-decoration: none; } markdown-style h1:hover .anchor .octicon-link, markdown-style h2:hover .anchor .octicon-link, markdown-style h3:hover .anchor .octicon-link, markdown-style h4:hover .anchor .octicon-link, markdown-style h5:hover .anchor .octicon-link, markdown-style h6:hover .anchor .octicon-link { visibility: visible; } markdown-style h1 tt, markdown-style h1 code, markdown-style h2 tt, markdown-style h2 code, markdown-style h3 tt, markdown-style h3 code, markdown-style h4 tt, markdown-style h4 code, markdown-style h5 tt, markdown-style h5 code, markdown-style h6 tt, markdown-style h6 code { padding: 0 .2em; font-size: inherit; } markdown-style ul.no-list, markdown-style ol.no-list { padding: 0; list-style-type: none; } markdown-style ol[type="1"] { list-style-type: decimal; } markdown-style ol[type=a] { list-style-type: lower-alpha; } markdown-style ol[type=i] { list-style-type: lower-roman; } markdown-style div>ol:not([type]) { list-style-type: decimal; } markdown-style ul ul, markdown-style ul ol, markdown-style ol ol, markdown-style ol ul { margin-top: 0; margin-bottom: 0; } markdown-style li>p { margin-top: 16px; } markdown-style li+li { margin-top: .25em; } markdown-style dl { padding: 0; } markdown-style dl dt { padding: 0; margin-top: 16px; font-size: 1em; font-style: italic; font-weight: 600; } markdown-style dl dd { padding: 0 16px; margin-bottom: 16px; } markdown-style table th { font-weight: 600; } markdown-style table th, markdown-style table td { padding: 6px 13px; border: 1px solid var(--color-border-default); } markdown-style table tr { background-color: var(--color-canvas-default); border-top: 1px solid var(--color-border-muted); } markdown-style table tr:nth-child(2n) { background-color: var(--color-canvas-subtle); } markdown-style table img { background-color: transparent; } markdown-style img[align=right] { padding-left: 20px; } markdown-style img[align=left] { padding-right: 20px; } markdown-style .emoji { max-width: none; vertical-align: text-top; background-color: transparent; } markdown-style span.frame { display: block; overflow: hidden; } markdown-style span.frame>span { display: block; float: left; width: auto; padding: 7px; margin: 13px 0 0; overflow: hidden; border: 1px solid var(--color-border-default); } markdown-style span.frame span img { display: block; float: left; } markdown-style span.frame span span { display: block; padding: 5px 0 0; clear: both; color: var(--color-fg-default); } markdown-style span.align-center { display: block; overflow: hidden; clear: both; } markdown-style span.align-center>span { display: block; margin: 13px auto 0; overflow: hidden; text-align: center; } markdown-style span.align-center span img { margin: 0 auto; text-align: center; } markdown-style span.align-right { display: block; overflow: hidden; clear: both; } markdown-style span.align-right>span { display: block; margin: 13px 0 0; overflow: hidden; text-align: right; } markdown-style span.align-right span img { margin: 0; text-align: right; } markdown-style span.float-left { display: block; float: left; margin-right: 13px; overflow: hidden; } markdown-style span.float-left span { margin: 13px 0 0; } markdown-style span.float-right { display: block; float: right; margin-left: 13px; overflow: hidden; } markdown-style span.float-right>span { display: block; margin: 13px auto 0; overflow: hidden; text-align: right; } markdown-style code, markdown-style tt { padding: .2em .4em; margin: 0; font-size: 85%; background-color: var(--color-neutral-muted); border-radius: 6px; } markdown-style code br, markdown-style tt br { display: none; } markdown-style del code { text-decoration: inherit; } markdown-style pre code { font-size: 100%; } markdown-style pre>code { padding: 0; margin: 0; word-break: normal; white-space: pre; background: transparent; border: 0; } markdown-style .highlight { margin-bottom: 16px; } markdown-style .highlight pre { margin-bottom: 0; word-break: normal; } markdown-style .highlight pre, markdown-style pre { position: relative; padding: 16px; overflow: auto; font-size: 85%; line-height: 1.45; background-color: var(--color-canvas-subtle); border-radius: 6px; } markdown-style pre code, markdown-style pre tt { display: inline; max-width: auto; padding: 0; margin: 0; overflow: visible; line-height: inherit; word-wrap: normal; background-color: transparent; border: 0; } markdown-style .csv-data td, markdown-style .csv-data th { padding: 5px; overflow: hidden; font-size: 12px; line-height: 1; text-align: left; white-space: nowrap; } markdown-style .csv-data .blob-num { padding: 10px 8px 9px; text-align: right; background: var(--color-canvas-default); border: 0; } markdown-style .csv-data tr { border-top: 0; } markdown-style .csv-data th { font-weight: 600; background: var(--color-canvas-subtle); border-top: 0; } markdown-style .footnotes { font-size: 12px; color: var(--color-fg-muted); border-top: 1px solid var(--color-border-default); } markdown-style .footnotes ol { padding-left: 16px; } markdown-style .footnotes li { position: relative; } markdown-style .footnotes li:target::before { position: absolute; top: -8px; right: -8px; bottom: -8px; left: -24px; pointer-events: none; content: ""; border: 2px solid var(--color-accent-emphasis); border-radius: 6px; } markdown-style .footnotes li:target { color: var(--color-fg-default); } markdown-style .footnotes .data-footnote-backref g-emoji { font-family: monospace; } markdown-style .task-list-item { list-style-type: none; } markdown-style .task-list-item label { font-weight: 400; } markdown-style .task-list-item.enabled label { cursor: pointer; } markdown-style .task-list-item+.task-list-item { margin-top: 3px; } markdown-style .task-list-item .handle { display: none; } markdown-style .task-list-item-checkbox, markdown-style input[type="checkbox"] { margin: 0 .2em .25em -1.6em; vertical-align: middle; } markdown-style .contains-task-list:dir(rtl) .task-list-item-checkbox, markdown-style .contains-task-list:dir(rtl) input[type="checkbox"] { margin: 0 -1.6em .25em .2em; } markdown-style ::-webkit-calendar-picker-indicator { filter: invert(50%); }
|
|
13
27
|
</style>
|
|
28
|
+
<slot></slot>
|
|
14
29
|
\`;
|
|
15
|
-
// See https://html.spec.whatwg.org/multipage/common-dom-interfaces.html
|
|
16
|
-
// #reflecting-content-attributes-in-idl-attributes.
|
|
17
|
-
const installStringReflection = (obj, attrName, propName = attrName) => {
|
|
18
|
-
Object.defineProperty(obj, propName, {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get() {
|
|
21
|
-
const value = this.getAttribute(attrName);
|
|
22
|
-
return value === null ? '' : value;
|
|
23
|
-
},
|
|
24
|
-
set(v) {
|
|
25
|
-
this.setAttribute(attrName, v);
|
|
26
|
-
},
|
|
27
|
-
});
|
|
28
|
-
};
|
|
29
30
|
class MarkdownStyle extends HTMLElement {
|
|
30
31
|
constructor() {
|
|
31
32
|
super();
|
|
32
33
|
this.initTheme = this.getAttribute('theme');
|
|
33
34
|
this.shadow = this.attachShadow({ mode: 'open' });
|
|
34
35
|
this.shadow.appendChild(__TEMPLATE__.content.cloneNode(true));
|
|
35
|
-
this.warpper = document.createElement('div');
|
|
36
|
-
this.warpper.classList.add('markdown-body');
|
|
37
|
-
this.shadow.appendChild(this.warpper);
|
|
38
36
|
this.setTheme();
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
37
|
+
const style = Array.prototype.slice
|
|
38
|
+
.call(this.shadow.children)
|
|
39
|
+
.find((item) => item.tagName === 'STYLE');
|
|
40
|
+
if (style) {
|
|
41
|
+
const id = '__MARKDOWN_STYLE__';
|
|
42
|
+
const findStyle = document.getElementById(id);
|
|
43
|
+
if (!findStyle) {
|
|
44
|
+
style.id = id;
|
|
45
|
+
document.head.append(style);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
45
48
|
}
|
|
46
49
|
setTheme() {
|
|
47
50
|
if (!this.initTheme) {
|
|
@@ -56,10 +59,9 @@ class MarkdownStyle extends HTMLElement {
|
|
|
56
59
|
}
|
|
57
60
|
}
|
|
58
61
|
}
|
|
59
|
-
this.warpper.setAttribute('data-color-mode', this.theme);
|
|
60
62
|
}
|
|
61
63
|
connectedCallback() {
|
|
62
|
-
installStringReflection(
|
|
64
|
+
this.installStringReflection('theme');
|
|
63
65
|
if (!this.initTheme) {
|
|
64
66
|
this.setTheme();
|
|
65
67
|
const observer = new MutationObserver((mutationsList, observer) => {
|
|
@@ -78,6 +80,22 @@ class MarkdownStyle extends HTMLElement {
|
|
|
78
80
|
};
|
|
79
81
|
}
|
|
80
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* See https://html.spec.whatwg.org/multipage/common-dom-interfaces.html
|
|
85
|
+
* #reflecting-content-attributes-in-idl-attributes.
|
|
86
|
+
*/
|
|
87
|
+
installStringReflection(attrName, propName = attrName) {
|
|
88
|
+
Object.defineProperty(this, propName, {
|
|
89
|
+
enumerable: true,
|
|
90
|
+
get() {
|
|
91
|
+
const value = this.getAttribute(attrName);
|
|
92
|
+
return value === null ? '' : value;
|
|
93
|
+
},
|
|
94
|
+
set(v) {
|
|
95
|
+
this.setAttribute(attrName, v);
|
|
96
|
+
},
|
|
97
|
+
});
|
|
98
|
+
}
|
|
81
99
|
}
|
|
82
100
|
customElements.define('markdown-style', MarkdownStyle);
|
|
83
101
|
`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown-style.js","sourceRoot":"","sources":["../../src/nodes/markdown-style.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"markdown-style.js","sourceRoot":"","sources":["../../src/nodes/markdown-style.ts"],"names":[],"mappings":"AAEA,MAAM,gBAAgB,GAAG;;;;;;;;;;;;;;EAcvB,CAAC;AAEH;;;GAGG;AACH,MAAM,YAAY,GAAG;;;EAGnB,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8EjB,CAAA;AAED,MAAM,UAAU,aAAa,CAAC,KAAuB,EAAE,kBAAqC;IAC1F,MAAM,UAAU,GAA2B;QACzC,KAAK,EAAE,0DAA0D;QACjE,SAAS,EAAE,eAAe;KAC3B,CAAA;IACD,IAAI,kBAAkB,EAAE;QACtB,UAAU,CAAC,KAAK,GAAG,kBAAkB,CAAC;KACvC;IACD,OAAO,CAAC;YACN,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,QAAQ;YACjB,gBAAgB;YAChB,uBAAuB;YACvB,4DAA4D;YAC5D,KAAK;YACL,QAAQ,EAAE,CAAC;oBACT,IAAI,EAAE,MAAM;oBACZ,KAAK,EAAE,YAAY;iBACpB,CAAC;SACH,EAAE;YACD,IAAI,EAAE,SAAS;YACf,UAAU;YACV,OAAO,EAAE,gBAAgB;YACzB,QAAQ,EAAE,KAAK;SAChB,CAAC,CAAA;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "markdown-to-html-cli",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.5",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Command line tool generates markdown as html.",
|
|
6
6
|
"homepage": "https://jaywcjlove.github.io/markdown-to-html-cli",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@types/fs-extra": "~9.0.13",
|
|
41
41
|
"@types/minimist": "~1.2.2",
|
|
42
|
-
"@uiw/github-corners": "~1.5.
|
|
43
|
-
"@wcj/markdown-style": "~1.0.
|
|
42
|
+
"@uiw/github-corners": "~1.5.12",
|
|
43
|
+
"@wcj/markdown-style": "~1.0.8",
|
|
44
44
|
"@wcj/markdown-to-html": "~2.0.3",
|
|
45
45
|
"fs-extra": "~10.0.0",
|
|
46
46
|
"minimist": "~1.2.5",
|
|
@@ -5,33 +5,21 @@ interface GithubCorners {
|
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* @uiw/github-corners@1.5.
|
|
8
|
+
* @uiw/github-corners@1.5.12
|
|
9
9
|
* https://github.com/uiwjs/react-github-corners
|
|
10
10
|
*/
|
|
11
|
-
const scriptString = `const
|
|
12
|
-
|
|
11
|
+
const scriptString = `const GITHUB_CORNERS_TEMPLATE = document.createElement("template");
|
|
12
|
+
GITHUB_CORNERS_TEMPLATE.innerHTML = \`
|
|
13
13
|
<style>
|
|
14
|
-
:host a:hover .octo-arm {
|
|
15
|
-
animation: octocat-wave 560ms ease-in-out;
|
|
16
|
-
}
|
|
14
|
+
:host a:hover .octo-arm { animation: octocat-wave 560ms ease-in-out; }
|
|
17
15
|
@keyframes octocat-wave {
|
|
18
|
-
0%, 100% {
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
20%, 60% {
|
|
22
|
-
transform: rotate(-25deg);
|
|
23
|
-
}
|
|
24
|
-
40%, 80% {
|
|
25
|
-
transform: rotate(10deg);
|
|
26
|
-
}
|
|
16
|
+
0%, 100% { transform: rotate(0); }
|
|
17
|
+
20%, 60% { transform: rotate(-25deg); }
|
|
18
|
+
40%, 80% { transform: rotate(10deg); }
|
|
27
19
|
}
|
|
28
20
|
@media (max-width:500px) {
|
|
29
|
-
:host a:hover .octo-arm {
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
:host .octo-arm {
|
|
33
|
-
animation: octocat-wave 560ms ease-in-out;
|
|
34
|
-
}
|
|
21
|
+
:host a:hover .octo-arm { animation: none; }
|
|
22
|
+
:host .octo-arm { animation: octocat-wave 560ms ease-in-out; }
|
|
35
23
|
}
|
|
36
24
|
</style>
|
|
37
25
|
<svg width="80" height="80" viewBox="0 0 250 250" aria-hidden="true" style="position: absolute; border: 0px; top: 0px;">
|
|
@@ -49,7 +37,7 @@ export class GithubCorners extends HTMLElement {
|
|
|
49
37
|
super();
|
|
50
38
|
this.right = '0';
|
|
51
39
|
this.shadow = this.attachShadow({ mode: 'open' });
|
|
52
|
-
this.shadow.appendChild(this.ownerDocument.importNode(
|
|
40
|
+
this.shadow.appendChild(this.ownerDocument.importNode(GITHUB_CORNERS_TEMPLATE.content, true));
|
|
53
41
|
this.update();
|
|
54
42
|
}
|
|
55
43
|
static get observedAttributes() {
|
|
@@ -97,6 +85,7 @@ export function githubCorners(opts: GithubCorners): Element[] {
|
|
|
97
85
|
properties: {
|
|
98
86
|
target: '__blank',
|
|
99
87
|
position: 'fixed',
|
|
88
|
+
'z-index': 999,
|
|
100
89
|
href,
|
|
101
90
|
},
|
|
102
91
|
children: []
|
|
@@ -1,49 +1,53 @@
|
|
|
1
1
|
import { Element, ElementContent } from 'hast';
|
|
2
2
|
|
|
3
|
+
const octiconLinkStyle = `
|
|
4
|
+
markdown-style h1:hover a.anchor .octicon-link:before,
|
|
5
|
+
markdown-style h2:hover a.anchor .octicon-link:before,
|
|
6
|
+
markdown-style h3:hover a.anchor .octicon-link:before,
|
|
7
|
+
markdown-style h4:hover a.anchor .octicon-link:before,
|
|
8
|
+
markdown-style h5:hover a.anchor .octicon-link:before,
|
|
9
|
+
markdown-style h6:hover a.anchor .octicon-link:before {
|
|
10
|
+
width: 16px;
|
|
11
|
+
height: 16px;
|
|
12
|
+
content: ' ';
|
|
13
|
+
display: inline-block;
|
|
14
|
+
background-color: currentColor;
|
|
15
|
+
-webkit-mask-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' version='1.1' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg>");
|
|
16
|
+
mask-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' version='1.1' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg>");
|
|
17
|
+
}`;
|
|
18
|
+
|
|
3
19
|
/**
|
|
4
|
-
* @wcj/markdown-style@1.0.
|
|
20
|
+
* @wcj/markdown-style@1.0.7
|
|
5
21
|
* https://github.com/jaywcjlove/markdown-to-html/tree/main/packages/markdown-style
|
|
6
22
|
*/
|
|
7
23
|
const scriptString = `const __TEMPLATE__ = document.createElement('template');
|
|
8
24
|
__TEMPLATE__.innerHTML = \`
|
|
9
25
|
<style>
|
|
10
|
-
|
|
11
|
-
.token.comment, .token.prolog, .token.doctype, .token.cdata { color: var(--color-prettylights-syntax-comment); } .token.namespace { opacity: 0.7; } .token.tag, .token.selector, .token.constant, .token.symbol, .token.deleted { color: var(--color-prettylights-syntax-entity-tag); } .token.maybe-class-name { color: var(--color-prettylights-syntax-variable); } .token.property-access, .token.operator, .token.boolean, .token.number, .token.selector .token.class, .token.attr-name, .token.string, .token.char, .token.builtin { color: var(--color-prettylights-syntax-constant); } .token.deleted { color: var(--color-prettylights-syntax-markup-deleted-text); } .token.property { color: var(--color-prettylights-syntax-constant); } .token.punctuation { color: var(--color-prettylights-syntax-markup-bold); } .token.function { color: var(--color-prettylights-syntax-entity); } .code-line .token.deleted { background-color: var(--color-prettylights-syntax-markup-deleted-bg); } .token.inserted { color: var(--color-prettylights-syntax-markup-inserted-text); } .code-line .token.inserted { background-color: var(--color-prettylights-syntax-markup-inserted-bg); } .token.variable { color: var(--color-prettylights-syntax-constant); } .token.entity, .token.url, .language-css .token.string, .style .token.string { color: var(--color-prettylights-syntax-string); } .token.color, .token.atrule, .token.attr-value, .token.function, .token.class-name { color: var(--color-prettylights-syntax-string); } .token.rule, .token.regex, .token.important, .token.keyword { color: var(--color-prettylights-syntax-keyword); } .token.coord { color: var(--color-prettylights-syntax-meta-diff-range); } .token.important, .token.bold { font-weight: bold; } .token.italic { font-style: italic; } .token.entity { cursor: help; }
|
|
12
|
-
:
|
|
13
|
-
.markdown-
|
|
14
|
-
:host a:not([href]) { color: inherit; text-decoration: none; } :host .absent { color: var(--color-danger-fg); } :host .anchor { float: left; padding-right: 4px; margin-left: -20px; line-height: 1; } :host .anchor:focus { outline: none; } :host p, :host blockquote, :host ul, :host ol, :host dl, :host table, :host pre, :host details { margin-top: 0; margin-bottom: 16px; } :host blockquote>:first-child { margin-top: 0; } :host blockquote>:last-child { margin-bottom: 0; } :host sup>a::before { content: "["; } :host sup>a::after { content: "]"; } :host h1 .octicon-link, :host h2 .octicon-link, :host h3 .octicon-link, :host h4 .octicon-link, :host h5 .octicon-link, :host h6 .octicon-link { color: var(--color-fg-default); vertical-align: middle; visibility: hidden; } :host h1:hover .anchor, :host h2:hover .anchor, :host h3:hover .anchor, :host h4:hover .anchor, :host h5:hover .anchor, :host h6:hover .anchor { text-decoration: none; } :host h1:hover .anchor .octicon-link, :host h2:hover .anchor .octicon-link, :host h3:hover .anchor .octicon-link, :host h4:hover .anchor .octicon-link, :host h5:hover .anchor .octicon-link, :host h6:hover .anchor .octicon-link { visibility: visible; } :host h1 tt, :host h1 code, :host h2 tt, :host h2 code, :host h3 tt, :host h3 code, :host h4 tt, :host h4 code, :host h5 tt, :host h5 code, :host h6 tt, :host h6 code { padding: 0 .2em; font-size: inherit; } :host ul.no-list, :host ol.no-list { padding: 0; list-style-type: none; } :host ol[type="1"] { list-style-type: decimal; } :host ol[type=a] { list-style-type: lower-alpha; } :host ol[type=i] { list-style-type: lower-roman; } :host div>ol:not([type]) { list-style-type: decimal; } :host ul ul, :host ul ol, :host ol ol, :host ol ul { margin-top: 0; margin-bottom: 0; } :host li>p { margin-top: 16px; } :host li+li { margin-top: .25em; } :host dl { padding: 0; } :host dl dt { padding: 0; margin-top: 16px; font-size: 1em; font-style: italic; font-weight: 600; } :host dl dd { padding: 0 16px; margin-bottom: 16px; } :host table th { font-weight: 600; } :host table th, :host table td { padding: 6px 13px; border: 1px solid var(--color-border-default); } :host table tr { background-color: var(--color-canvas-default); border-top: 1px solid var(--color-border-muted); } :host table tr:nth-child(2n) { background-color: var(--color-canvas-subtle); } :host table img { background-color: transparent; } :host img[align=right] { padding-left: 20px; } :host img[align=left] { padding-right: 20px; } :host .emoji { max-width: none; vertical-align: text-top; background-color: transparent; } :host span.frame { display: block; overflow: hidden; } :host span.frame>span { display: block; float: left; width: auto; padding: 7px; margin: 13px 0 0; overflow: hidden; border: 1px solid var(--color-border-default); } :host span.frame span img { display: block; float: left; } :host span.frame span span { display: block; padding: 5px 0 0; clear: both; color: var(--color-fg-default); } :host span.align-center { display: block; overflow: hidden; clear: both; } :host span.align-center>span { display: block; margin: 13px auto 0; overflow: hidden; text-align: center; } :host span.align-center span img { margin: 0 auto; text-align: center; } :host span.align-right { display: block; overflow: hidden; clear: both; } :host span.align-right>span { display: block; margin: 13px 0 0; overflow: hidden; text-align: right; } :host span.align-right span img { margin: 0; text-align: right; } :host span.float-left { display: block; float: left; margin-right: 13px; overflow: hidden; } :host span.float-left span { margin: 13px 0 0; } :host span.float-right { display: block; float: right; margin-left: 13px; overflow: hidden; } :host span.float-right>span { display: block; margin: 13px auto 0; overflow: hidden; text-align: right; } :host code, :host tt { padding: .2em .4em; margin: 0; font-size: 85%; background-color: var(--color-neutral-muted); border-radius: 6px; } :host code br, :host tt br { display: none; } :host del code { text-decoration: inherit; } :host pre code { font-size: 100%; } :host pre>code { padding: 0; margin: 0; word-break: normal; white-space: pre; background: transparent; border: 0; } :host .highlight { margin-bottom: 16px; } :host .highlight pre { margin-bottom: 0; word-break: normal; } :host .highlight pre, :host pre { position: relative; padding: 16px; overflow: auto; font-size: 85%; line-height: 1.45; background-color: var(--color-canvas-subtle); border-radius: 6px; } :host pre code, :host pre tt { display: inline; max-width: auto; padding: 0; margin: 0; overflow: visible; line-height: inherit; word-wrap: normal; background-color: transparent; border: 0; } :host .csv-data td, :host .csv-data th { padding: 5px; overflow: hidden; font-size: 12px; line-height: 1; text-align: left; white-space: nowrap; } :host .csv-data .blob-num { padding: 10px 8px 9px; text-align: right; background: var(--color-canvas-default); border: 0; } :host .csv-data tr { border-top: 0; } :host .csv-data th { font-weight: 600; background: var(--color-canvas-subtle); border-top: 0; } :host .footnotes { font-size: 12px; color: var(--color-fg-muted); border-top: 1px solid var(--color-border-default); } :host .footnotes ol { padding-left: 16px; } :host .footnotes li { position: relative; } :host .footnotes li:target::before { position: absolute; top: -8px; right: -8px; bottom: -8px; left: -24px; pointer-events: none; content: ""; border: 2px solid var(--color-accent-emphasis); border-radius: 6px; } :host .footnotes li:target { color: var(--color-fg-default); } :host .footnotes .data-footnote-backref g-emoji { font-family: monospace; } :host .task-list-item { list-style-type: none; } :host .task-list-item label { font-weight: 400; } :host .task-list-item.enabled label { cursor: pointer; } :host .task-list-item+.task-list-item { margin-top: 3px; } :host .task-list-item .handle { display: none; } :host .task-list-item-checkbox, :host input[type="checkbox"] { margin: 0 .2em .25em -1.6em; vertical-align: middle; } :host .contains-task-list:dir(rtl) .task-list-item-checkbox, :host .contains-task-list:dir(rtl) input[type="checkbox"] { margin: 0 -1.6em .25em .2em; } :host ::-webkit-calendar-picker-indicator { filter: invert(50%); }
|
|
26
|
+
${octiconLinkStyle}
|
|
27
|
+
markdown-style[theme*='light'] { --color-prettylights-syntax-comment: #6e7781; --color-prettylights-syntax-constant: #0550ae; --color-prettylights-syntax-entity: #8250df; --color-prettylights-syntax-storage-modifier-import: #24292f; --color-prettylights-syntax-entity-tag: #116329; --color-prettylights-syntax-keyword: #cf222e; --color-prettylights-syntax-string: #0a3069; --color-prettylights-syntax-variable: #953800; --color-prettylights-syntax-brackethighlighter-unmatched: #82071e; --color-prettylights-syntax-invalid-illegal-text: #f6f8fa; --color-prettylights-syntax-invalid-illegal-bg: #82071e; --color-prettylights-syntax-carriage-return-text: #f6f8fa; --color-prettylights-syntax-carriage-return-bg: #cf222e; --color-prettylights-syntax-string-regexp: #116329; --color-prettylights-syntax-markup-list: #3b2300; --color-prettylights-syntax-markup-heading: #0550ae; --color-prettylights-syntax-markup-italic: #24292f; --color-prettylights-syntax-markup-bold: #24292f; --color-prettylights-syntax-markup-deleted-text: #82071e; --color-prettylights-syntax-markup-deleted-bg: #FFEBE9; --color-prettylights-syntax-markup-inserted-text: #116329; --color-prettylights-syntax-markup-inserted-bg: #dafbe1; --color-prettylights-syntax-markup-changed-text: #953800; --color-prettylights-syntax-markup-changed-bg: #ffd8b5; --color-prettylights-syntax-markup-ignored-text: #eaeef2; --color-prettylights-syntax-markup-ignored-bg: #0550ae; --color-prettylights-syntax-meta-diff-range: #8250df; --color-prettylights-syntax-brackethighlighter-angle: #57606a; --color-prettylights-syntax-sublimelinter-gutter-mark: #8c959f; --color-prettylights-syntax-constant-other-reference-link: #0a3069; --color-fg-default: #24292f; --color-fg-muted: #57606a; --color-fg-subtle: #6e7781; --color-canvas-default: #ffffff; --color-canvas-subtle: #f6f8fa; --color-border-default: #d0d7de; --color-border-muted: hsla(210,18%,87%,1); --color-neutral-muted: rgba(175,184,193,0.2); --color-accent-fg: #0969da; --color-accent-emphasis: #0969da; --color-attention-subtle: #fff8c5; --color-danger-fg: #cf222e; } markdown-style[theme*='dark'] { --color-prettylights-syntax-comment: #8b949e; --color-prettylights-syntax-constant: #79c0ff; --color-prettylights-syntax-entity: #d2a8ff; --color-prettylights-syntax-storage-modifier-import: #c9d1d9; --color-prettylights-syntax-entity-tag: #7ee787; --color-prettylights-syntax-keyword: #ff7b72; --color-prettylights-syntax-string: #a5d6ff; --color-prettylights-syntax-variable: #ffa657; --color-prettylights-syntax-brackethighlighter-unmatched: #f85149; --color-prettylights-syntax-invalid-illegal-text: #f0f6fc; --color-prettylights-syntax-invalid-illegal-bg: #8e1519; --color-prettylights-syntax-carriage-return-text: #f0f6fc; --color-prettylights-syntax-carriage-return-bg: #b62324; --color-prettylights-syntax-string-regexp: #7ee787; --color-prettylights-syntax-markup-list: #f2cc60; --color-prettylights-syntax-markup-heading: #1f6feb; --color-prettylights-syntax-markup-italic: #c9d1d9; --color-prettylights-syntax-markup-bold: #c9d1d9; --color-prettylights-syntax-markup-deleted-text: #ffdcd7; --color-prettylights-syntax-markup-deleted-bg: #67060c; --color-prettylights-syntax-markup-inserted-text: #aff5b4; --color-prettylights-syntax-markup-inserted-bg: #033a16; --color-prettylights-syntax-markup-changed-text: #ffdfb6; --color-prettylights-syntax-markup-changed-bg: #5a1e02; --color-prettylights-syntax-markup-ignored-text: #c9d1d9; --color-prettylights-syntax-markup-ignored-bg: #1158c7; --color-prettylights-syntax-meta-diff-range: #d2a8ff; --color-prettylights-syntax-brackethighlighter-angle: #8b949e; --color-prettylights-syntax-sublimelinter-gutter-mark: #484f58; --color-prettylights-syntax-constant-other-reference-link: #a5d6ff; --color-fg-default: #c9d1d9; --color-fg-muted: #8b949e; --color-fg-subtle: #484f58; --color-canvas-default: #0d1117; --color-canvas-subtle: #161b22; --color-border-default: #30363d; --color-border-muted: #21262d; --color-neutral-muted: rgba(110,118,129,0.4); --color-accent-fg: #58a6ff; --color-accent-emphasis: #1f6feb; --color-attention-subtle: rgba(187,128,9,0.15); --color-danger-fg: #f85149; } markdown-style { display: block; -webkit-text-size-adjust: 100%; font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji"; font-size: 16px; line-height: 1.5; word-wrap: break-word; color: var(--color-fg-default); background-color: var(--color-canvas-default); } markdown-style details, markdown-style figcaption, markdown-style figure { display: block; } markdown-style summary { display: list-item; } markdown-style [hidden] { display: none !important; } markdown-style a { background-color: transparent; color: var(--color-accent-fg); text-decoration: none; } markdown-style a:active, markdown-style a:hover { outline-width: 0; } markdown-style abbr[title] { border-bottom: none; text-decoration: underline dotted; } markdown-style b, markdown-style strong { font-weight: 600; } markdown-style dfn { font-style: italic; } markdown-style h1 { margin: .67em 0; font-weight: 600; padding-bottom: .3em; font-size: 2em; border-bottom: 1px solid var(--color-border-muted); } markdown-style mark { background-color: var(--color-attention-subtle); color: var(--color-text-primary); } markdown-style small { font-size: 90%; } markdown-style sub, markdown-style sup { font-size: 75%; line-height: 0; position: relative; vertical-align: baseline; } markdown-style sub { bottom: -0.25em; } markdown-style sup { top: -0.5em; } markdown-style img { border-style: none; max-width: 100%; box-sizing: content-box; background-color: var(--color-canvas-default); } markdown-style code, markdown-style kbd, markdown-style pre, markdown-style samp { font-family: monospace,monospace; font-size: 1em; } markdown-style figure { margin: 1em 40px; } markdown-style hr { box-sizing: content-box; overflow: hidden; background: transparent; border-bottom: 1px solid var(--color-border-muted); height: .25em; padding: 0; margin: 24px 0; background-color: var(--color-border-default); border: 0; } markdown-style input { font: inherit; margin: 0; overflow: visible; font-family: inherit; font-size: inherit; line-height: inherit; } markdown-style [type=button], markdown-style [type=reset], markdown-style [type=submit] { -webkit-appearance: button; } markdown-style [type=button]::-moz-focus-inner, markdown-style [type=reset]::-moz-focus-inner, markdown-style [type=submit]::-moz-focus-inner { border-style: none; padding: 0; } markdown-style [type=button]:-moz-focusring, markdown-style [type=reset]:-moz-focusring, markdown-style [type=submit]:-moz-focusring { outline: 1px dotted ButtonText; } markdown-style [type=checkbox], markdown-style [type=radio] { box-sizing: border-box; padding: 0; } markdown-style [type=number]::-webkit-inner-spin-button, markdown-style [type=number]::-webkit-outer-spin-button { height: auto; } markdown-style [type=search] { -webkit-appearance: textfield; outline-offset: -2px; } markdown-style [type=search]::-webkit-search-cancel-button, markdown-style [type=search]::-webkit-search-decoration { -webkit-appearance: none; } markdown-style ::-webkit-input-placeholder { color: inherit; opacity: .54; } markdown-style ::-webkit-file-upload-button { -webkit-appearance: button; font: inherit; } markdown-style a:hover { text-decoration: underline; } markdown-style hr::before { display: table; content: ""; } markdown-style hr::after { display: table; clear: both; content: ""; } markdown-style table { border-spacing: 0; border-collapse: collapse; display: block; width: max-content; max-width: 100%; overflow: auto; } markdown-style td, markdown-style th { padding: 0; } markdown-style details summary { cursor: pointer; } markdown-style details:not([open])>*:not(summary) { display: none !important; } markdown-style kbd { display: inline-block; padding: 3px 5px; font: 11px ui-monospace,SFMono-Regular,SF Mono,Menlo,Consolas,Liberation Mono,monospace; line-height: 10px; color: var(--color-fg-default); vertical-align: middle; background-color: var(--color-canvas-subtle); border: solid 1px var(--color-neutral-muted); border-bottom-color: var(--color-neutral-muted); border-radius: 6px; box-shadow: inset 0 -1px 0 var(--color-neutral-muted); } markdown-style h1, markdown-style h2, markdown-style h3, markdown-style h4, markdown-style h5, markdown-style h6 { margin-top: 24px; margin-bottom: 16px; font-weight: 600; line-height: 1.25; } markdown-style h2 { font-weight: 600; padding-bottom: .3em; font-size: 1.5em; border-bottom: 1px solid var(--color-border-muted); } markdown-style h3 { font-weight: 600; font-size: 1.25em; } markdown-style h4 { font-weight: 600; font-size: 1em; } markdown-style h5 { font-weight: 600; font-size: .875em; } markdown-style h6 { font-weight: 600; font-size: .85em; color: var(--color-fg-muted); } markdown-style p { margin-top: 0; margin-bottom: 10px; } markdown-style blockquote { margin: 0; padding: 0 1em; color: var(--color-fg-muted); border-left: .25em solid var(--color-border-default); } markdown-style ul, markdown-style ol { margin-top: 0; margin-bottom: 0; padding-left: 2em; } markdown-style ol ol, markdown-style ul ol { list-style-type: lower-roman; } markdown-style ul ul ol, markdown-style ul ol ol, markdown-style ol ul ol, markdown-style ol ol ol { list-style-type: lower-alpha; } markdown-style dd { margin-left: 0; } markdown-style tt, markdown-style code { font-family: ui-monospace,SFMono-Regular,SF Mono,Menlo,Consolas,Liberation Mono,monospace; font-size: 12px; } markdown-style pre { margin-top: 0; margin-bottom: 0; font-family: ui-monospace,SFMono-Regular,SF Mono,Menlo,Consolas,Liberation Mono,monospace; font-size: 12px; word-wrap: normal; } markdown-style .octicon { display: inline-block; overflow: visible !important; vertical-align: text-bottom; fill: currentColor; } markdown-style ::placeholder { color: var(--color-fg-subtle); opacity: 1; } markdown-style input::-webkit-outer-spin-button, markdown-style input::-webkit-inner-spin-button { margin: 0; -webkit-appearance: none; appearance: none; }
|
|
28
|
+
markdown-style .token.comment, markdown-style .token.prolog, markdown-style .token.doctype, markdown-style .token.cdata { color: var(--color-prettylights-syntax-comment); } markdown-style .token.namespace { opacity: 0.7; } markdown-style .token.tag, markdown-style .token.selector, markdown-style .token.constant, markdown-style .token.symbol, markdown-style .token.deleted { color: var(--color-prettylights-syntax-entity-tag); } markdown-style .token.maybe-class-name { color: var(--color-prettylights-syntax-variable); } markdown-style .token.property-access, markdown-style .token.operator, markdown-style .token.boolean, markdown-style .token.number, markdown-style .token.selector markdown-style .token.class, markdown-style .token.attr-name, markdown-style .token.string, markdown-style .token.char, markdown-style .token.builtin { color: var(--color-prettylights-syntax-constant); } markdown-style .token.deleted { color: var(--color-prettylights-syntax-markup-deleted-text); } markdown-style .token.property { color: var(--color-prettylights-syntax-constant); } markdown-style .token.punctuation { color: var(--color-prettylights-syntax-markup-bold); } markdown-style .token.function { color: var(--color-prettylights-syntax-entity); } markdown-style .code-line .token.deleted { background-color: var(--color-prettylights-syntax-markup-deleted-bg); } markdown-style .token.inserted { color: var(--color-prettylights-syntax-markup-inserted-text); } markdown-style .code-line .token.inserted { background-color: var(--color-prettylights-syntax-markup-inserted-bg); } markdown-style .token.variable { color: var(--color-prettylights-syntax-constant); } markdown-style .token.entity, markdown-style .token.url, .language-css markdown-style .token.string, .style markdown-style .token.string { color: var(--color-prettylights-syntax-string); } markdown-style .token.color, markdown-style .token.atrule, markdown-style .token.attr-value, markdown-style .token.function, markdown-style .token.class-name { color: var(--color-prettylights-syntax-string); } markdown-style .token.rule, markdown-style .token.regex, markdown-style .token.important, markdown-style .token.keyword { color: var(--color-prettylights-syntax-keyword); } markdown-style .token.coord { color: var(--color-prettylights-syntax-meta-diff-range); } markdown-style .token.important, markdown-style .token.bold { font-weight: bold; } markdown-style .token.italic { font-style: italic; } markdown-style .token.entity { cursor: help; } markdown-style [data-catalyst] { display: block; }
|
|
29
|
+
markdown-style g-emoji { font-family: "Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"; font-size: 1em; font-style: normal !important; font-weight: 400; line-height: 1; vertical-align: -0.075em; } markdown-style g-emoji img { width: 1em; height: 1em; } markdown-style::before { display: table; content: ""; } markdown-style::after { display: table; clear: both; content: ""; } markdown-style>*:first-child { margin-top: 0 !important; } markdown-style>*:last-child { margin-bottom: 0 !important; } markdown-style a:not([href]) { color: inherit; text-decoration: none; } markdown-style .absent { color: var(--color-danger-fg); } markdown-style .anchor { float: left; padding-right: 4px; margin-left: -20px; line-height: 1; } markdown-style .anchor:focus { outline: none; } markdown-style p, markdown-style blockquote, markdown-style ul, markdown-style ol, markdown-style dl, markdown-style table, markdown-style pre, markdown-style details { margin-top: 0; margin-bottom: 16px; } markdown-style blockquote>:first-child { margin-top: 0; } markdown-style blockquote>:last-child { margin-bottom: 0; } markdown-style sup>a::before { content: "["; } markdown-style sup>a::after { content: "]"; } markdown-style h1 .octicon-link, markdown-style h2 .octicon-link, markdown-style h3 .octicon-link, markdown-style h4 .octicon-link, markdown-style h5 .octicon-link, markdown-style h6 .octicon-link { color: var(--color-fg-default); vertical-align: middle; visibility: hidden; } markdown-style h1:hover .anchor, markdown-style h2:hover .anchor, markdown-style h3:hover .anchor, markdown-style h4:hover .anchor, markdown-style h5:hover .anchor, markdown-style h6:hover .anchor { text-decoration: none; } markdown-style h1:hover .anchor .octicon-link, markdown-style h2:hover .anchor .octicon-link, markdown-style h3:hover .anchor .octicon-link, markdown-style h4:hover .anchor .octicon-link, markdown-style h5:hover .anchor .octicon-link, markdown-style h6:hover .anchor .octicon-link { visibility: visible; } markdown-style h1 tt, markdown-style h1 code, markdown-style h2 tt, markdown-style h2 code, markdown-style h3 tt, markdown-style h3 code, markdown-style h4 tt, markdown-style h4 code, markdown-style h5 tt, markdown-style h5 code, markdown-style h6 tt, markdown-style h6 code { padding: 0 .2em; font-size: inherit; } markdown-style ul.no-list, markdown-style ol.no-list { padding: 0; list-style-type: none; } markdown-style ol[type="1"] { list-style-type: decimal; } markdown-style ol[type=a] { list-style-type: lower-alpha; } markdown-style ol[type=i] { list-style-type: lower-roman; } markdown-style div>ol:not([type]) { list-style-type: decimal; } markdown-style ul ul, markdown-style ul ol, markdown-style ol ol, markdown-style ol ul { margin-top: 0; margin-bottom: 0; } markdown-style li>p { margin-top: 16px; } markdown-style li+li { margin-top: .25em; } markdown-style dl { padding: 0; } markdown-style dl dt { padding: 0; margin-top: 16px; font-size: 1em; font-style: italic; font-weight: 600; } markdown-style dl dd { padding: 0 16px; margin-bottom: 16px; } markdown-style table th { font-weight: 600; } markdown-style table th, markdown-style table td { padding: 6px 13px; border: 1px solid var(--color-border-default); } markdown-style table tr { background-color: var(--color-canvas-default); border-top: 1px solid var(--color-border-muted); } markdown-style table tr:nth-child(2n) { background-color: var(--color-canvas-subtle); } markdown-style table img { background-color: transparent; } markdown-style img[align=right] { padding-left: 20px; } markdown-style img[align=left] { padding-right: 20px; } markdown-style .emoji { max-width: none; vertical-align: text-top; background-color: transparent; } markdown-style span.frame { display: block; overflow: hidden; } markdown-style span.frame>span { display: block; float: left; width: auto; padding: 7px; margin: 13px 0 0; overflow: hidden; border: 1px solid var(--color-border-default); } markdown-style span.frame span img { display: block; float: left; } markdown-style span.frame span span { display: block; padding: 5px 0 0; clear: both; color: var(--color-fg-default); } markdown-style span.align-center { display: block; overflow: hidden; clear: both; } markdown-style span.align-center>span { display: block; margin: 13px auto 0; overflow: hidden; text-align: center; } markdown-style span.align-center span img { margin: 0 auto; text-align: center; } markdown-style span.align-right { display: block; overflow: hidden; clear: both; } markdown-style span.align-right>span { display: block; margin: 13px 0 0; overflow: hidden; text-align: right; } markdown-style span.align-right span img { margin: 0; text-align: right; } markdown-style span.float-left { display: block; float: left; margin-right: 13px; overflow: hidden; } markdown-style span.float-left span { margin: 13px 0 0; } markdown-style span.float-right { display: block; float: right; margin-left: 13px; overflow: hidden; } markdown-style span.float-right>span { display: block; margin: 13px auto 0; overflow: hidden; text-align: right; } markdown-style code, markdown-style tt { padding: .2em .4em; margin: 0; font-size: 85%; background-color: var(--color-neutral-muted); border-radius: 6px; } markdown-style code br, markdown-style tt br { display: none; } markdown-style del code { text-decoration: inherit; } markdown-style pre code { font-size: 100%; } markdown-style pre>code { padding: 0; margin: 0; word-break: normal; white-space: pre; background: transparent; border: 0; } markdown-style .highlight { margin-bottom: 16px; } markdown-style .highlight pre { margin-bottom: 0; word-break: normal; } markdown-style .highlight pre, markdown-style pre { position: relative; padding: 16px; overflow: auto; font-size: 85%; line-height: 1.45; background-color: var(--color-canvas-subtle); border-radius: 6px; } markdown-style pre code, markdown-style pre tt { display: inline; max-width: auto; padding: 0; margin: 0; overflow: visible; line-height: inherit; word-wrap: normal; background-color: transparent; border: 0; } markdown-style .csv-data td, markdown-style .csv-data th { padding: 5px; overflow: hidden; font-size: 12px; line-height: 1; text-align: left; white-space: nowrap; } markdown-style .csv-data .blob-num { padding: 10px 8px 9px; text-align: right; background: var(--color-canvas-default); border: 0; } markdown-style .csv-data tr { border-top: 0; } markdown-style .csv-data th { font-weight: 600; background: var(--color-canvas-subtle); border-top: 0; } markdown-style .footnotes { font-size: 12px; color: var(--color-fg-muted); border-top: 1px solid var(--color-border-default); } markdown-style .footnotes ol { padding-left: 16px; } markdown-style .footnotes li { position: relative; } markdown-style .footnotes li:target::before { position: absolute; top: -8px; right: -8px; bottom: -8px; left: -24px; pointer-events: none; content: ""; border: 2px solid var(--color-accent-emphasis); border-radius: 6px; } markdown-style .footnotes li:target { color: var(--color-fg-default); } markdown-style .footnotes .data-footnote-backref g-emoji { font-family: monospace; } markdown-style .task-list-item { list-style-type: none; } markdown-style .task-list-item label { font-weight: 400; } markdown-style .task-list-item.enabled label { cursor: pointer; } markdown-style .task-list-item+.task-list-item { margin-top: 3px; } markdown-style .task-list-item .handle { display: none; } markdown-style .task-list-item-checkbox, markdown-style input[type="checkbox"] { margin: 0 .2em .25em -1.6em; vertical-align: middle; } markdown-style .contains-task-list:dir(rtl) .task-list-item-checkbox, markdown-style .contains-task-list:dir(rtl) input[type="checkbox"] { margin: 0 -1.6em .25em .2em; } markdown-style ::-webkit-calendar-picker-indicator { filter: invert(50%); }
|
|
15
30
|
</style>
|
|
31
|
+
<slot></slot>
|
|
16
32
|
\`;
|
|
17
|
-
// See https://html.spec.whatwg.org/multipage/common-dom-interfaces.html
|
|
18
|
-
// #reflecting-content-attributes-in-idl-attributes.
|
|
19
|
-
const installStringReflection = (obj, attrName, propName = attrName) => {
|
|
20
|
-
Object.defineProperty(obj, propName, {
|
|
21
|
-
enumerable: true,
|
|
22
|
-
get() {
|
|
23
|
-
const value = this.getAttribute(attrName);
|
|
24
|
-
return value === null ? '' : value;
|
|
25
|
-
},
|
|
26
|
-
set(v) {
|
|
27
|
-
this.setAttribute(attrName, v);
|
|
28
|
-
},
|
|
29
|
-
});
|
|
30
|
-
};
|
|
31
33
|
class MarkdownStyle extends HTMLElement {
|
|
32
34
|
constructor() {
|
|
33
35
|
super();
|
|
34
36
|
this.initTheme = this.getAttribute('theme');
|
|
35
37
|
this.shadow = this.attachShadow({ mode: 'open' });
|
|
36
38
|
this.shadow.appendChild(__TEMPLATE__.content.cloneNode(true));
|
|
37
|
-
this.warpper = document.createElement('div');
|
|
38
|
-
this.warpper.classList.add('markdown-body');
|
|
39
|
-
this.shadow.appendChild(this.warpper);
|
|
40
39
|
this.setTheme();
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
40
|
+
const style = Array.prototype.slice
|
|
41
|
+
.call(this.shadow.children)
|
|
42
|
+
.find((item) => item.tagName === 'STYLE');
|
|
43
|
+
if (style) {
|
|
44
|
+
const id = '__MARKDOWN_STYLE__';
|
|
45
|
+
const findStyle = document.getElementById(id);
|
|
46
|
+
if (!findStyle) {
|
|
47
|
+
style.id = id;
|
|
48
|
+
document.head.append(style);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
47
51
|
}
|
|
48
52
|
setTheme() {
|
|
49
53
|
if (!this.initTheme) {
|
|
@@ -58,10 +62,9 @@ class MarkdownStyle extends HTMLElement {
|
|
|
58
62
|
}
|
|
59
63
|
}
|
|
60
64
|
}
|
|
61
|
-
this.warpper.setAttribute('data-color-mode', this.theme);
|
|
62
65
|
}
|
|
63
66
|
connectedCallback() {
|
|
64
|
-
installStringReflection(
|
|
67
|
+
this.installStringReflection('theme');
|
|
65
68
|
if (!this.initTheme) {
|
|
66
69
|
this.setTheme();
|
|
67
70
|
const observer = new MutationObserver((mutationsList, observer) => {
|
|
@@ -80,11 +83,27 @@ class MarkdownStyle extends HTMLElement {
|
|
|
80
83
|
};
|
|
81
84
|
}
|
|
82
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* See https://html.spec.whatwg.org/multipage/common-dom-interfaces.html
|
|
88
|
+
* #reflecting-content-attributes-in-idl-attributes.
|
|
89
|
+
*/
|
|
90
|
+
installStringReflection(attrName, propName = attrName) {
|
|
91
|
+
Object.defineProperty(this, propName, {
|
|
92
|
+
enumerable: true,
|
|
93
|
+
get() {
|
|
94
|
+
const value = this.getAttribute(attrName);
|
|
95
|
+
return value === null ? '' : value;
|
|
96
|
+
},
|
|
97
|
+
set(v) {
|
|
98
|
+
this.setAttribute(attrName, v);
|
|
99
|
+
},
|
|
100
|
+
});
|
|
101
|
+
}
|
|
83
102
|
}
|
|
84
103
|
customElements.define('markdown-style', MarkdownStyle);
|
|
85
104
|
`
|
|
86
105
|
|
|
87
|
-
export function markdownStyle(child: ElementContent[], markdownStyleTheme
|
|
106
|
+
export function markdownStyle(child: ElementContent[], markdownStyleTheme?: 'dark' | 'light'): Element[] {
|
|
88
107
|
const properties: Record<string, string> = {
|
|
89
108
|
style: 'max-width: 960px; margin: 0 auto 60px auto; padding: 8px',
|
|
90
109
|
className: 'markdown-body',
|