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 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 [GitHub Markdown CSS](https://github.com/sindresorhus/github-markdown-css) to maintain a consistent look with [github.com](https://github.com/)
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;