myst-transforms
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -9,1 +9,2 @@ import type { Plugin } from 'unified'; | ||
export {}; | ||
//# sourceMappingURL=abbreviations.d.ts.map |
@@ -20,1 +20,2 @@ import type { Plugin } from 'unified'; | ||
export {}; | ||
//# sourceMappingURL=admonitions.d.ts.map |
@@ -6,1 +6,2 @@ import type { Root } from 'mdast'; | ||
export declare const basicTransformationsPlugin: Plugin<[], Root, Root>; | ||
//# sourceMappingURL=basic.d.ts.map |
@@ -5,1 +5,2 @@ import type { Plugin } from 'unified'; | ||
export declare const blockquotePlugin: Plugin<[], Root, Root>; | ||
//# sourceMappingURL=blockquote.d.ts.map |
@@ -8,1 +8,2 @@ import type { VFile } from 'vfile'; | ||
export declare const blockMetadataPlugin: Plugin<[], Root, Root>; | ||
//# sourceMappingURL=blocks.d.ts.map |
@@ -10,1 +10,2 @@ import type { Plugin } from 'unified'; | ||
export declare const captionParagraphPlugin: Plugin<[], Root, Root>; | ||
//# sourceMappingURL=caption.d.ts.map |
@@ -11,1 +11,2 @@ import type { Plugin } from 'unified'; | ||
export {}; | ||
//# sourceMappingURL=code.d.ts.map |
@@ -129,1 +129,2 @@ import type { Plugin } from 'unified'; | ||
export {}; | ||
//# sourceMappingURL=enumerate.d.ts.map |
@@ -404,2 +404,6 @@ import { visit } from 'unist-util-visit'; | ||
}); | ||
const source = link.urlSource; | ||
if (source) { | ||
link.urlSource = `#${source}`; | ||
} | ||
} | ||
@@ -406,0 +410,0 @@ // Change the link into a cross-reference! |
@@ -6,1 +6,2 @@ import type { Plugin } from 'unified'; | ||
export declare const footnotesPlugin: Plugin<[], Root, Root>; | ||
//# sourceMappingURL=footnotes.d.ts.map |
@@ -17,1 +17,2 @@ import type { Root } from 'mdast'; | ||
export {}; | ||
//# sourceMappingURL=frontmatter.d.ts.map |
@@ -11,1 +11,2 @@ import type { Plugin } from 'unified'; | ||
export declare const glossaryPlugin: Plugin<[Options], Root, Root>; | ||
//# sourceMappingURL=glossary.d.ts.map |
@@ -12,1 +12,2 @@ import type { Plugin } from 'unified'; | ||
export declare const htmlPlugin: Plugin<[HtmlTransformOptions?], Root, Root>; | ||
//# sourceMappingURL=html.d.ts.map |
@@ -12,1 +12,2 @@ import type { Plugin } from 'unified'; | ||
export declare const htmlIdsPlugin: Plugin<[], Root, Root>; | ||
//# sourceMappingURL=htmlIds.d.ts.map |
@@ -5,1 +5,2 @@ import type { Plugin } from 'unified'; | ||
export declare const imageAltTextPlugin: Plugin<[], Root, Root>; | ||
//# sourceMappingURL=images.d.ts.map |
@@ -24,1 +24,2 @@ export { admonitionHeadersPlugin, admonitionHeadersTransform, admonitionBlockquotePlugin, admonitionBlockquoteTransform, admonitionKindToTitle, } from './admonitions.js'; | ||
export { getFrontmatter } from './frontmatter.js'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -7,1 +7,2 @@ import type { GenericParent } from 'myst-common'; | ||
export declare const joinGatesPlugin: Plugin<[], Root, Root>; | ||
//# sourceMappingURL=joinGates.d.ts.map |
@@ -12,1 +12,2 @@ import type { Plugin } from 'unified'; | ||
export declare const keysPlugin: Plugin<[], Root, Root>; | ||
//# sourceMappingURL=keys.d.ts.map |
@@ -12,1 +12,2 @@ import type { Plugin } from 'unified'; | ||
export declare const liftMystDirectivesAndRolesPlugin: Plugin<[], Root, Root>; | ||
//# sourceMappingURL=liftMystDirectivesAndRoles.d.ts.map |
@@ -8,1 +8,2 @@ import type { VFile } from 'vfile'; | ||
} | ||
//# sourceMappingURL=doi.d.ts.map |
@@ -8,1 +8,2 @@ import type { VFile } from 'vfile'; | ||
} | ||
//# sourceMappingURL=github.d.ts.map |
@@ -9,1 +9,2 @@ export { linksTransform, linksPlugin } from './plugin.js'; | ||
export { updateLinkTextIfEmpty } from './utils.js'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -11,1 +11,2 @@ import type { VFile } from 'vfile'; | ||
} | ||
//# sourceMappingURL=myst.d.ts.map |
@@ -13,2 +13,3 @@ import { fileWarn, fileError } from 'myst-common'; | ||
transform(link, file) { | ||
var _a, _b; | ||
const urlSource = link.urlSource || link.url; | ||
@@ -26,18 +27,12 @@ let url; | ||
} | ||
if (!url.hash) { | ||
fileError(file, `Must provide a target for "${urlSource}"`, { | ||
node: link, | ||
note: 'Use the `#` symbol to create a target, for example, <myst:project#my-target>', | ||
source: TRANSFORM_SOURCE, | ||
}); | ||
return false; | ||
} | ||
const target = url.hash.replace(/^#/, ''); | ||
const lookup = this.intersphinx.find((i) => { | ||
const target = (_b = (_a = url.hash) === null || _a === void 0 ? void 0 : _a.replace(/^#/, '')) !== null && _b !== void 0 ? _b : ''; | ||
const project = this.intersphinx.find((i) => { | ||
if (url.pathname) | ||
return i.id === url.pathname; | ||
// If the pathname is not specified, check if it has the target | ||
return !!i.getEntry({ name: target }); | ||
if (target) | ||
return !!i.getEntry({ name: target }); | ||
return false; | ||
}); | ||
if (!lookup) { | ||
if (!project || !project.path) { | ||
fileWarn(file, `Unknown project "${url.pathname}" for link: ${urlSource}`, { | ||
@@ -49,6 +44,12 @@ node: link, | ||
} | ||
if (!url.hash) { | ||
link.internal = false; | ||
link.url = project.path; | ||
updateLinkTextIfEmpty(link, project.id || '(see documentation)'); | ||
return false; | ||
} | ||
// TODO: add query params in here to pick the domain | ||
const entry = lookup.getEntry({ name: target }); | ||
const entry = project.getEntry({ name: target }); | ||
if (!entry) { | ||
fileWarn(file, `"${urlSource}" not found intersphinx ${lookup.id} (${lookup.path})`, { | ||
fileWarn(file, `"${urlSource}" not found intersphinx ${project.id} (${project.path})`, { | ||
node: link, | ||
@@ -61,5 +62,5 @@ source: TRANSFORM_SOURCE, | ||
link.url = entry.location; | ||
updateLinkTextIfEmpty(link, entry.display || lookup.id || '(see documentation)'); | ||
updateLinkTextIfEmpty(link, entry.display || project.id || '(see documentation)'); | ||
return true; | ||
} | ||
} |
@@ -12,1 +12,2 @@ import type { Plugin } from 'unified'; | ||
export {}; | ||
//# sourceMappingURL=plugin.d.ts.map |
@@ -8,1 +8,2 @@ import type { VFile } from 'vfile'; | ||
} | ||
//# sourceMappingURL=rrid.d.ts.map |
@@ -16,1 +16,2 @@ import type { VFile } from 'vfile'; | ||
} | ||
//# sourceMappingURL=types.d.ts.map |
import type { Link } from './types.js'; | ||
export declare function withoutHttp(url: string): string; | ||
export declare function updateLinkTextIfEmpty(link: Link, title: string): void; | ||
//# sourceMappingURL=utils.d.ts.map |
@@ -19,1 +19,2 @@ import type { VFile } from 'vfile'; | ||
} | ||
//# sourceMappingURL=wiki.d.ts.map |
@@ -25,1 +25,2 @@ import type { Plugin } from 'unified'; | ||
export {}; | ||
//# sourceMappingURL=math.d.ts.map |
@@ -26,1 +26,2 @@ import type { Plugin } from 'unified'; | ||
export declare const headingLabelPlugin: Plugin<[], Root, Root>; | ||
//# sourceMappingURL=targets.d.ts.map |
@@ -14,1 +14,2 @@ export declare enum AdmonitionKind { | ||
} | ||
//# sourceMappingURL=types.d.ts.map |
@@ -15,1 +15,2 @@ import type { GenericParent } from 'myst-common'; | ||
export declare function unnestTransform(tree: GenericParent, parentNodeType: string, childNodeType: string): void; | ||
//# sourceMappingURL=unnest.d.ts.map |
{ | ||
"name": "myst-transforms", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"sideEffects": false, | ||
@@ -5,0 +5,0 @@ "type": "module", |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
114633
95
2342
0