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

@khanacademy/simple-markdown

Package Overview
Dependencies
Maintainers
0
Versions
1178
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@khanacademy/simple-markdown - npm Package Compare versions

Comparing version 0.0.0-PR862-20231207182234 to 0.0.0-PR875-20250221232857

dist/shared-utils/add-library-version-to-perseus-debug.d.ts

60

dist/es/index.js

@@ -1,9 +0,49 @@

import { addLibraryVersionToPerseusDebug } from '@khanacademy/perseus-core';
/**
* Adds the given perseus library version information to the __perseus_debug__
* object and ensures that the object is attached to `globalThis` (`window` in
* browser environments).
*
* This allows each library to provide runtime version information to assist in
* debugging in production environments.
*/
const addLibraryVersionToPerseusDebug = (libraryName, libraryVersion) => {
// If the library version is the default value, then we don't want to
// prefix it with a "v" to indicate that it is a version number.
let prefix = "v";
if (libraryVersion === "__lib_version__") {
prefix = "";
}
const formattedVersion = `${prefix}${libraryVersion}`;
if (typeof globalThis !== "undefined") {
var _globalThis$__perseus;
globalThis.__perseus_debug__ = (_globalThis$__perseus = globalThis.__perseus_debug__) != null ? _globalThis$__perseus : {};
const existingVersionEntry = globalThis.__perseus_debug__[libraryName];
if (existingVersionEntry) {
// If we already have an entry and it doesn't match the registered
// version, we morph the entry into an array and log a warning.
if (existingVersionEntry !== formattedVersion) {
// Existing entry might be an array already (oops, at least 2
// versions of the library already loaded!).
const allVersions = Array.isArray(existingVersionEntry) ? existingVersionEntry : [existingVersionEntry];
allVersions.push(formattedVersion);
globalThis.__perseus_debug__[libraryName] = allVersions;
// eslint-disable-next-line no-console
console.warn(`Multiple versions of ${libraryName} loaded on this page: ${allVersions.sort().join(", ")}`);
}
} else {
globalThis.__perseus_debug__[libraryName] = formattedVersion;
}
} else {
// eslint-disable-next-line no-console
console.warn(`globalThis not found found (${formattedVersion})`);
}
};
// This file is processed by a Rollup plugin (replace) to inject the production
const libName = "@khanacademy/simple-markdown";
const libVersion = "0.11.1";
const libVersion = "0.13.20";
addLibraryVersionToPerseusDebug(libName, libVersion);
/* eslint-disable prefer-spread, no-regex-spaces, @typescript-eslint/no-unused-vars, guard-for-in, no-console, no-var */
/* eslint-disable prefer-spread, no-regex-spaces, guard-for-in, no-console, no-var */

@@ -15,2 +55,3 @@ // Type Definitions:

// we can:
// End TypeScript Definitions

@@ -295,3 +336,3 @@

}
} catch (e) {
} catch (_unused) {
// invalid URLs should throw a TypeError

@@ -379,2 +420,5 @@ // see for instance: `new URL("");`

var TABLES = function () {
// predefine regexes so we don't have to create them inside functions
// sure, regex literals should be fast, even inside functions, but they
// aren't in all browsers.
var TABLE_ROW_SEPARATOR_TRIM = /^ *\| *| *\| *$/g;

@@ -593,6 +637,8 @@ var TABLE_CELL_END_TRIM = / *$/;

react: function (node, output, state) {
return reactElement("hr", state.key, EMPTY_PROPS);
return reactElement("hr", state.key, {
"aria-hidden": true
});
},
html: function (node, output, state) {
return "<hr>";
return '<hr aria-hidden="true">';
}

@@ -1402,2 +1448,3 @@ },

}
// @ts-expect-error - Argument of type 'any[]' is not assignable to parameter of type '[node: ASTNode, state?: State | null | undefined]'. Target requires 1 element(s) but source may have fewer.
return defaultImplicitParse.apply(null, args);

@@ -1409,2 +1456,3 @@ },

}
// @ts-expect-error - Argument of type 'any[]' is not assignable to parameter of type '[node: ASTNode, state?: State | null | undefined]'. Target requires 1 element(s) but source may have fewer.
return defaultReactOutput.apply(null, args);

@@ -1411,0 +1459,0 @@ }

@@ -5,10 +5,49 @@ 'use strict';

var perseusCore = require('@khanacademy/perseus-core');
/**
* Adds the given perseus library version information to the __perseus_debug__
* object and ensures that the object is attached to `globalThis` (`window` in
* browser environments).
*
* This allows each library to provide runtime version information to assist in
* debugging in production environments.
*/
const addLibraryVersionToPerseusDebug = (libraryName, libraryVersion) => {
// If the library version is the default value, then we don't want to
// prefix it with a "v" to indicate that it is a version number.
let prefix = "v";
if (libraryVersion === "__lib_version__") {
prefix = "";
}
const formattedVersion = `${prefix}${libraryVersion}`;
if (typeof globalThis !== "undefined") {
globalThis.__perseus_debug__ = globalThis.__perseus_debug__ ?? {};
const existingVersionEntry = globalThis.__perseus_debug__[libraryName];
if (existingVersionEntry) {
// If we already have an entry and it doesn't match the registered
// version, we morph the entry into an array and log a warning.
if (existingVersionEntry !== formattedVersion) {
// Existing entry might be an array already (oops, at least 2
// versions of the library already loaded!).
const allVersions = Array.isArray(existingVersionEntry) ? existingVersionEntry : [existingVersionEntry];
allVersions.push(formattedVersion);
globalThis.__perseus_debug__[libraryName] = allVersions;
// eslint-disable-next-line no-console
console.warn(`Multiple versions of ${libraryName} loaded on this page: ${allVersions.sort().join(", ")}`);
}
} else {
globalThis.__perseus_debug__[libraryName] = formattedVersion;
}
} else {
// eslint-disable-next-line no-console
console.warn(`globalThis not found found (${formattedVersion})`);
}
};
// This file is processed by a Rollup plugin (replace) to inject the production
const libName = "@khanacademy/simple-markdown";
const libVersion = "0.11.1";
perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
const libVersion = "0.13.20";
addLibraryVersionToPerseusDebug(libName, libVersion);
/* eslint-disable prefer-spread, no-regex-spaces, @typescript-eslint/no-unused-vars, guard-for-in, no-console, no-var */
/* eslint-disable prefer-spread, no-regex-spaces, guard-for-in, no-console, no-var */

