@lincyaw/render-slides 1.0.0-rc.0 → 1.0.0-rc.10

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.
@@ -1,215 +0,0 @@
1
- .pm-slide-section {
2
- display: contents;
3
- }
4
-
5
- .pm-book__content > .pm-slide-section > .pm-block > :is(p, ul, ol, blockquote),
6
- .pm-book__content > .pm-slide-section > .pm-block > .slidev-vclick-target > :is(p, ul, ol, blockquote) {
7
- font-family: var(--pm-font-serif);
8
- }
9
-
10
- .pm-book--cover .pm-book__content > .pm-slide-section > .pm-block > :is(p, ul, ol) {
11
- max-width: 80%;
12
- color: var(--pm-color-muted);
13
- font-size: 20px;
14
- }
15
-
16
- .slidev-layout .pm-role-mark {
17
- display: none;
18
- }
19
-
20
- html.pm-author-marks .slidev-layout .pm-role-mark {
21
- display: inline;
22
- margin: 0 0.15em;
23
- padding: 0 0.2em;
24
- border-radius: 3px;
25
- font-size: 0.85em;
26
- color: var(--pm-color-muted);
27
- background: var(--pm-color-sunk);
28
- }
29
-
30
- html.pm-author-marks .slidev-layout .pm-role-mark::before {
31
- content: attr(data-mark);
32
- }
33
-
34
- .slidev-layout .pm-code-origin {
35
- display: flex;
36
- flex-wrap: wrap;
37
- align-items: baseline;
38
- gap: 0.5rem;
39
- margin: 0.5rem 0 0.25rem;
40
- font-size: 0.7em;
41
- }
42
-
43
- .slidev-layout .pm-code-origin__file,
44
- .slidev-layout .pm-code-origin__commit,
45
- .slidev-layout .pm-code-origin__variant {
46
- font-family: var(--slidev-code-font-family, ui-monospace, monospace);
47
- overflow-wrap: anywhere;
48
- }
49
-
50
- .slidev-layout .pm-code-origin__variant[data-active] {
51
- font-weight: 700;
52
- text-decoration: underline;
53
- }
54
-
55
- .slidev-layout .pm-code-origin__badge {
56
- padding: 0 0.4em;
57
- border: 1px solid currentColor;
58
- border-radius: 999px;
59
- color: var(--pm-color-ok);
60
- }
61
-
62
- .slidev-layout .pm-code-origin__badge:is([data-drift='drifted'], [data-status]) {
63
- color: var(--pm-color-warn);
64
- }
65
-
66
- .slidev-layout .pm-output__image {
67
- max-width: 100%;
68
- max-height: 60vh;
69
- }
70
-
71
- .slidev-layout .pm-output__html {
72
- max-width: 100%;
73
- overflow-x: auto;
74
- font-size: 0.8em;
75
- }
76
-
77
- .slidev-layout .pm-output__html table {
78
- margin: 0;
79
- border-collapse: collapse;
80
- font-variant-numeric: tabular-nums;
81
- }
82
-
83
- .slidev-layout .pm-output__html :is(th, td) {
84
- padding: 0.15em 0.6em;
85
- border-bottom: 1px solid var(--pm-color-line);
86
- text-align: right;
87
- }
88
-
89
- .slidev-layout .pm-grid {
90
- display: grid;
91
- grid-template-columns: repeat(var(--pm-grid-columns, 1), minmax(0, 1fr));
92
- gap: 0.75rem;
93
- margin: 0.75rem 0;
94
- }
95
-
96
- .slidev-layout .pm-card {
97
- position: relative;
98
- display: flex;
99
- flex-direction: column;
100
- padding: 0 0.75rem;
101
- border: 1px solid var(--pm-color-line);
102
- border-radius: var(--pm-radius-card);
103
- background: var(--pm-color-surface);
104
- font-size: 0.85em;
105
- }
106
-
107
- .slidev-layout .pm-card__title {
108
- font-weight: 700;
109
- }
110
-
111
- .slidev-layout :is(.pm-card__header, .pm-card__footer) {
112
- margin: 0 -0.75rem;
113
- padding: 0 0.75rem;
114
- background: var(--pm-color-sunk);
115
- }
116
-
117
- .slidev-layout .pm-card__footer {
118
- margin-top: auto;
119
- }
120
-
121
- .slidev-layout .pm-card--link a {
122
- position: relative;
123
- z-index: 1;
124
- }
125
-
126
- .slidev-layout .pm-card--link .pm-card__title a {
127
- position: static;
128
- }
129
-
130
- .slidev-layout .pm-card--link .pm-card__title a::after {
131
- content: '';
132
- position: absolute;
133
- inset: 0;
134
- }
135
-
136
- .slidev-layout .pm-button a,
137
- .slidev-layout .pm-button--text {
138
- display: inline-block;
139
- padding: 0.15em 0.8em;
140
- border: 1px solid currentColor;
141
- border-radius: 999px;
142
- text-decoration: none;
143
- }
144
-
145
- .slidev-layout .pm-tabs__title {
146
- margin-top: 0.75rem;
147
- font-weight: 700;
148
- }
149
-
150
- .slidev-layout .slidev-monaco-container .opacity-50 {
151
- opacity: 0.75;
152
- }
153
-
154
- .slidev-layout .slidev-monaco-container-inner {
155
- max-height: 15em;
156
- }
157
-
158
- .slidev-layout .slidev-runner-output {
159
- max-height: 7.5em;
160
- overflow: auto;
161
- border-radius: var(--slidev-code-radius, 6px);
162
- background: var(--pm-color-sunk);
163
- color: var(--pm-color-ink);
164
- }
165
-
166
- .slidev-layout .pm-run-recorded {
167
- display: inline-block;
168
- margin-bottom: 0.25em;
169
- padding: 0 0.4em;
170
- border-radius: var(--pm-radius-chip);
171
- background: var(--pm-color-warn-soft);
172
- color: var(--pm-color-warn);
173
- }
174
-
175
- .slidev-layout .pm-run-image {
176
- max-width: 100%;
177
- max-height: 50vh;
178
- }
179
-
180
- .slidev-layout :is(.pm-run-stderr, .pm-run-dropped) {
181
- color: var(--pm-color-danger);
182
- }
183
-
184
- .slidev-layout .pm-run-text {
185
- margin: 0;
186
- white-space: pre-wrap;
187
- }
188
-
189
- .print-slide-container {
190
- contain: strict;
191
- overflow: clip !important;
192
- }
193
-
194
- .print-slide-container .slidev-layout:has(> .pm-slide-section > .pm-block > .pm-static-fallback > .slidev-code-wrapper:last-child) {
195
- display: flex;
196
- flex-direction: column;
197
- }
198
-
199
- .print-slide-container .slidev-layout > .pm-slide-section > .pm-block:has(> .pm-static-fallback > .slidev-code-wrapper:last-child),
200
- .print-slide-container .slidev-layout > .pm-slide-section > .pm-block > .pm-static-fallback:has(> .slidev-code-wrapper:last-child) {
201
- display: flex;
202
- flex-direction: column;
203
- min-height: 0;
204
- }
205
-
206
- .print-slide-container .pm-static-fallback:has(> .slidev-code-wrapper:last-child) > :not(:last-child) {
207
- min-height: 0;
208
- overflow: hidden;
209
- }
210
-
211
- .print-slide-container .pm-static-fallback > .slidev-code-wrapper:last-child {
212
- flex-shrink: 0;
213
- }
214
-
215
- .pm-step-range.slidev-vclick-hidden { display: none !important; }
package/src/node/html.ts DELETED
@@ -1,15 +0,0 @@
1
- import { createRequire } from 'node:module'
2
-
3
- const require = createRequire(import.meta.url)
4
-
5
- let purify: ((html: string) => string) | undefined
6
-
7
- export function sanitizedHtml(html: string): string {
8
- if (!purify) {
9
- const { JSDOM } = require('jsdom') as { JSDOM: new (html: string) => { window: unknown } }
10
- const createDOMPurify = require('dompurify') as (window: unknown) => { sanitize(html: string, config: { FORBID_TAGS: string[] }): string }
11
- const instance = createDOMPurify(new JSDOM('').window)
12
- purify = text => instance.sanitize(text, { FORBID_TAGS: ['style'] })
13
- }
14
- return purify(html)
15
- }
@@ -1,20 +0,0 @@
1
- import type { MdastNode } from '@lincyaw/kernel'
2
- import { gfmToMarkdown } from 'mdast-util-gfm'
3
- import { toMarkdown } from 'mdast-util-to-markdown'
4
- import type { Options } from 'mdast-util-to-markdown'
5
- import { bundledLanguages } from 'shiki/langs'
6
-
7
- const OPTIONS = {
8
- bullet: '-',
9
- extensions: [gfmToMarkdown()],
10
- unsafe: [{ character: '$', inConstruct: 'phrasing' }],
11
- } as unknown as Options
12
-
13
- export function markdown(tree: MdastNode): string {
14
- return toMarkdown(tree as Parameters<typeof toMarkdown>[0], OPTIONS).trim()
15
- }
16
-
17
- export function codeLang(lang: unknown): string {
18
- const name = typeof lang === 'string' ? lang.toLowerCase() : ''
19
- return name in bundledLanguages ? name : 'text'
20
- }