@ox-content/napi 3.0.0-alpha.10 → 3.0.0-alpha.12
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/index.d.ts +435 -1
- package/index.js +12 -0
- package/package.json +8 -8
package/index.d.ts
CHANGED
|
@@ -149,6 +149,12 @@ export declare function extractSsgTitle(content: string, frontmatterTitle?: stri
|
|
|
149
149
|
*/
|
|
150
150
|
export declare function extractTranslationKeys(source: string, filePath: string, functionNames?: Array<string> | undefined | null): Array<I18NKeyUsage>
|
|
151
151
|
|
|
152
|
+
/**
|
|
153
|
+
* Extracts a YouTube video id from a bare id or a watch / share / embed /
|
|
154
|
+
* shorts URL, returning `null` when the input names no video.
|
|
155
|
+
*/
|
|
156
|
+
export declare function extractYoutubeVideoId(input: string): string | null
|
|
157
|
+
|
|
152
158
|
/** Formats a file or directory segment as an SSG title. */
|
|
153
159
|
export declare function formatSsgTitle(name: string): string
|
|
154
160
|
|
|
@@ -172,6 +178,9 @@ export declare function generateDocsNavMetadata(files: Array<string>, basePath?:
|
|
|
172
178
|
*/
|
|
173
179
|
export declare function generateDocsNavMetadataFromDocs(docs: Array<JsDocsMarkdownModule>, options?: JsDocsNavOptions | undefined | null): Array<JsDocsNavItem>
|
|
174
180
|
|
|
181
|
+
/** Builds RSS / Atom / JSON Feed bodies without writing files. */
|
|
182
|
+
export declare function generateFeedBodies(options: JsFeedsOptions, items: Array<JsFeedItem>): JsFeedsOutput
|
|
183
|
+
|
|
175
184
|
/** Generates the `virtual:ox-content/i18n` runtime module. */
|
|
176
185
|
export declare function generateI18nModule(dictDir: string, config: JsI18NRuntimeConfig): string
|
|
177
186
|
|
|
@@ -192,6 +201,9 @@ export declare function generateSearchModule(optionsJson: string, indexPath: str
|
|
|
192
201
|
/** Generates the client-side search runtime module from typed options. */
|
|
193
202
|
export declare function generateSearchModuleFromOptions(options: JsSearchRuntimeOptions, indexPath: string): string
|
|
194
203
|
|
|
204
|
+
/** Builds `sitemap.xml`, `robots.txt`, and `llms.txt` bodies without writing files. */
|
|
205
|
+
export declare function generateSiteMapBodies(options: JsSiteMapsOptions, pages: Array<JsSiteMapPage>): JsSiteMapsOutput
|
|
206
|
+
|
|
195
207
|
/** Generates a bare SSG HTML page without navigation or styles. */
|
|
196
208
|
export declare function generateSsgBareHtml(content: string, title: string): string
|
|
197
209
|
|
|
@@ -332,6 +344,9 @@ export interface IncrementalMarkdownRenderResult {
|
|
|
332
344
|
errors: Array<string>
|
|
333
345
|
}
|
|
334
346
|
|
|
347
|
+
/** Same-origin path check: leading `/`, not `//`, and no scheme. */
|
|
348
|
+
export declare function isSafeRedirectDest(value: string): boolean
|
|
349
|
+
|
|
335
350
|
/** Opt-in skip link and print styles. Presence of the object enables the feature. */
|
|
336
351
|
export interface JsA11y {
|
|
337
352
|
/** Override for the skip-link label. Empty / omitted uses "Skip to content". */
|
|
@@ -487,6 +502,22 @@ export interface JsCollectionDefinition {
|
|
|
487
502
|
include: Array<string>
|
|
488
503
|
}
|
|
489
504
|
|
|
505
|
+
/** Opt-in static `::: if` / `::: else` conditional blocks. */
|
|
506
|
+
export interface JsConditionalBlockOptions {
|
|
507
|
+
/**
|
|
508
|
+
* Enable conditional block evaluation.
|
|
509
|
+
*
|
|
510
|
+
* Default: `true` when the options object is supplied.
|
|
511
|
+
*/
|
|
512
|
+
enabled?: boolean
|
|
513
|
+
/**
|
|
514
|
+
* Build-time values available as `config.*` or bare identifiers.
|
|
515
|
+
*
|
|
516
|
+
* Default: `{}`.
|
|
517
|
+
*/
|
|
518
|
+
values?: Record<string, any>
|
|
519
|
+
}
|
|
520
|
+
|
|
490
521
|
/** Opt-in `::: tip` custom containers. */
|
|
491
522
|
export interface JsContainerOptions {
|
|
492
523
|
/**
|
|
@@ -507,6 +538,49 @@ export interface JsContainerTypeOptions {
|
|
|
507
538
|
tag?: string
|
|
508
539
|
}
|
|
509
540
|
|
|
541
|
+
/** One rule the document broke. */
|
|
542
|
+
export interface JsCrossReferenceDiagnostic {
|
|
543
|
+
/** `"error"` or `"warn"`, as the options asked. */
|
|
544
|
+
policy: string
|
|
545
|
+
message: string
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
/** One numbered target the document defines. */
|
|
549
|
+
export interface JsCrossReferenceEntry {
|
|
550
|
+
id: string
|
|
551
|
+
/** `"figure"`, `"table"`, or `"section"`. */
|
|
552
|
+
kind: string
|
|
553
|
+
number: string
|
|
554
|
+
label: string
|
|
555
|
+
text: string
|
|
556
|
+
href: string
|
|
557
|
+
title?: string
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
/** The word placed before each number, per kind. */
|
|
561
|
+
export interface JsCrossReferenceLabels {
|
|
562
|
+
figure?: string
|
|
563
|
+
table?: string
|
|
564
|
+
section?: string
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
/** The annotated HTML, what it defined, and what it got wrong. */
|
|
568
|
+
export interface JsCrossReferenceOutput {
|
|
569
|
+
html: string
|
|
570
|
+
references: Array<JsCrossReferenceEntry>
|
|
571
|
+
diagnostics: Array<JsCrossReferenceDiagnostic>
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
/** Switches and labels for the cross-reference pass. */
|
|
575
|
+
export interface JsCrossReferencesOptions {
|
|
576
|
+
enabled: boolean
|
|
577
|
+
/** `"warn"` reports and carries on; anything else fails the build. */
|
|
578
|
+
missing?: string
|
|
579
|
+
duplicates?: string
|
|
580
|
+
mismatches?: string
|
|
581
|
+
labels?: JsCrossReferenceLabels
|
|
582
|
+
}
|
|
583
|
+
|
|
510
584
|
/** Opt-in static `csv-table` / `json-table` fences. */
|
|
511
585
|
export interface JsDataTableOptions {
|
|
512
586
|
/**
|
|
@@ -824,6 +898,34 @@ export interface JsEditThisPageOptions {
|
|
|
824
898
|
label?: string
|
|
825
899
|
}
|
|
826
900
|
|
|
901
|
+
/**
|
|
902
|
+
* Transform opt-in static media embed components in already-rendered HTML.
|
|
903
|
+
* One tag an enabled provider refused, and what the transform did instead.
|
|
904
|
+
*/
|
|
905
|
+
export interface JsEmbedDiagnostic {
|
|
906
|
+
/** Tag name as the provider registers it, for example `speakerdeck`. */
|
|
907
|
+
provider: string
|
|
908
|
+
/** The URL the tag carried, when it carried one worth naming. */
|
|
909
|
+
url?: string
|
|
910
|
+
/** 1-based line of the opening tag in the transformed HTML. */
|
|
911
|
+
line: number
|
|
912
|
+
/**
|
|
913
|
+
* `"linked"` when the tag became a plain link, `"kept"` when its markup
|
|
914
|
+
* was left as authored.
|
|
915
|
+
*/
|
|
916
|
+
fallback: string
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
/** One provider tag as authors write it. */
|
|
920
|
+
export interface JsEmbedTag {
|
|
921
|
+
name: string
|
|
922
|
+
/**
|
|
923
|
+
* True when only the PascalCase spelling is an embed, because the
|
|
924
|
+
* lowercase one is a real HTML element.
|
|
925
|
+
*/
|
|
926
|
+
pascalOnly: boolean
|
|
927
|
+
}
|
|
928
|
+
|
|
827
929
|
/** Emoji-shortcode transform options. */
|
|
828
930
|
export interface JsEmojiShortcodeOptions {
|
|
829
931
|
/**
|
|
@@ -934,6 +1036,65 @@ export interface JsFeatureConfig {
|
|
|
934
1036
|
linkText?: string
|
|
935
1037
|
}
|
|
936
1038
|
|
|
1039
|
+
/** A file carried alongside a feed item. */
|
|
1040
|
+
export interface JsFeedAttachment {
|
|
1041
|
+
url: string
|
|
1042
|
+
mimeType?: string
|
|
1043
|
+
title?: string
|
|
1044
|
+
sizeInBytes?: number
|
|
1045
|
+
durationInSeconds?: number
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1048
|
+
/** A person credited on a feed item. */
|
|
1049
|
+
export interface JsFeedAuthor {
|
|
1050
|
+
name: string
|
|
1051
|
+
url?: string
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1054
|
+
/** One collection entry considered for a feed. */
|
|
1055
|
+
export interface JsFeedItem {
|
|
1056
|
+
title: string
|
|
1057
|
+
description?: string
|
|
1058
|
+
loc: string
|
|
1059
|
+
date?: string
|
|
1060
|
+
lastUpdated?: string
|
|
1061
|
+
draft?: boolean
|
|
1062
|
+
unlisted?: boolean
|
|
1063
|
+
content?: string
|
|
1064
|
+
id?: string
|
|
1065
|
+
authors?: Array<JsFeedAuthor>
|
|
1066
|
+
image?: string
|
|
1067
|
+
attachments?: Array<JsFeedAttachment>
|
|
1068
|
+
language?: string
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
/** Switches and site metadata for feed generation. */
|
|
1072
|
+
export interface JsFeedsOptions {
|
|
1073
|
+
enabled: boolean
|
|
1074
|
+
siteUrl?: string
|
|
1075
|
+
siteName: string
|
|
1076
|
+
siteDescription?: string
|
|
1077
|
+
homePageUrl: string
|
|
1078
|
+
rssUrl: string
|
|
1079
|
+
atomUrl: string
|
|
1080
|
+
jsonUrl: string
|
|
1081
|
+
/** Any of `"rss"`, `"atom"`, `"json"`. Unknown names are ignored. */
|
|
1082
|
+
formats: Array<string>
|
|
1083
|
+
limit: number
|
|
1084
|
+
language?: string
|
|
1085
|
+
image?: string
|
|
1086
|
+
favicon?: string
|
|
1087
|
+
copyright?: string
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
/** Generated feed bodies, or a warning when generation is skipped. */
|
|
1091
|
+
export interface JsFeedsOutput {
|
|
1092
|
+
rssXml?: string
|
|
1093
|
+
atomXml?: string
|
|
1094
|
+
jsonFeed?: string
|
|
1095
|
+
warning?: string
|
|
1096
|
+
}
|
|
1097
|
+
|
|
937
1098
|
/** Opt-in static `file-tree` fences. */
|
|
938
1099
|
export interface JsFileTreeOptions {
|
|
939
1100
|
/**
|
|
@@ -1384,6 +1545,78 @@ export interface JsMediaEmbedsOptions {
|
|
|
1384
1545
|
* Default: `false`.
|
|
1385
1546
|
*/
|
|
1386
1547
|
bluesky?: boolean
|
|
1548
|
+
/**
|
|
1549
|
+
* Render `<GoogleMaps>` static place cards.
|
|
1550
|
+
*
|
|
1551
|
+
* Default: `false`.
|
|
1552
|
+
*/
|
|
1553
|
+
googleMaps?: boolean
|
|
1554
|
+
/**
|
|
1555
|
+
* Render `<Qiita>` static article cards.
|
|
1556
|
+
*
|
|
1557
|
+
* Default: `false`.
|
|
1558
|
+
*/
|
|
1559
|
+
qiita?: boolean
|
|
1560
|
+
/**
|
|
1561
|
+
* Render `<Zenn>` static article cards.
|
|
1562
|
+
*
|
|
1563
|
+
* Default: `false`.
|
|
1564
|
+
*/
|
|
1565
|
+
zenn?: boolean
|
|
1566
|
+
/**
|
|
1567
|
+
* Render package registry cards for npm, crates.io, PyPI, and Docker Hub.
|
|
1568
|
+
*
|
|
1569
|
+
* Default: `false`.
|
|
1570
|
+
*/
|
|
1571
|
+
packageRegistry?: boolean
|
|
1572
|
+
/**
|
|
1573
|
+
* Render `<CodePen>`, `<JSFiddle>`, and `<Observable>` playground cards.
|
|
1574
|
+
*
|
|
1575
|
+
* Default: `false`.
|
|
1576
|
+
*/
|
|
1577
|
+
playgrounds?: boolean
|
|
1578
|
+
/**
|
|
1579
|
+
* Render `<Vimeo>` video cards.
|
|
1580
|
+
*
|
|
1581
|
+
* Default: `false`.
|
|
1582
|
+
*/
|
|
1583
|
+
vimeo?: boolean
|
|
1584
|
+
/**
|
|
1585
|
+
* Render `<Twitch>` video, clip, and channel cards.
|
|
1586
|
+
*
|
|
1587
|
+
* Default: `false`.
|
|
1588
|
+
*/
|
|
1589
|
+
twitch?: boolean
|
|
1590
|
+
/**
|
|
1591
|
+
* Render `<Discord>` static invite/message cards.
|
|
1592
|
+
*
|
|
1593
|
+
* Default: `false`.
|
|
1594
|
+
*/
|
|
1595
|
+
discord?: boolean
|
|
1596
|
+
/**
|
|
1597
|
+
* Render `<Fediverse>`, `<Mastodon>`, `<Misskey>`, and `<Mixi2>` static post cards.
|
|
1598
|
+
*
|
|
1599
|
+
* Default: `false`.
|
|
1600
|
+
*/
|
|
1601
|
+
fediverse?: boolean
|
|
1602
|
+
/**
|
|
1603
|
+
* Render `<Facebook>` static post cards.
|
|
1604
|
+
*
|
|
1605
|
+
* Default: `false`.
|
|
1606
|
+
*/
|
|
1607
|
+
facebook?: boolean
|
|
1608
|
+
/**
|
|
1609
|
+
* Render `<Threads>` static post cards.
|
|
1610
|
+
*
|
|
1611
|
+
* Default: `false`.
|
|
1612
|
+
*/
|
|
1613
|
+
threads?: boolean
|
|
1614
|
+
/**
|
|
1615
|
+
* Render `<Instagram>` static post cards.
|
|
1616
|
+
*
|
|
1617
|
+
* Default: `false`.
|
|
1618
|
+
*/
|
|
1619
|
+
instagram?: boolean
|
|
1387
1620
|
/**
|
|
1388
1621
|
* Render `<WebContainer>` lazy placeholder blocks.
|
|
1389
1622
|
*
|
|
@@ -1402,6 +1635,42 @@ export interface JsMediaEmbedsOptions {
|
|
|
1402
1635
|
* Default: `false`.
|
|
1403
1636
|
*/
|
|
1404
1637
|
video?: boolean
|
|
1638
|
+
/**
|
|
1639
|
+
* Render `<Loom>` recording cards.
|
|
1640
|
+
*
|
|
1641
|
+
* Default: `false`.
|
|
1642
|
+
*/
|
|
1643
|
+
loom?: boolean
|
|
1644
|
+
/**
|
|
1645
|
+
* Render `<Asciinema>` terminal-recording cards.
|
|
1646
|
+
*
|
|
1647
|
+
* Default: `false`.
|
|
1648
|
+
*/
|
|
1649
|
+
asciinema?: boolean
|
|
1650
|
+
/**
|
|
1651
|
+
* Render `<Figma>` file, design, board, and prototype cards.
|
|
1652
|
+
*
|
|
1653
|
+
* Default: `false`.
|
|
1654
|
+
*/
|
|
1655
|
+
figma?: boolean
|
|
1656
|
+
/**
|
|
1657
|
+
* Render `<Note>` note.com article cards.
|
|
1658
|
+
*
|
|
1659
|
+
* Default: `false`.
|
|
1660
|
+
*/
|
|
1661
|
+
note?: boolean
|
|
1662
|
+
/**
|
|
1663
|
+
* Render `<GoogleSlides>` deck cards.
|
|
1664
|
+
*
|
|
1665
|
+
* Default: `false`.
|
|
1666
|
+
*/
|
|
1667
|
+
googleSlides?: boolean
|
|
1668
|
+
}
|
|
1669
|
+
|
|
1670
|
+
/** Rewritten HTML plus every tag an enabled provider refused. */
|
|
1671
|
+
export interface JsMediaEmbedsResult {
|
|
1672
|
+
html: string
|
|
1673
|
+
diagnostics: Array<JsEmbedDiagnostic>
|
|
1405
1674
|
}
|
|
1406
1675
|
|
|
1407
1676
|
/** Opt-in `<NotByAI />` authorship badge. */
|
|
@@ -1488,6 +1757,31 @@ export interface JsPagerOverride {
|
|
|
1488
1757
|
href?: string
|
|
1489
1758
|
}
|
|
1490
1759
|
|
|
1760
|
+
/**
|
|
1761
|
+
* A feed date after parsing: the instant, its civil parts in UTC, and the two
|
|
1762
|
+
* serializations the feed formats ask for.
|
|
1763
|
+
*/
|
|
1764
|
+
export interface JsParsedFeedDate {
|
|
1765
|
+
/** Seconds since the Unix epoch. */
|
|
1766
|
+
unix: number
|
|
1767
|
+
/** Civil year in UTC. */
|
|
1768
|
+
year: number
|
|
1769
|
+
/** Civil month, 1-12. */
|
|
1770
|
+
month: number
|
|
1771
|
+
/** Civil day of month, 1-31. */
|
|
1772
|
+
day: number
|
|
1773
|
+
/** Hour, 0-23. */
|
|
1774
|
+
hour: number
|
|
1775
|
+
/** Minute, 0-59. */
|
|
1776
|
+
minute: number
|
|
1777
|
+
/** Second, 0-60. */
|
|
1778
|
+
second: number
|
|
1779
|
+
/** `YYYY-MM-DDTHH:MM:SSZ`, as Atom and JSON Feed want it. */
|
|
1780
|
+
rfc3339: string
|
|
1781
|
+
/** `Day, DD Mon YYYY HH:MM:SS +0000`, as RSS wants it. */
|
|
1782
|
+
rfc822: string
|
|
1783
|
+
}
|
|
1784
|
+
|
|
1491
1785
|
/**
|
|
1492
1786
|
* Parser options for JavaScript.
|
|
1493
1787
|
*
|
|
@@ -1632,12 +1926,63 @@ export interface JsReaderChrome {
|
|
|
1632
1926
|
backToTop?: boolean
|
|
1633
1927
|
}
|
|
1634
1928
|
|
|
1929
|
+
/** One planned static HTML redirect. */
|
|
1930
|
+
export interface JsRedirectEntry {
|
|
1931
|
+
from: string
|
|
1932
|
+
to: string
|
|
1933
|
+
html: string
|
|
1934
|
+
relativePath: string
|
|
1935
|
+
}
|
|
1936
|
+
|
|
1937
|
+
/** One entry of the config rewrite map, in author order. */
|
|
1938
|
+
export interface JsRedirectMapEntry {
|
|
1939
|
+
from: string
|
|
1940
|
+
to: string
|
|
1941
|
+
}
|
|
1942
|
+
|
|
1943
|
+
/** One page that other paths can redirect to. */
|
|
1944
|
+
export interface JsRedirectPage {
|
|
1945
|
+
dest: string
|
|
1946
|
+
aliases?: Array<string>
|
|
1947
|
+
redirect?: string
|
|
1948
|
+
}
|
|
1949
|
+
|
|
1950
|
+
/** Switches and the config rewrite map. */
|
|
1951
|
+
export interface JsRedirectsOptions {
|
|
1952
|
+
enabled: boolean
|
|
1953
|
+
map: Array<JsRedirectMapEntry>
|
|
1954
|
+
netlify: boolean
|
|
1955
|
+
headers: boolean
|
|
1956
|
+
json: boolean
|
|
1957
|
+
allowExternal: boolean
|
|
1958
|
+
html: boolean
|
|
1959
|
+
base?: string
|
|
1960
|
+
}
|
|
1961
|
+
|
|
1962
|
+
/** Planned redirect pages and optional host files. */
|
|
1963
|
+
export interface JsRedirectsOutput {
|
|
1964
|
+
pages: Array<JsRedirectEntry>
|
|
1965
|
+
netlify?: string
|
|
1966
|
+
headers?: string
|
|
1967
|
+
json?: string
|
|
1968
|
+
}
|
|
1969
|
+
|
|
1635
1970
|
/** Resolved source module. */
|
|
1636
1971
|
export interface JsResolvedModule {
|
|
1637
1972
|
path: string
|
|
1638
1973
|
exports: Array<JsPublicExport>
|
|
1639
1974
|
}
|
|
1640
1975
|
|
|
1976
|
+
/** One page after cascade and optional permalink / slug rewriting. */
|
|
1977
|
+
export interface JsResolvedSsgRoutePage {
|
|
1978
|
+
/** Source path relative to the content root. */
|
|
1979
|
+
source: string
|
|
1980
|
+
/** Resolved URL path. */
|
|
1981
|
+
urlPath: string
|
|
1982
|
+
/** Frontmatter after cascade fills. */
|
|
1983
|
+
frontmatter: Record<string, unknown>
|
|
1984
|
+
}
|
|
1985
|
+
|
|
1641
1986
|
/** HTML sanitizer options. */
|
|
1642
1987
|
export interface JsSanitizeOptions {
|
|
1643
1988
|
/**
|
|
@@ -1696,6 +2041,8 @@ export interface JsSearchIndexBuildOptions {
|
|
|
1696
2041
|
publishState?: JsPublishStateOptions
|
|
1697
2042
|
/** Explicit MDX parser override. When omitted, `.mdx` files enable MDX. */
|
|
1698
2043
|
mdx?: boolean
|
|
2044
|
+
/** Conditional blocks are resolved before extracting searchable content. */
|
|
2045
|
+
conditionalBlocks?: JsConditionalBlockOptions
|
|
1699
2046
|
}
|
|
1700
2047
|
|
|
1701
2048
|
/** Search options for JavaScript. */
|
|
@@ -1752,6 +2099,36 @@ export interface JsSectionIndexItem {
|
|
|
1752
2099
|
description?: string
|
|
1753
2100
|
}
|
|
1754
2101
|
|
|
2102
|
+
/** One page considered for the crawl manifests. */
|
|
2103
|
+
export interface JsSiteMapPage {
|
|
2104
|
+
loc: string
|
|
2105
|
+
title: string
|
|
2106
|
+
description?: string
|
|
2107
|
+
/** Source-file git commit time in milliseconds. `None` omits `<lastmod>`. */
|
|
2108
|
+
lastUpdated?: number
|
|
2109
|
+
draft?: boolean
|
|
2110
|
+
unlisted?: boolean
|
|
2111
|
+
}
|
|
2112
|
+
|
|
2113
|
+
/** Switches and site metadata for crawl-manifest generation. */
|
|
2114
|
+
export interface JsSiteMapsOptions {
|
|
2115
|
+
enabled: boolean
|
|
2116
|
+
siteUrl?: string
|
|
2117
|
+
sitemapLoc: string
|
|
2118
|
+
siteName: string
|
|
2119
|
+
siteDescription?: string
|
|
2120
|
+
robots: boolean
|
|
2121
|
+
llms: boolean
|
|
2122
|
+
}
|
|
2123
|
+
|
|
2124
|
+
/** Generated crawl-manifest bodies, or a warning when generation is skipped. */
|
|
2125
|
+
export interface JsSiteMapsOutput {
|
|
2126
|
+
sitemapXml?: string
|
|
2127
|
+
robotsTxt?: string
|
|
2128
|
+
llmsTxt?: string
|
|
2129
|
+
warning?: string
|
|
2130
|
+
}
|
|
2131
|
+
|
|
1755
2132
|
/** Custom social link for JavaScript. */
|
|
1756
2133
|
export interface JsSocialLink {
|
|
1757
2134
|
/** Icon label. */
|
|
@@ -2002,6 +2379,24 @@ export interface JsSsgPageData {
|
|
|
2002
2379
|
markdownSource?: string
|
|
2003
2380
|
}
|
|
2004
2381
|
|
|
2382
|
+
/** Resolved page routes plus collision and rejection diagnostics. */
|
|
2383
|
+
export interface JsSsgPageRouteOutput {
|
|
2384
|
+
/** Pages that still have a unique URL. */
|
|
2385
|
+
pages: Array<JsResolvedSsgRoutePage>
|
|
2386
|
+
/** Human-readable collision and rejection messages. */
|
|
2387
|
+
errors: Array<string>
|
|
2388
|
+
}
|
|
2389
|
+
|
|
2390
|
+
/** One page considered for cascade and permalink resolution. */
|
|
2391
|
+
export interface JsSsgRoutePageInput {
|
|
2392
|
+
/** Source path relative to the content root. */
|
|
2393
|
+
source: string
|
|
2394
|
+
/** File-tree URL before permalink or slug rewriting. */
|
|
2395
|
+
fileUrl: string
|
|
2396
|
+
/** Parsed frontmatter object. */
|
|
2397
|
+
frontmatter: Record<string, unknown>
|
|
2398
|
+
}
|
|
2399
|
+
|
|
2005
2400
|
/** Resolved SSG output and public route paths. */
|
|
2006
2401
|
export interface JsSsgRoutePaths {
|
|
2007
2402
|
/** HTML output file path. */
|
|
@@ -2534,6 +2929,12 @@ export interface JsTransformOptions {
|
|
|
2534
2929
|
* Default: disabled.
|
|
2535
2930
|
*/
|
|
2536
2931
|
timelines?: JsTimelineOptions
|
|
2932
|
+
/**
|
|
2933
|
+
* Opt-in static `::: if` / `::: else` conditional blocks.
|
|
2934
|
+
*
|
|
2935
|
+
* Default: disabled.
|
|
2936
|
+
*/
|
|
2937
|
+
conditionalBlocks?: JsConditionalBlockOptions
|
|
2537
2938
|
/**
|
|
2538
2939
|
* Opt-in `::: card` / `::: link-card` / `::: card-grid` blocks.
|
|
2539
2940
|
*
|
|
@@ -2659,6 +3060,15 @@ export interface MdxImportSpecifier {
|
|
|
2659
3060
|
kind: 'default' | 'named' | 'namespace'
|
|
2660
3061
|
}
|
|
2661
3062
|
|
|
3063
|
+
/**
|
|
3064
|
+
* Every tag the media-embed transform can rewrite.
|
|
3065
|
+
*
|
|
3066
|
+
* A caller that pre-scans a document to decide whether to run the transform
|
|
3067
|
+
* needs this list, and a hand-kept copy drifts — that is how `<CodeSandbox>`
|
|
3068
|
+
* came to be skipped on a page containing nothing else.
|
|
3069
|
+
*/
|
|
3070
|
+
export declare function mediaEmbedTags(): Array<JsEmbedTag>
|
|
3071
|
+
|
|
2662
3072
|
/** Restores code block metadata after JavaScript-side syntax highlighting. */
|
|
2663
3073
|
export declare function mergeHighlightedCodeBlocks(originalHtml: string, highlightedHtml: string): string
|
|
2664
3074
|
|
|
@@ -2683,6 +3093,9 @@ export interface Mf2ValidateResult {
|
|
|
2683
3093
|
/** Every language name and alias the native highlighter answers to. */
|
|
2684
3094
|
export declare function nativeHighlightLanguages(): Array<string>
|
|
2685
3095
|
|
|
3096
|
+
/** Strips a trailing slash except for `/`. Unsafe values return `None`. */
|
|
3097
|
+
export declare function normalizeRedirectPath(value: string): string | null
|
|
3098
|
+
|
|
2686
3099
|
/** Normalizes VitePress-specific frontmatter into ox-content's entry-page shape. */
|
|
2687
3100
|
export declare function normalizeVitePressFrontmatter(frontmatter: any): any
|
|
2688
3101
|
|
|
@@ -2699,6 +3112,13 @@ export declare function parseAndRender(source: string, options?: JsParserOptions
|
|
|
2699
3112
|
/** Parses Markdown and renders to HTML asynchronously (runs on worker thread). */
|
|
2700
3113
|
export declare function parseAndRenderAsync(source: string, options?: JsParserOptions | undefined | null): Promise<unknown>
|
|
2701
3114
|
|
|
3115
|
+
/**
|
|
3116
|
+
* Parses a feed date — an epoch seconds/milliseconds integer, or a civil
|
|
3117
|
+
* date-time with an optional zone offset — returning `null` when the value
|
|
3118
|
+
* names no instant.
|
|
3119
|
+
*/
|
|
3120
|
+
export declare function parseFeedDate(value?: string | undefined | null): JsParsedFeedDate | null
|
|
3121
|
+
|
|
2702
3122
|
/** Parses Markdown source into a raw mdast memory block for JavaScript-side deserialization. */
|
|
2703
3123
|
export declare function parseMdastRaw(source: string, options?: JsParserOptions | undefined | null): Uint8Array
|
|
2704
3124
|
|
|
@@ -2721,6 +3141,9 @@ export declare function parseScopedSearchQuery(query: string): JsScopedSearchQue
|
|
|
2721
3141
|
*/
|
|
2722
3142
|
export declare function parseTransferRaw(source: string, kind: string, options?: JsParserOptions | undefined | null): Uint8Array
|
|
2723
3143
|
|
|
3144
|
+
/** Plans redirect pages and host files without writing anything. */
|
|
3145
|
+
export declare function planRedirects(options: JsRedirectsOptions, pages: Array<JsRedirectPage>): JsRedirectsOutput
|
|
3146
|
+
|
|
2724
3147
|
/** Prepared Markdown source with parsed frontmatter. */
|
|
2725
3148
|
export interface PreparedSourceResult {
|
|
2726
3149
|
/** Markdown content after optional frontmatter removal. */
|
|
@@ -2756,6 +3179,9 @@ export declare function renderFrameworkComponentCode(html: string, target: strin
|
|
|
2756
3179
|
/** Resolve Unhead-compatible page-head descriptors to HTML. */
|
|
2757
3180
|
export declare function renderHead(inputJson: string): JsSsgHtmlResult
|
|
2758
3181
|
|
|
3182
|
+
/** Static HTML redirect body. `dest` is escaped; callers still validate it. */
|
|
3183
|
+
export declare function renderRedirectHtml(dest: string): string
|
|
3184
|
+
|
|
2759
3185
|
/** Render result containing the HTML output. */
|
|
2760
3186
|
export interface RenderResult {
|
|
2761
3187
|
/** The rendered HTML. */
|
|
@@ -2770,6 +3196,9 @@ export declare function renderSsgSectionIndex(title: string, items: Array<JsSect
|
|
|
2770
3196
|
/** Resolves manual SSG navigation groups. */
|
|
2771
3197
|
export declare function resolveSsgNavigationGroups(navigation: Array<JsSsgNavigationGroup>, base: string, extension: string): Array<JsSsgNavGroup>
|
|
2772
3198
|
|
|
3199
|
+
/** Resolves permalink / slug routes and `_index` frontmatter cascade. */
|
|
3200
|
+
export declare function resolveSsgPageRoutes(pages: Array<JsSsgRoutePageInput>, permalinksEnabled: boolean, cascadeEnabled: boolean): JsSsgPageRouteOutput
|
|
3201
|
+
|
|
2773
3202
|
/** Resolves all output and public route paths for an SSG page. */
|
|
2774
3203
|
export declare function resolveSsgRoutePaths(inputPath: string, srcDir: string, outDir: string, base: string, extension: string, siteUrl?: string | undefined | null): JsSsgRoutePaths
|
|
2775
3204
|
|
|
@@ -2809,6 +3238,9 @@ export declare function transform(source: string, options?: JsTransformOptions |
|
|
|
2809
3238
|
/** Transforms Markdown source asynchronously (runs on worker thread). */
|
|
2810
3239
|
export declare function transformAsync(source: string, options?: JsTransformOptions | undefined | null): Promise<unknown>
|
|
2811
3240
|
|
|
3241
|
+
/** Numbers headings, figures, and tables, and links `@id` references to them. */
|
|
3242
|
+
export declare function transformCrossReferences(html: string, options: JsCrossReferencesOptions): JsCrossReferenceOutput
|
|
3243
|
+
|
|
2812
3244
|
/**
|
|
2813
3245
|
* Transforms Markdown into a raw mdast transfer buffer.
|
|
2814
3246
|
*
|
|
@@ -2817,9 +3249,11 @@ export declare function transformAsync(source: string, options?: JsTransformOpti
|
|
|
2817
3249
|
*/
|
|
2818
3250
|
export declare function transformMdastRaw(source: string, options?: JsTransformOptions | undefined | null): Uint8Array
|
|
2819
3251
|
|
|
2820
|
-
/** Transform opt-in static media embed components in already-rendered HTML. */
|
|
2821
3252
|
export declare function transformMediaEmbeds(html: string, options?: JsMediaEmbedsOptions | undefined | null): string
|
|
2822
3253
|
|
|
3254
|
+
/** Rewrites embeds and reports the tags no provider would render. */
|
|
3255
|
+
export declare function transformMediaEmbedsWithDiagnostics(html: string, options?: JsMediaEmbedsOptions | undefined | null): JsMediaEmbedsResult
|
|
3256
|
+
|
|
2823
3257
|
/** Transforms mermaid code blocks in HTML to rendered SVG diagrams. */
|
|
2824
3258
|
export declare function transformMermaid(html: string, mmdcPath: string): MermaidTransformResult
|
|
2825
3259
|
|
package/index.js
CHANGED
|
@@ -173,9 +173,11 @@ module.exports.transformAsync = binding.transformAsync;
|
|
|
173
173
|
module.exports.transformMdastRaw = binding.transformMdastRaw;
|
|
174
174
|
module.exports.sanitizeHtml = binding.sanitizeHtml;
|
|
175
175
|
module.exports.transformMediaEmbeds = binding.transformMediaEmbeds;
|
|
176
|
+
module.exports.transformMediaEmbedsWithDiagnostics = binding.transformMediaEmbedsWithDiagnostics;
|
|
176
177
|
module.exports.transformPmEmbeds = binding.transformPmEmbeds;
|
|
177
178
|
module.exports.transformTabsEmbeds = binding.transformTabsEmbeds;
|
|
178
179
|
module.exports.transformYoutubeEmbeds = binding.transformYoutubeEmbeds;
|
|
180
|
+
module.exports.extractYoutubeVideoId = binding.extractYoutubeVideoId;
|
|
179
181
|
module.exports.extractCodeBlocks = binding.extractCodeBlocks;
|
|
180
182
|
module.exports.lintCodeBlocks = binding.lintCodeBlocks;
|
|
181
183
|
module.exports.extractDocsTests = binding.extractDocsTests;
|
|
@@ -221,6 +223,7 @@ module.exports.nativeHighlightLanguages = binding.nativeHighlightLanguages;
|
|
|
221
223
|
module.exports.generateSsgBarePage = binding.generateSsgBarePage;
|
|
222
224
|
module.exports.getGitLastUpdated = binding.getGitLastUpdated;
|
|
223
225
|
module.exports.getGitContributors = binding.getGitContributors;
|
|
226
|
+
module.exports.resolveSsgPageRoutes = binding.resolveSsgPageRoutes;
|
|
224
227
|
module.exports.resolveSsgRoutePaths = binding.resolveSsgRoutePaths;
|
|
225
228
|
module.exports.getSsgOutputPath = binding.getSsgOutputPath;
|
|
226
229
|
module.exports.getSsgUrlPath = binding.getSsgUrlPath;
|
|
@@ -243,4 +246,13 @@ module.exports.checkI18nProject = binding.checkI18nProject;
|
|
|
243
246
|
module.exports.extractTranslationKeys = binding.extractTranslationKeys;
|
|
244
247
|
module.exports.renderFrameworkComponentCode = binding.renderFrameworkComponentCode;
|
|
245
248
|
module.exports.renderSsgSectionIndex = binding.renderSsgSectionIndex;
|
|
249
|
+
module.exports.parseFeedDate = binding.parseFeedDate;
|
|
250
|
+
module.exports.generateFeedBodies = binding.generateFeedBodies;
|
|
251
|
+
module.exports.mediaEmbedTags = binding.mediaEmbedTags;
|
|
252
|
+
module.exports.transformCrossReferences = binding.transformCrossReferences;
|
|
253
|
+
module.exports.planRedirects = binding.planRedirects;
|
|
254
|
+
module.exports.renderRedirectHtml = binding.renderRedirectHtml;
|
|
255
|
+
module.exports.isSafeRedirectDest = binding.isSafeRedirectDest;
|
|
256
|
+
module.exports.normalizeRedirectPath = binding.normalizeRedirectPath;
|
|
257
|
+
module.exports.generateSiteMapBodies = binding.generateSiteMapBodies;
|
|
246
258
|
module.exports.escapeSvelteMarkup = binding.escapeSvelteMarkup;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ox-content/napi",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.12",
|
|
4
4
|
"description": "Node.js bindings for Ox Content - High-performance Markdown parser",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"markdown",
|
|
@@ -47,12 +47,12 @@
|
|
|
47
47
|
]
|
|
48
48
|
},
|
|
49
49
|
"optionalDependencies": {
|
|
50
|
-
"@ox-content/binding-darwin-x64": "3.0.0-alpha.
|
|
51
|
-
"@ox-content/binding-darwin-arm64": "3.0.0-alpha.
|
|
52
|
-
"@ox-content/binding-linux-x64-gnu": "3.0.0-alpha.
|
|
53
|
-
"@ox-content/binding-linux-x64-musl": "3.0.0-alpha.
|
|
54
|
-
"@ox-content/binding-linux-arm64-gnu": "3.0.0-alpha.
|
|
55
|
-
"@ox-content/binding-linux-arm64-musl": "3.0.0-alpha.
|
|
56
|
-
"@ox-content/binding-win32-x64-msvc": "3.0.0-alpha.
|
|
50
|
+
"@ox-content/binding-darwin-x64": "3.0.0-alpha.12",
|
|
51
|
+
"@ox-content/binding-darwin-arm64": "3.0.0-alpha.12",
|
|
52
|
+
"@ox-content/binding-linux-x64-gnu": "3.0.0-alpha.12",
|
|
53
|
+
"@ox-content/binding-linux-x64-musl": "3.0.0-alpha.12",
|
|
54
|
+
"@ox-content/binding-linux-arm64-gnu": "3.0.0-alpha.12",
|
|
55
|
+
"@ox-content/binding-linux-arm64-musl": "3.0.0-alpha.12",
|
|
56
|
+
"@ox-content/binding-win32-x64-msvc": "3.0.0-alpha.12"
|
|
57
57
|
}
|
|
58
58
|
}
|