@@ -20,2 +59,3 @@ // Type Definitions:

// we can:
// End TypeScript Definitions

@@ -300,3 +340,3 @@

}
} catch (e) {
} catch {
// invalid URLs should throw a TypeError

@@ -384,2 +424,5 @@ // see for instance: `new URL("");`

var TABLES = function () {
// predefine regexes so we don't have to create them inside functions
// sure, regex literals should be fast, even inside functions, but they
// aren't in all browsers.
var TABLE_ROW_SEPARATOR_TRIM = /^ *\| *| *\| *$/g;

@@ -598,6 +641,8 @@ var TABLE_CELL_END_TRIM = / *$/;

react: function (node, output, state) {
return reactElement("hr", state.key, EMPTY_PROPS);
return reactElement("hr", state.key, {
"aria-hidden": true
});
},
html: function (node, output, state) {
return "<hr>";
return '<hr aria-hidden="true">';
}

@@ -1408,2 +1453,3 @@ },

}
// @ts-expect-error - Argument of type 'any[]' is not assignable to parameter of type '[node: ASTNode, state?: State | null | undefined]'. Target requires 1 element(s) but source may have fewer.
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {

@@ -1418,2 +1464,3 @@ args[_key] = arguments[_key];

}
// @ts-expect-error - Argument of type 'any[]' is not assignable to parameter of type '[node: ASTNode, state?: State | null | undefined]'. Target requires 1 element(s) but source may have fewer.
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {

@@ -1420,0 +1467,0 @@ args[_key2] = arguments[_key2];

74

package.json
{
"name": "@khanacademy/simple-markdown",
"description": "Javascript markdown parsing, made simple",
"author": "Khan Academy",
"license": "MIT",
"version": "0.0.0-PR862-20231207182234",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "https://github.com/Khan/perseus.git",
"directory": "packages/simple-markdown"
},
"bugs": {
"url": "https://github.com/Khan/perseus/issues"
},
"module": "dist/es/index.js",
"main": "dist/index.js",
"source": "src/index.ts",
"scripts": {
"test": "bash -c 'yarn --silent --cwd \"../..\" test ${@:0} $($([[ ${@: -1} = -* ]] || [[ ${@: -1} = bash ]]) && echo $PWD)'"
},
"dependencies": {
"@khanacademy/perseus-core": "0.0.0-PR862-20231207182234",
"@types/react": ">=16.0.0"
},
"devDependencies": {
"@types/react-dom": ">=16.0.0",
"perseus-build-settings": "^0.3.0",
"typescript": "^3.6.4"
},
"peerDependencies": {
"react": "16.14.0",
"react-dom": "16.14.0"
},
"keywords": [
"markdown"
]
}
"name": "@khanacademy/simple-markdown",
"description": "Javascript markdown parsing, made simple",
"author": "Khan Academy",
"license": "MIT",
"version": "0.0.0-PR875-20250221232857",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "https://github.com/Khan/perseus.git",
"directory": "packages/simple-markdown"
},
"bugs": {
"url": "https://github.com/Khan/perseus/issues"
},
"module": "dist/es/index.js",
"main": "dist/index.js",
"source": "src/index.ts",
"files": [
"dist"
],
"dependencies": {},
"devDependencies": {
"perseus-build-settings": "0.0.0-PR875-20250221232857"
},
"peerDependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"keywords": [
"markdown"
],
"scripts": {}
}

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

simple-markdown
===============
# @khanacademy/simple-markdown

@@ -7,4 +6,3 @@ simple-markdown is a markdown-like parser designed for simplicity

Philosophy
----------
## Philosophy

@@ -35,4 +33,3 @@ Most markdown-like parsers aim for [speed][marked] or

Getting started
---------------
## Getting started

@@ -43,4 +40,4 @@ First, let's parse and output some generic markdown using

If you want to run these examples in
node, you should run `npm install` in the simple-markdown
folder or `npm install simple-markdown` in your project's
node, you should run `pnpm install` in the simple-markdown
folder or `pnpm add simple-markdown` in your project's
folder. Then you can acquire the `SimpleMarkdown` variable

@@ -113,4 +110,3 @@ with:

Adding a simple extension
-------------------------
## Adding a simple extension

@@ -230,4 +226,3 @@ Let's add an underline extension! To do this, we'll need to create

Basic parsing/output API
------------------------
## Basic parsing/output API

@@ -258,4 +253,3 @@ #### `SimpleMarkdown.defaultBlockParse(source)`

Extension Overview
------------------
## Extension Overview

@@ -376,4 +370,3 @@ Elements in simple-markdown are generally created from rules.

Extension API
-------------
## Extension API

@@ -453,9 +446,3 @@ simple-markdown includes access to the default list of rules,

Extension rules helper functions
--------------------------------
*Coming soon*
LICENSE
-------
## LICENSE
MIT. See the LICENSE file for text.

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