@abreen/tada 1.17.0 → 1.18.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 +41 -7
- package/bin/tada.ts +23 -9
- package/bin/validators.ts +34 -1
- package/build/branding.ts +41 -0
- package/build/build-manifest.ts +10 -5
- package/build/{watch/compiler-types.d.ts → build-types.d.ts} +8 -5
- package/build/build-validation.ts +176 -0
- package/build/bundle.ts +75 -65
- package/build/columns-plugin.ts +27 -1
- package/build/config-loader.ts +3 -3
- package/build/custom-fonts.ts +8 -5
- package/build/deflist-id-plugin.ts +2 -2
- package/build/generate-favicon.ts +7 -6
- package/build/generate-fonts.ts +8 -15
- package/build/generate-katex-assets.ts +19 -17
- package/build/generate-web-app-manifest.ts +3 -11
- package/build/lodash-template.ts +14 -0
- package/build/output-publication.ts +238 -0
- package/build/pagefind.ts +49 -21
- package/build/pdf-text.ts +41 -1
- package/build/pipeline.ts +95 -101
- package/build/site-assets.ts +46 -0
- package/build/site-build.ts +267 -0
- package/build/source-model.ts +223 -229
- package/build/source-records.ts +69 -81
- package/build/template-globals.ts +3 -0
- package/build/templates.ts +12 -8
- package/build/toc-plugin.ts +21 -21
- package/build/types.d.ts +38 -38
- package/build/util.ts +0 -4
- package/build/utils/code.ts +51 -117
- package/build/utils/final-html.ts +171 -47
- package/build/utils/jdi-runner/LiterateRunner.java +9 -1
- package/build/utils/literate-java.ts +11 -7
- package/build/utils/markdown-partials.ts +4 -3
- package/build/utils/markdown.ts +6 -17
- package/build/utils/paths.ts +3 -0
- package/build/utils/plain-text.ts +18 -0
- package/build/utils/render.ts +197 -154
- package/build/utils/shiki-highlighter.ts +11 -0
- package/build/utils/source-template.ts +2 -2
- package/build/utils/trace-core.ts +8 -83
- package/build/utils/trace.ts +38 -95
- package/build/validate-config-links.ts +39 -6
- package/build/watch/build-incremental.ts +46 -103
- package/build/watch/compiler.ts +158 -37
- package/build/watch/engine.ts +207 -162
- package/build/watch/index.ts +9 -2
- package/build/watch/planner.ts +88 -144
- package/build/watch/runtime.ts +21 -34
- package/build/watch/types.d.ts +32 -64
- package/package.json +4 -5
- package/schema/site.schema.json +18 -2
- package/src/_content.scss +447 -0
- package/src/_fonts.scss +90 -0
- package/src/_layout.scss +50 -35
- package/src/appearance-picker/{style.scss → _index.scss} +1 -1
- package/src/code/{style.scss → _index.scss} +61 -0
- package/src/header/{_base.scss → _index.scss} +98 -6
- package/src/index.ts +1 -17
- package/src/navigate/{style.scss → _index.scss} +20 -0
- package/src/navigate/eligible.ts +0 -40
- package/src/navigate/index.ts +50 -5
- package/src/navigate/lifecycle.ts +19 -2
- package/src/navigate/runtime.ts +20 -4
- package/src/page-update/index.ts +33 -20
- package/src/print/{style.scss → _index.scss} +3 -1
- package/src/search/index.ts +30 -2
- package/src/slides/{style.scss → _index.scss} +5 -0
- package/src/style.scss +24 -536
- package/src/timezone/index.ts +29 -3
- package/src/timezone/time-format.ts +4 -0
- package/src/toc/index.ts +6 -5
- package/src/trace/index.ts +11 -1
- package/templates/_author.html +2 -2
- package/templates/_download.html +1 -1
- package/templates/_footer.html +1 -1
- package/templates/_heading.html +3 -3
- package/templates/_nav.html +2 -2
- package/templates/_page-bottom.html +6 -0
- package/templates/_top.html +18 -14
- package/templates/code.html +22 -21
- package/templates/default.html +12 -11
- package/templates/literate.html +6 -5
- package/build/copy.ts +0 -82
- package/build/generate-content-assets.ts +0 -121
- package/build/utils/content-files.ts +0 -170
- package/build/watch/assets.ts +0 -103
- package/build/watch/build-full.ts +0 -97
- package/build/watch/build-helpers.ts +0 -66
- package/build/watch/build-result.ts +0 -19
- package/build/watch/fs-commit.ts +0 -153
- package/build/watch/mutations.ts +0 -73
- package/build/watch/snapshot.ts +0 -201
- package/build/watch/validation.ts +0 -50
- package/src/code.scss +0 -60
- package/src/critical.scss +0 -5
- package/src/header/style.scss +0 -91
- /package/src/{literate.scss → _literate.scss} +0 -0
- /package/src/{material-symbols.scss → _material-symbols.scss} +0 -0
- /package/src/anchor/{style.scss → _index.scss} +0 -0
- /package/src/page-update/{style.scss → _index.scss} +0 -0
- /package/src/question/{style.scss → _index.scss} +0 -0
- /package/src/search/{style.scss → _index.scss} +0 -0
- /package/src/timezone/{style.scss → _index.scss} +0 -0
- /package/src/toc/{style.scss → _index.scss} +0 -0
- /package/src/trace/{style.scss → _index.scss} +0 -0
package/build/utils/markdown.ts
CHANGED
|
@@ -7,7 +7,6 @@ import markdownItAnchor from 'markdown-it-anchor';
|
|
|
7
7
|
import markdownItFootnote from 'markdown-it-footnote';
|
|
8
8
|
import markdownItDeflist from 'markdown-it-deflist';
|
|
9
9
|
import markdownItContainer from 'markdown-it-container';
|
|
10
|
-
import textToId, { deduplicateId } from '../text-to-id';
|
|
11
10
|
import { highlightCode } from './shiki-highlighter';
|
|
12
11
|
import { isBundledLanguage, isPlainTextLanguage } from '../site-variables';
|
|
13
12
|
import headingSubtitlePlugin from '../heading-subtitle-plugin';
|
|
@@ -28,10 +27,11 @@ interface CreateMarkdownOptions {
|
|
|
28
27
|
filePath?: string;
|
|
29
28
|
slides?: boolean;
|
|
30
29
|
validatorOptions?: Record<string, unknown>;
|
|
31
|
-
literateJavaOutputPaths?:
|
|
30
|
+
literateJavaOutputPaths?: ReadonlySet<string>;
|
|
32
31
|
sourceUrlPath?: string;
|
|
33
|
-
validTargets?:
|
|
32
|
+
validTargets?: ReadonlySet<string>;
|
|
34
33
|
templateParams?: Record<string, unknown>;
|
|
34
|
+
preserveHtmlComments?: boolean;
|
|
35
35
|
dependencyCollector?: RenderDependencyCollector;
|
|
36
36
|
}
|
|
37
37
|
|
|
@@ -102,6 +102,7 @@ export function createMarkdown(
|
|
|
102
102
|
markdown.use(markdownPartialsPlugin, {
|
|
103
103
|
filePath,
|
|
104
104
|
templateParams: options.templateParams,
|
|
105
|
+
preserveHtmlComments: options.preserveHtmlComments,
|
|
105
106
|
dependencyCollector: options.dependencyCollector,
|
|
106
107
|
});
|
|
107
108
|
}
|
|
@@ -458,18 +459,12 @@ export function createMarkdown(
|
|
|
458
459
|
state.tokens = transformedTokens;
|
|
459
460
|
});
|
|
460
461
|
|
|
461
|
-
const usedIds = new Map<string, number>();
|
|
462
462
|
markdown.use(markdownItContainer, 'alert', {
|
|
463
463
|
marker: '!',
|
|
464
464
|
validate: function (params: string) {
|
|
465
465
|
return ALERT_PATTERN.test(params.trim());
|
|
466
466
|
},
|
|
467
|
-
render: function (
|
|
468
|
-
tokens: Token[],
|
|
469
|
-
idx: number,
|
|
470
|
-
_options: unknown,
|
|
471
|
-
env: Record<string, unknown>,
|
|
472
|
-
) {
|
|
467
|
+
render: function (tokens: Token[], idx: number) {
|
|
473
468
|
const matches = tokens[idx].info.trim().match(ALERT_PATTERN);
|
|
474
469
|
|
|
475
470
|
if (tokens[idx].nesting === 1) {
|
|
@@ -483,13 +478,7 @@ export function createMarkdown(
|
|
|
483
478
|
const displayTitle = title
|
|
484
479
|
? markdown.utils.escapeHtml(curlyQuote(title))
|
|
485
480
|
: capitalize(type || '');
|
|
486
|
-
const
|
|
487
|
-
const titleId = deduplicateId(usedIds, baseId);
|
|
488
|
-
|
|
489
|
-
if (!env.alertIds) {
|
|
490
|
-
env.alertIds = [];
|
|
491
|
-
}
|
|
492
|
-
(env.alertIds as string[]).push(titleId);
|
|
481
|
+
const titleId = tokens[idx].attrGet('id')!;
|
|
493
482
|
|
|
494
483
|
let html = `<div class="${classNames.join(' ')}">`;
|
|
495
484
|
html += `<p class="title" id="${titleId}">${displayTitle}</p>\n`;
|
package/build/utils/paths.ts
CHANGED
|
@@ -2,6 +2,9 @@ import path from 'path';
|
|
|
2
2
|
import { globals } from '../globals';
|
|
3
3
|
import type { SiteVariables } from '../types';
|
|
4
4
|
|
|
5
|
+
/** The search index directory inside the output directory */
|
|
6
|
+
export const SEARCH_INDEX_DIR = 'pagefind';
|
|
7
|
+
|
|
5
8
|
export function getPackageDir(): string {
|
|
6
9
|
return path.resolve(import.meta.dir, '..', '..');
|
|
7
10
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { decodeHTML } from 'entities';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Converts rendered inline HTML (such as a front matter title rendered as
|
|
5
|
+
* Markdown) into the plain text a reader sees: tags and comments are removed
|
|
6
|
+
* by an HTML parser, and character references are decoded exactly once.
|
|
7
|
+
*/
|
|
8
|
+
export function htmlToPlainText(html: string): string {
|
|
9
|
+
let text = '';
|
|
10
|
+
new HTMLRewriter()
|
|
11
|
+
.onDocument({
|
|
12
|
+
text(chunk) {
|
|
13
|
+
text += chunk.text;
|
|
14
|
+
},
|
|
15
|
+
})
|
|
16
|
+
.transform(html);
|
|
17
|
+
return decodeHTML(text);
|
|
18
|
+
}
|