New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

myst-transforms

Package Overview
Dependencies
Maintainers
3
Versions
96
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

myst-transforms - npm Package Compare versions

Comparing version 1.0.6 to 1.1.0

13

dist/abbreviations.d.ts
import type { Plugin } from 'unified';
import type { Root } from 'mdast';
import type { GenericParent } from 'myst-common';
type Options = {
/** An object of abbreviations { "TLA": "Three Letter Acronym" } */
abbreviations?: Record<string, string>;
/**
* Expand the abbreviation the first time it is encountered,
*
* i.e. `TLA` --> `Three Letter Acronym (TLA)`
*/
firstTimeLong?: boolean;
};
export declare function abbreviationTransform(mdast: Root, opts?: Options): void;
export declare const abbreviationPlugin: Plugin<[Options], Root, Root>;
export declare function abbreviationTransform(mdast: GenericParent, opts?: Options): void;
export declare const abbreviationPlugin: Plugin<[Options], GenericParent, GenericParent>;
export {};
//# sourceMappingURL=abbreviations.d.ts.map

@@ -20,5 +20,3 @@ import { toText } from 'myst-common';

return false;
return u('abbreviation', { title }, [
u('text', value),
]);
return u('abbreviation', { title }, [u('text', value)]);
},

@@ -42,2 +40,13 @@ ]));

replaceText(mdast, opts);
if (opts.firstTimeLong) {
const new_abbreviations = selectAll('abbreviation', mdast);
const explained = new Set();
new_abbreviations.forEach((node) => {
if (explained.has(node.title))
return;
explained.add(node.title);
const short = node.children[0];
short.value = `${node.title} (${short.value})`;
});
}
}

