svelte-readme 4.0.1 → 4.2.0
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/README.md +31 -1
- package/dist/highlight/shared.d.ts +1 -0
- package/dist/index.js +176 -32
- package/dist/layout.css +183 -9
- package/dist/shared.css +21 -0
- package/dist/style.css +371 -191
- package/dist/styles/index.d.ts +1 -2
- package/dist/svelte.css +14 -0
- package/dist/typescript.css +13 -0
- package/dist/utils/purgeCss.d.ts +1 -1
- package/dist/yaml.css +4 -0
- package/package.json +1 -1
- package/dist/button.css +0 -28
package/README.md
CHANGED
|
@@ -25,7 +25,7 @@ At its core, this library is a simple Svelte preprocessor.
|
|
|
25
25
|
2. Use `README.md` as the Svelte source code
|
|
26
26
|
3. Parse Markdown using [Markdown It](https://github.com/markdown-it/markdown-it)
|
|
27
27
|
4. Highlight code with a built-in highlighter (`svelte`, `typescript`/`javascript`, `json`, `yaml`, `bash`) and run `svelte` code fence blocks so that demos are juxtaposed with code
|
|
28
|
-
5. Style the result with
|
|
28
|
+
5. Style the result with a built-in, themeable stylesheet inspired by GitHub's markdown rendering
|
|
29
29
|
|
|
30
30
|
## Installation
|
|
31
31
|
|
|
@@ -130,6 +130,36 @@ interface SvelteReadmeOptions {
|
|
|
130
130
|
}
|
|
131
131
|
```
|
|
132
132
|
|
|
133
|
+
### Custom fonts
|
|
134
|
+
|
|
135
|
+
Load fonts from a CDN via `head`, then point the library's `--sr-font-sans` (body text) and `--sr-font-mono` (code snippets) custom properties (see [style.css](src/styles/style.css)) at them via `style`:
|
|
136
|
+
|
|
137
|
+
```ts
|
|
138
|
+
import { svelteReadme } from "svelte-readme";
|
|
139
|
+
import { defineConfig } from "vite";
|
|
140
|
+
|
|
141
|
+
export default defineConfig({
|
|
142
|
+
plugins: [
|
|
143
|
+
svelteReadme({
|
|
144
|
+
head: `
|
|
145
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
146
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
147
|
+
<link
|
|
148
|
+
href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&family=Public+Sans:wght@400;500;600;700&display=swap"
|
|
149
|
+
rel="stylesheet"
|
|
150
|
+
/>
|
|
151
|
+
`,
|
|
152
|
+
style: `
|
|
153
|
+
:root {
|
|
154
|
+
--sr-font-sans: "Public Sans", system-ui, sans-serif;
|
|
155
|
+
--sr-font-mono: "JetBrains Mono", ui-monospace, monospace;
|
|
156
|
+
}
|
|
157
|
+
`,
|
|
158
|
+
}),
|
|
159
|
+
],
|
|
160
|
+
});
|
|
161
|
+
```
|
|
162
|
+
|
|
133
163
|
## Changelog
|
|
134
164
|
|
|
135
165
|
[CHANGELOG.md](CHANGELOG.md)
|
|
@@ -6,6 +6,7 @@ export type Claim = {
|
|
|
6
6
|
export type GapFill = (text: string) => string;
|
|
7
7
|
export declare function escapeHtml(text: string): string;
|
|
8
8
|
export declare function token(className: string, text: string): string;
|
|
9
|
+
export declare function readGrammarCss(moduleUrl: string, filename: string): string;
|
|
9
10
|
export declare const baseTokenStyles: string;
|
|
10
11
|
export declare function renderClaims(source: string, claims: Claim[], gapFill: GapFill): string;
|
|
11
12
|
export declare function gapFill(text: string): string;
|