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
2
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 0.0.23 to 0.0.24

16

dist/cjs/footnotes.js

@@ -5,4 +5,2 @@ "use strict";

var unist_util_select_1 = require("unist-util-select");
var unist_util_remove_1 = require("unist-util-remove");
var keys_1 = require("./keys");
var myst_common_1 = require("myst-common");

@@ -16,10 +14,9 @@ function nextNumber(current, reserved) {

var TRANSFORM_SOURCE = 'myst-transforms:footnotes';
function footnotesTransform(mdast, file, opts) {
function footnotesTransform(mdast, file) {
var footnotes = (0, unist_util_select_1.selectAll)('footnoteDefinition', mdast);
opts.references.footnotes = Object.fromEntries(footnotes.map(function (n) {
var footnotesLookup = Object.fromEntries(footnotes.map(function (n) {
// Clear out the number
delete n.number;
return [n.identifier, (0, keys_1.keysTransform)(n)];
return [n.identifier, n];
}));
(0, unist_util_remove_1.remove)(mdast, 'footnoteDefinition');
var references = (0, unist_util_select_1.selectAll)('footnoteReference', mdast);

@@ -29,3 +26,2 @@ var reserved = new Set(references.map(function (r) { return Number(r.identifier); }).filter(function (num) { return !Number.isNaN(num) && num > 0; }));

references.forEach(function (node) {
var _a;
if (!node.identifier) {

@@ -38,3 +34,3 @@ (0, myst_common_1.fileWarn)(file, 'FootnoteReference does not have an identifier', {

}
var def = (_a = opts.references.footnotes) === null || _a === void 0 ? void 0 : _a[node.identifier];
var def = footnotesLookup[node.identifier];
if (!def) {

@@ -60,5 +56,5 @@ (0, myst_common_1.fileWarn)(file, "No footnoteDefinition found for ".concat(node.identifier), {

exports.footnotesTransform = footnotesTransform;
var footnotesPlugin = function (opts) { return function (tree, file) {
footnotesTransform(tree, file, opts);
var footnotesPlugin = function () { return function (tree, file) {
footnotesTransform(tree, file);
}; };
exports.footnotesPlugin = footnotesPlugin;
import { selectAll } from 'unist-util-select';
import { remove } from 'unist-util-remove';
import { keysTransform } from './keys';
import { fileWarn } from 'myst-common';

@@ -12,10 +10,9 @@ function nextNumber(current, reserved) {

var TRANSFORM_SOURCE = 'myst-transforms:footnotes';
export function footnotesTransform(mdast, file, opts) {
export function footnotesTransform(mdast, file) {
var footnotes = selectAll('footnoteDefinition', mdast);
opts.references.footnotes = Object.fromEntries(footnotes.map(function (n) {
var footnotesLookup = Object.fromEntries(footnotes.map(function (n) {
// Clear out the number
delete n.number;
return [n.identifier, keysTransform(n)];
return [n.identifier, n];
}));
remove(mdast, 'footnoteDefinition');
var references = selectAll('footnoteReference', mdast);

@@ -25,3 +22,2 @@ var reserved = new Set(references.map(function (r) { return Number(r.identifier); }).filter(function (num) { return !Number.isNaN(num) && num > 0; }));

references.forEach(function (node) {
var _a;
if (!node.identifier) {

@@ -34,3 +30,3 @@ fileWarn(file, 'FootnoteReference does not have an identifier', {

}
var def = (_a = opts.references.footnotes) === null || _a === void 0 ? void 0 : _a[node.identifier];
var def = footnotesLookup[node.identifier];
if (!def) {

@@ -55,4 +51,4 @@ fileWarn(file, "No footnoteDefinition found for ".concat(node.identifier), {

}
export var footnotesPlugin = function (opts) { return function (tree, file) {
footnotesTransform(tree, file, opts);
export var footnotesPlugin = function () { return function (tree, file) {
footnotesTransform(tree, file);
}; };
import type { Plugin } from 'unified';
import type { Root } from 'mdast';
import type { References } from 'myst-common';
import type { VFile } from 'vfile';
declare type Options = {
references: Pick<References, 'footnotes'>;
};
export declare function footnotesTransform(mdast: Root, file: VFile, opts: Options): void;
export declare const footnotesPlugin: Plugin<[Options], Root, Root>;
export {};
export declare function footnotesTransform(mdast: Root, file: VFile): void;
export declare const footnotesPlugin: Plugin<[], Root, Root>;
//# sourceMappingURL=footnotes.d.ts.map
{
"name": "myst-transforms",
"version": "0.0.23",
"version": "0.0.24",
"sideEffects": false,

@@ -29,5 +29,5 @@ "main": "./dist/cjs/index.js",

"mdast-util-find-and-replace": "^2.1.0",
"myst-common": "^0.0.14",
"myst-common": "^0.0.15",
"myst-spec": "^0.0.4",
"myst-spec-ext": "^0.0.9",
"myst-spec-ext": "^0.0.10",
"rehype-parse": "^8.0.4",

@@ -38,3 +38,3 @@ "rehype-remark": "^9.1.2",

"unist-util-modify-children": "^3.1.0",
"unist-util-select": "^4.0.1",
"unist-util-select": "^4.0.3",
"vfile": "^5.0.0",

@@ -41,0 +41,0 @@ "vfile-message": "^3.1.2"

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