@@ -44,0 +53,0 @@ export const abbreviationPlugin = (opts) => (tree) => {

import type { Plugin } from 'unified';
import type { Root } from 'mdast';
import type { GenericParent } from 'myst-common';
import { AdmonitionKind } from './types.js';

@@ -12,10 +12,10 @@ type Options = {

*/
export declare function admonitionHeadersTransform(tree: Root, opts?: Options): void;
export declare function admonitionHeadersTransform(tree: GenericParent, opts?: Options): void;
/**
* Visit all blockquote notes and add headers if necessary, support GitHub style admonitions
*/
export declare function admonitionBlockquoteTransform(tree: Root): void;
export declare const admonitionHeadersPlugin: Plugin<[Options?], Root, Root>;
export declare const admonitionBlockquotePlugin: Plugin<[], Root, Root>;
export declare function admonitionBlockquoteTransform(tree: GenericParent): void;
export declare const admonitionHeadersPlugin: Plugin<[Options?], GenericParent, GenericParent>;
export declare const admonitionBlockquotePlugin: Plugin<[], GenericParent, GenericParent>;
export {};
//# sourceMappingURL=admonitions.d.ts.map

@@ -1,6 +0,6 @@

import type { Root } from 'mdast';
import type { Plugin } from 'unified';
import type { VFile } from 'vfile';
export declare function basicTransformations(tree: Root, file: VFile): void;
export declare const basicTransformationsPlugin: Plugin<[], Root, Root>;
import type { GenericParent } from 'myst-common';
export declare function basicTransformations(tree: GenericParent, file: VFile): void;
export declare const basicTransformationsPlugin: Plugin<[], GenericParent, GenericParent>;
//# sourceMappingURL=basic.d.ts.map

@@ -10,2 +10,3 @@ import { liftMystDirectivesAndRolesTransform } from './liftMystDirectivesAndRoles.js';

import { blockquoteTransform } from './blockquote.js';
import { codeBlockToDirectiveTransform } from './code.js';
export function basicTransformations(tree, file) {

@@ -16,2 +17,3 @@ // lifting roles and directives must happen before the mystTarget transformation

captionParagraphTransform(tree);
codeBlockToDirectiveTransform(tree, file, { translate: ['math', 'mermaid'] });
mathNestingTransform(tree, file);

@@ -18,0 +20,0 @@ // Math labelling should happen before the target-transformation

import type { Plugin } from 'unified';
import type { Root } from 'mdast';
export declare function blockquoteTransform(mdast: Root): void;
export declare const blockquotePlugin: Plugin<[], Root, Root>;
import type { GenericParent } from 'myst-common';
export declare function blockquoteTransform(mdast: GenericParent): void;
export declare const blockquotePlugin: Plugin<[], GenericParent, GenericParent>;
//# sourceMappingURL=blockquote.d.ts.map
import type { VFile } from 'vfile';
import type { Plugin } from 'unified';
import type { Root } from 'mdast';
export declare function blockNestingTransform(mdast: Root): void;
export declare const blockNestingPlugin: Plugin<[], Root, Root>;
export declare function blockMetadataTransform(mdast: Root, file: VFile): void;
export declare const blockMetadataPlugin: Plugin<[], Root, Root>;
import type { GenericParent } from 'myst-common';
export declare function blockNestingTransform(mdast: GenericParent): void;
export declare const blockNestingPlugin: Plugin<[], GenericParent, GenericParent>;
export declare function blockMetadataTransform(mdast: GenericParent, file: VFile): void;
export declare const blockMetadataPlugin: Plugin<[], GenericParent, GenericParent>;
//# sourceMappingURL=blocks.d.ts.map
import type { Plugin } from 'unified';
import type { Root } from 'mdast';
import type { GenericParent } from 'myst-common';
/**

@@ -8,4 +8,4 @@ * Ensure caption content is nested in a paragraph.

*/
export declare function captionParagraphTransform(tree: Root): void;
export declare const captionParagraphPlugin: Plugin<[], Root, Root>;
export declare function captionParagraphTransform(tree: GenericParent): void;
export declare const captionParagraphPlugin: Plugin<[], GenericParent, GenericParent>;
//# sourceMappingURL=caption.d.ts.map
import type { Plugin } from 'unified';
import type { Root } from 'mdast';
import type { GenericParent } from 'myst-common';
import type { VFile } from 'vfile';

@@ -8,5 +8,15 @@ type Options = {

};
export declare function codeTransform(mdast: Root, file: VFile, opts?: Options): void;
export declare const codePlugin: Plugin<[Options?], Root, Root>;
export declare function codeTransform(mdast: GenericParent, file: VFile, opts?: Options): void;
export declare const codePlugin: Plugin<[Options?], GenericParent, GenericParent>;
type CodeBlockTransformOptions = {
translate: (string | {
lang: string;
directive?: string;
})[];
};
export declare function codeBlockToDirectiveTransform(tree: GenericParent, file: VFile, opts?: CodeBlockTransformOptions): void;
export declare const codeBlockToDirectivePlugin: Plugin<[
CodeBlockTransformOptions?
], GenericParent, GenericParent>;
export {};
//# sourceMappingURL=code.d.ts.map

@@ -22,1 +22,18 @@ import { selectAll } from 'unist-util-select';

};
export function codeBlockToDirectiveTransform(tree, file, opts) {
if (!opts || !opts.translate || opts.translate.length === 0)
return;
const nodes = selectAll('code', tree);
nodes.forEach((node) => {
if (!node.lang)
return;
const res = opts.translate.find((t) => t === node.lang || (typeof t !== 'string' && t.lang === node.lang));
if (!res)
return;
node.type = typeof res === 'string' ? res : res.directive || res.lang;
delete node.lang;
});
}
export const codeBlockToDirectivePlugin = (opts) => (tree, file) => {
codeBlockToDirectiveTransform(tree, file, opts);
};
import type { Plugin } from 'unified';
import type { VFile } from 'vfile';
import type { Root } from 'mdast';
import type { Container, CrossReference, Heading, Math } from 'myst-spec';
import type { GenericParent } from 'myst-common';
type ResolvableCrossReference = Omit<CrossReference, 'kind'> & {

@@ -73,3 +73,3 @@ kind?: TargetKind | string;

file?: VFile;
initializeNumberedHeadingDepths: (tree: Root) => void;
initializeNumberedHeadingDepths: (tree: GenericParent) => void;
addTarget: (node: TargetNodes) => void;

@@ -94,3 +94,3 @@ /**

addTarget(node: TargetNodes): void;
initializeNumberedHeadingDepths(tree: Root): void;
initializeNumberedHeadingDepths(tree: GenericParent): void;
incrementCount(node: TargetNodes, kind: TargetKind | string): string;

@@ -118,15 +118,15 @@ getTarget(identifier?: string): Target | undefined;

addTarget(node: TargetNodes): void;
initializeNumberedHeadingDepths(tree: Root): void;
initializeNumberedHeadingDepths(tree: GenericParent): void;
getTarget(identifier?: string, page?: string): Target | undefined;
resolveReferenceContent(node: ResolvableCrossReference): void;
}
export declare const enumerateTargetsTransform: (tree: Root, opts: StateOptions) => Root;
export declare const enumerateTargetsPlugin: Plugin<[StateOptions], Root, Root>;
export declare const enumerateTargetsTransform: (tree: GenericParent, opts: StateOptions) => GenericParent;
export declare const enumerateTargetsPlugin: Plugin<[StateOptions], GenericParent, GenericParent>;
/** Visit all containers and add captions */
export declare function addContainerCaptionNumbersTransform(tree: Root, file: VFile, opts: StateOptions): void;
export declare const resolveReferenceLinksTransform: (tree: Root, opts: StateOptions) => void;
export declare const resolveCrossReferencesTransform: (tree: Root, opts: StateOptions) => void;
export declare const resolveReferencesTransform: (tree: Root, file: VFile, opts: StateOptions) => void;
export declare const resolveReferencesPlugin: Plugin<[StateOptions], Root, Root>;
export declare function addContainerCaptionNumbersTransform(tree: GenericParent, file: VFile, opts: StateOptions): void;
export declare const resolveReferenceLinksTransform: (tree: GenericParent, opts: StateOptions) => void;
export declare const resolveCrossReferencesTransform: (tree: GenericParent, opts: StateOptions) => void;
export declare const resolveReferencesTransform: (tree: GenericParent, file: VFile, opts: StateOptions) => void;
export declare const resolveReferencesPlugin: Plugin<[StateOptions], GenericParent, GenericParent>;
export {};
//# sourceMappingURL=enumerate.d.ts.map
import type { Plugin } from 'unified';
import type { Root } from 'mdast';
import type { VFile } from 'vfile';
export declare function footnotesTransform(mdast: Root, file: VFile): void;
export declare const footnotesPlugin: Plugin<[], Root, Root>;
import type { GenericParent } from 'myst-common';
export declare function footnotesTransform(mdast: GenericParent, file: VFile): void;
export declare const footnotesPlugin: Plugin<[], GenericParent, GenericParent>;
//# sourceMappingURL=footnotes.d.ts.map

@@ -1,2 +0,2 @@

import type { Root } from 'mdast';
import type { GenericParent } from 'myst-common';
import type { VFile } from 'vfile';

@@ -13,4 +13,4 @@ type Options = {

};
export declare function getFrontmatter(file: VFile, tree: Root, opts?: Options): {
tree: Root;
export declare function getFrontmatter(file: VFile, tree: GenericParent, opts?: Options): {
tree: GenericParent;
frontmatter: Record<string, any>;

@@ -17,0 +17,0 @@ };

import type { Plugin } from 'unified';
import type { Root } from 'mdast';
import type { Node } from 'myst-spec';
import type { VFile } from 'vfile';
import type { GenericParent } from 'myst-common';
import type { IReferenceState } from './enumerate.js';

@@ -9,4 +9,4 @@ export type Options = {

};
export declare function glossaryTransform<T extends Node | Root>(mdast: T, file: VFile, opts: Options): void;
export declare const glossaryPlugin: Plugin<[Options], Root, Root>;
export declare function glossaryTransform<T extends Node | GenericParent>(mdast: T, file: VFile, opts: Options): void;
export declare const glossaryPlugin: Plugin<[Options], GenericParent, GenericParent>;
//# sourceMappingURL=glossary.d.ts.map
import type { Plugin } from 'unified';
import type { Handle } from 'hast-util-to-mdast';
import type { Root } from 'mdast';
import type { GenericParent } from 'myst-common';
export type HtmlTransformOptions = {

@@ -10,4 +10,4 @@ keepBreaks?: boolean;

};
export declare function htmlTransform(tree: Root, opts?: HtmlTransformOptions): Root;
export declare const htmlPlugin: Plugin<[HtmlTransformOptions?], Root, Root>;
export declare function htmlTransform(tree: GenericParent, opts?: HtmlTransformOptions): GenericParent;
export declare const htmlPlugin: Plugin<[HtmlTransformOptions?], GenericParent, GenericParent>;
//# sourceMappingURL=html.d.ts.map
import type { Plugin } from 'unified';
import type { Root } from 'mdast';
import type { Node } from 'myst-spec';
import type { GenericParent } from 'myst-common';
/**

@@ -10,4 +10,4 @@ * Ensure all HTML ids in the document are unique

*/
export declare function htmlIdsTransform<T extends Node | Root>(mdast: T): void;
export declare const htmlIdsPlugin: Plugin<[], Root, Root>;
export declare function htmlIdsTransform<T extends Node | GenericParent>(mdast: T): void;
export declare const htmlIdsPlugin: Plugin<[], GenericParent, GenericParent>;
//# sourceMappingURL=htmlIds.d.ts.map
import type { Plugin } from 'unified';
import type { Root } from 'mdast';
export declare function imageAltTextTransform(tree: Root): void;
export declare const imageAltTextPlugin: Plugin<[], Root, Root>;
import type { GenericParent } from 'myst-common';
export declare function imageAltTextTransform(tree: GenericParent): void;
export declare const imageAltTextPlugin: Plugin<[], GenericParent, GenericParent>;
//# sourceMappingURL=images.d.ts.map
import type { GenericParent } from 'myst-common';
import type { Root } from 'mdast';
import type { Plugin } from 'unified';
import type { VFile } from 'vfile';
export declare function joinGatesTransform(tree: GenericParent, file: VFile): void;
export declare const joinGatesPlugin: Plugin<[], Root, Root>;
export declare const joinGatesPlugin: Plugin<[], GenericParent, GenericParent>;
//# sourceMappingURL=joinGates.d.ts.map
import type { Plugin } from 'unified';
import type { Root } from 'mdast';
import type { Node } from 'myst-spec';
import type { GenericParent } from 'myst-common';
/**

@@ -10,4 +10,4 @@ * Add unique keys to every node

*/
export declare function keysTransform<T extends Node | Root>(mdast: T): Root | Node;
export declare const keysPlugin: Plugin<[], Root, Root>;
export declare function keysTransform<T extends Node | GenericParent>(mdast: T): GenericParent | Node;
export declare const keysPlugin: Plugin<[], GenericParent, GenericParent>;
//# sourceMappingURL=keys.d.ts.map
import type { Plugin } from 'unified';
import type { Root } from 'mdast';
import type { GenericParent } from 'myst-common';
/**

@@ -10,4 +10,4 @@ * Lift directives and roles and remove them from the tree

*/
export declare function liftMystDirectivesAndRolesTransform(tree: Root): void;
export declare const liftMystDirectivesAndRolesPlugin: Plugin<[], Root, Root>;
export declare function liftMystDirectivesAndRolesTransform(tree: GenericParent): void;
export declare const liftMystDirectivesAndRolesPlugin: Plugin<[], GenericParent, GenericParent>;
//# sourceMappingURL=liftMystDirectivesAndRoles.d.ts.map
import type { Plugin } from 'unified';
import type { Root } from 'mdast';
import type { VFile } from 'vfile';
import type { LinkTransformer } from './types.js';
import type { GenericParent } from 'myst-common';
type Options = {

@@ -9,5 +9,5 @@ transformers: LinkTransformer[];

};
export declare function linksTransform(mdast: Root, file: VFile, opts: Options): void;
export declare const linksPlugin: Plugin<[Options], Root, Root>;
export declare function linksTransform(mdast: GenericParent, file: VFile, opts: Options): void;
export declare const linksPlugin: Plugin<[Options], GenericParent, GenericParent>;
export {};
//# sourceMappingURL=plugin.d.ts.map
import type { Plugin } from 'unified';
import type { VFile } from 'vfile';
import type { Root } from 'mdast';
import type { GenericParent } from 'myst-common';
type Options = {

@@ -18,9 +18,9 @@ macros?: Record<string, string>;

*/
export declare function mathNestingTransform(tree: Root, file: VFile): void;
export declare function mathLabelTransform(tree: Root, file: VFile): void;
export declare function mathTransform(tree: Root, file: VFile, opts?: Options): void;
export declare const mathNestingPlugin: Plugin<[], Root, Root>;
export declare const mathLabelPlugin: Plugin<[], Root, Root>;
export declare const mathPlugin: Plugin<[Options?], Root, Root>;
export declare function mathNestingTransform(tree: GenericParent, file: VFile): void;
export declare function mathLabelTransform(tree: GenericParent, file: VFile): void;
export declare function mathTransform(tree: GenericParent, file: VFile, opts?: Options): void;
export declare const mathNestingPlugin: Plugin<[], GenericParent, GenericParent>;
export declare const mathLabelPlugin: Plugin<[], GenericParent, GenericParent>;
export declare const mathPlugin: Plugin<[Options?], GenericParent, GenericParent>;
export {};
//# sourceMappingURL=math.d.ts.map
import type { Plugin } from 'unified';
import type { Root } from 'mdast';
import type { GenericParent } from 'myst-common';
/**

@@ -19,9 +19,9 @@ * Propagate target identifier/value to subsequent node

*/
export declare function mystTargetsTransform(tree: Root): void;
export declare const mystTargetsPlugin: Plugin<[], Root, Root>;
export declare function mystTargetsTransform(tree: GenericParent): void;
export declare const mystTargetsPlugin: Plugin<[], GenericParent, GenericParent>;
/**
* Add implicit labels & identifiers to all headings
*/
export declare function headingLabelTransform(tree: Root): void;
export declare const headingLabelPlugin: Plugin<[], Root, Root>;
export declare function headingLabelTransform(tree: GenericParent): void;
export declare const headingLabelPlugin: Plugin<[], GenericParent, GenericParent>;
//# sourceMappingURL=targets.d.ts.map
{
"name": "myst-transforms",
"version": "1.0.6",
"version": "1.1.0",
"sideEffects": false,

@@ -27,5 +27,5 @@ "type": "module",

"mdast-util-find-and-replace": "^2.1.0",
"myst-common": "^1.1.0",
"myst-common": "^1.1.2",
"myst-spec": "^0.0.4",
"myst-spec-ext": "^1.1.0",
"myst-spec-ext": "^1.1.2",
"rehype-parse": "^8.0.4",

@@ -32,0 +32,0 @@ "rehype-remark": "^9.1.2",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc