mirror of
https://github.com/markedjs/marked.git
synced 2026-11-30 16:48:05 +01:00
fix: Clean up files in repo (#2963)
BREAKING CHANGE: - remove built files from git repo. - If you need to use the latest version of marked on the web you can use a cdn to get marked.min.js from npm: - `https://cdn.jsdelivr.net/npm/marked/marked.min.js`
This commit is contained in:
@@ -3,5 +3,8 @@
|
||||
node_modules/
|
||||
test/compiled_tests
|
||||
public
|
||||
lib
|
||||
docs/LICENSE.md
|
||||
vuln.js
|
||||
man/marked.1
|
||||
marked.min.js
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
all:
|
||||
@cp lib/marked.cjs marked.cjs
|
||||
@uglifyjs --comments '/\*[^\0]+?Copyright[^\0]+?\*/' -o marked.min.js lib/marked.cjs
|
||||
|
||||
clean:
|
||||
@rm marked.cjs
|
||||
@rm marked.min.js
|
||||
|
||||
bench:
|
||||
@node test --bench
|
||||
|
||||
man/marked.1.txt:
|
||||
groff -man -Tascii man/marked.1 | col -b > man/marked.1.txt
|
||||
|
||||
.PHONY: clean all
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"name": "marked",
|
||||
"version": "0.3.4",
|
||||
"repo": "markedjs/marked",
|
||||
"description": "A markdown parser built for speed",
|
||||
"keywords": ["markdown", "markup", "html"],
|
||||
"scripts": ["lib/marked.cjs"],
|
||||
"main": "lib/marked.cjs",
|
||||
"license": "MIT"
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
/* global marked */
|
||||
import '../marked.min.js';
|
||||
import { promises } from 'fs';
|
||||
import { join, dirname, parse, format } from 'path';
|
||||
import { Marked } from './lib/marked.esm.js';
|
||||
import { markedHighlight } from 'marked-highlight';
|
||||
import { HighlightJS } from 'highlight.js';
|
||||
import titleize from 'titleize';
|
||||
@@ -13,7 +14,7 @@ const outputDir = join(cwd, 'public');
|
||||
const templateFile = join(inputDir, '_document.html');
|
||||
const isUppercase = str => /[A-Z_]+/.test(str);
|
||||
const getTitle = str => str === 'INDEX' ? '' : titleize(str.replace(/_/g, ' ')) + ' - ';
|
||||
const marked = new Marked(markedHighlight((code, language) => {
|
||||
const markedInstance = new marked.Marked(markedHighlight((code, language) => {
|
||||
if (!language) {
|
||||
return highlightAuto(code).value;
|
||||
}
|
||||
@@ -24,28 +25,38 @@ async function init() {
|
||||
console.log('Cleaning up output directory ' + outputDir);
|
||||
await rm(outputDir, { force: true, recursive: true });
|
||||
await mkdir(outputDir);
|
||||
console.log(`Copying file ${join(inputDir, 'LICENSE.md')}`);
|
||||
await copyFile(join(cwd, 'LICENSE.md'), join(inputDir, 'LICENSE.md'));
|
||||
console.log(`Copying file ${join(outputDir, 'marked.min.js')}`);
|
||||
await copyFile(join(cwd, 'marked.min.js'), join(outputDir, 'marked.min.js'));
|
||||
const tmpl = await readFile(templateFile, 'utf8');
|
||||
console.log('Building markdown...');
|
||||
await build(inputDir, tmpl);
|
||||
console.log('Build complete!');
|
||||
}
|
||||
|
||||
const ignoredFiles = [
|
||||
join(cwd, 'docs', 'build.js'),
|
||||
join(cwd, 'docs', '.eslintrc.json'),
|
||||
join(cwd, 'docs', '_document.html')
|
||||
];
|
||||
|
||||
async function build(currentDir, tmpl) {
|
||||
const files = await readdir(currentDir);
|
||||
for (const file of files) {
|
||||
const filename = join(currentDir, file);
|
||||
if (ignoredFiles.includes(filename)) {
|
||||
continue;
|
||||
}
|
||||
const stats = await stat(filename);
|
||||
const { mode } = stats;
|
||||
if (stats.isDirectory()) {
|
||||
// console.log('Found directory ' + filename);
|
||||
await build(filename, tmpl);
|
||||
} else {
|
||||
// console.log('Reading file ' + filename);
|
||||
let html = await readFile(filename, 'utf8');
|
||||
const parsed = parse(filename);
|
||||
if (parsed.ext === '.md' && isUppercase(parsed.name)) {
|
||||
const mdHtml = marked.parse(html);
|
||||
const mdHtml = markedInstance.parse(html);
|
||||
html = tmpl
|
||||
.replace('<!--{{title}}-->', getTitle(parsed.name))
|
||||
.replace('<!--{{content}}-->', mdHtml);
|
||||
@@ -55,7 +66,6 @@ async function build(currentDir, tmpl) {
|
||||
}
|
||||
parsed.dir = parsed.dir.replace(inputDir, outputDir);
|
||||
const outfile = format(parsed);
|
||||
// console.log('Ensure directory ' + dirname(outfile));
|
||||
await mkdir(dirname(outfile), { recursive: true });
|
||||
console.log('Writing file ' + outfile);
|
||||
await writeFile(outfile, html, { mode });
|
||||
@@ -5,6 +5,7 @@ html, body {
|
||||
color: #333;
|
||||
background-color: #fbfbfb;
|
||||
height: 100%;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
textarea {
|
||||
|
||||
+43
-137
@@ -1,4 +1,4 @@
|
||||
onunhandledrejection = function(e) {
|
||||
onunhandledrejection = (e) => {
|
||||
throw e.reason;
|
||||
};
|
||||
|
||||
@@ -6,7 +6,6 @@ const $loadingElem = document.querySelector('#loading');
|
||||
const $mainElem = document.querySelector('#main');
|
||||
const $markdownElem = document.querySelector('#markdown');
|
||||
const $markedVerElem = document.querySelector('#markedVersion');
|
||||
const $commitVerElem = document.querySelector('#commitVersion');
|
||||
const $optionsElem = document.querySelector('#options');
|
||||
const $outputTypeElem = document.querySelector('#outputType');
|
||||
const $inputTypeElem = document.querySelector('#inputType');
|
||||
@@ -22,9 +21,10 @@ const $inputPanes = document.querySelectorAll('.inputPane');
|
||||
let lastInput = '';
|
||||
let inputDirty = true;
|
||||
let $activeOutputElem = null;
|
||||
let latestVersion = 'master';
|
||||
const search = searchToObject();
|
||||
const markedVersions = {
|
||||
master: 'https://cdn.jsdelivr.net/gh/markedjs/marked'
|
||||
master: '../'
|
||||
};
|
||||
let delayTime = 1;
|
||||
let checkChangeTimeout = null;
|
||||
@@ -48,9 +48,6 @@ $optionsElem.addEventListener('keyup', handleInput, false);
|
||||
$optionsElem.addEventListener('keypress', handleInput, false);
|
||||
$optionsElem.addEventListener('keydown', handleInput, false);
|
||||
|
||||
$commitVerElem.style.display = 'none';
|
||||
$commitVerElem.addEventListener('keypress', handleAddVersion, false);
|
||||
|
||||
$clearElem.addEventListener('click', handleClearClick, false);
|
||||
|
||||
Promise.all([
|
||||
@@ -59,7 +56,7 @@ Promise.all([
|
||||
setInitialText(),
|
||||
setInitialVersion()
|
||||
.then(setInitialOptions)
|
||||
]).then(function() {
|
||||
]).then(() => {
|
||||
handleInputChange();
|
||||
handleOutputChange();
|
||||
checkForChanges();
|
||||
@@ -76,8 +73,8 @@ function setInitialText() {
|
||||
$markdownElem.value = search.text;
|
||||
} else {
|
||||
return fetch('./initial.md')
|
||||
.then(function(res) { return res.text(); })
|
||||
.then(function(text) {
|
||||
.then(res => res.text())
|
||||
.then(text => {
|
||||
if ($markdownElem.value === '') {
|
||||
$markdownElem.value = text;
|
||||
}
|
||||
@@ -87,70 +84,36 @@ function setInitialText() {
|
||||
|
||||
function setInitialQuickref() {
|
||||
return fetch('./quickref.md')
|
||||
.then(function(res) { return res.text(); })
|
||||
.then(function(text) {
|
||||
.then(res => res.text())
|
||||
.then(text => {
|
||||
document.querySelector('#quickref').value = text;
|
||||
});
|
||||
}
|
||||
|
||||
function setInitialVersion() {
|
||||
return fetch('https://data.jsdelivr.com/v1/package/npm/marked')
|
||||
.then(function(res) {
|
||||
return res.json();
|
||||
})
|
||||
.then(function(json) {
|
||||
for (let i = 0; i < json.versions.length; i++) {
|
||||
const ver = json.versions[i];
|
||||
.then(res => res.json())
|
||||
.then(json => {
|
||||
for (const ver of json.versions) {
|
||||
markedVersions[ver] = 'https://cdn.jsdelivr.net/npm/marked@' + ver;
|
||||
const opt = document.createElement('option');
|
||||
opt.textContent = ver;
|
||||
opt.value = ver;
|
||||
$markedVerElem.appendChild(opt);
|
||||
}
|
||||
})
|
||||
.then(function() {
|
||||
return fetch('https://api.github.com/repos/markedjs/marked/commits')
|
||||
.then(function(res) {
|
||||
return res.json();
|
||||
})
|
||||
.then(function(json) {
|
||||
markedVersions.master = 'https://cdn.jsdelivr.net/gh/markedjs/marked@' + json[0].sha;
|
||||
})
|
||||
.catch(function() {
|
||||
console.warn('Cannot find commits');
|
||||
// do nothing
|
||||
// uses url without commit
|
||||
});
|
||||
})
|
||||
.then(function() {
|
||||
if (search.version) {
|
||||
if (markedVersions[search.version]) {
|
||||
return search.version;
|
||||
} else {
|
||||
const match = search.version.match(/^(\w+):(.+)$/);
|
||||
if (match) {
|
||||
switch (match[1]) {
|
||||
case 'commit':
|
||||
addCommitVersion(search.version, match[2].substring(0, 7), match[2]);
|
||||
return search.version;
|
||||
case 'pr':
|
||||
return getPrCommit(match[2])
|
||||
.then(function(commit) {
|
||||
if (!commit) {
|
||||
return 'master';
|
||||
}
|
||||
addCommitVersion(search.version, 'PR #' + match[2], commit);
|
||||
return search.version;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (location.host === 'marked.js.org') {
|
||||
latestVersion = json.tags.latest;
|
||||
} else {
|
||||
$markedVerElem.querySelector('option[value="master"]').textContent = 'This Build';
|
||||
}
|
||||
|
||||
return 'master';
|
||||
})
|
||||
.then(function(version) {
|
||||
$markedVerElem.value = version;
|
||||
if (search.version && markedVersions[search.version]) {
|
||||
$markedVerElem.value = search.version;
|
||||
return;
|
||||
}
|
||||
|
||||
$markedVerElem.value = latestVersion;
|
||||
})
|
||||
.then(updateVersion);
|
||||
}
|
||||
@@ -179,57 +142,14 @@ function handleInput() {
|
||||
}
|
||||
|
||||
function handleVersionChange() {
|
||||
if ($markedVerElem.value === 'commit' || $markedVerElem.value === 'pr') {
|
||||
$commitVerElem.style.display = '';
|
||||
} else {
|
||||
$commitVerElem.style.display = 'none';
|
||||
updateVersion();
|
||||
}
|
||||
updateVersion();
|
||||
}
|
||||
|
||||
function handleClearClick() {
|
||||
$markdownElem.value = '';
|
||||
$markedVerElem.value = 'master';
|
||||
$commitVerElem.style.display = 'none';
|
||||
updateVersion().then(setDefaultOptions);
|
||||
}
|
||||
|
||||
function handleAddVersion(e) {
|
||||
if (e.which === 13) {
|
||||
switch ($markedVerElem.value) {
|
||||
case 'commit': {
|
||||
const commit = $commitVerElem.value.toLowerCase();
|
||||
if (!commit.match(/^[0-9a-f]{40}$/)) {
|
||||
alert('That is not a valid commit');
|
||||
return;
|
||||
}
|
||||
addCommitVersion('commit:' + commit, commit.substring(0, 7), commit);
|
||||
$markedVerElem.value = 'commit:' + commit;
|
||||
$commitVerElem.style.display = 'none';
|
||||
$commitVerElem.value = '';
|
||||
updateVersion();
|
||||
break;
|
||||
}
|
||||
case 'pr': {
|
||||
$commitVerElem.disabled = true;
|
||||
const pr = $commitVerElem.value.replace(/\D/g, '');
|
||||
getPrCommit(pr)
|
||||
.then(function(commit) {
|
||||
$commitVerElem.disabled = false;
|
||||
if (!commit) {
|
||||
alert('That is not a valid PR');
|
||||
return;
|
||||
}
|
||||
addCommitVersion('pr:' + pr, 'PR #' + pr, commit);
|
||||
$markedVerElem.value = 'pr:' + pr;
|
||||
$commitVerElem.style.display = 'none';
|
||||
$commitVerElem.value = '';
|
||||
updateVersion();
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
$markedVerElem.value = latestVersion;
|
||||
updateVersion();
|
||||
setDefaultOptions();
|
||||
}
|
||||
|
||||
function handleInputChange() {
|
||||
@@ -254,29 +174,6 @@ function handleChange(panes, visiblePane) {
|
||||
return active;
|
||||
}
|
||||
|
||||
function addCommitVersion(value, text, commit) {
|
||||
if (markedVersions[value]) {
|
||||
return;
|
||||
}
|
||||
markedVersions[value] = 'https://cdn.jsdelivr.net/gh/markedjs/marked@' + commit;
|
||||
const opt = document.createElement('option');
|
||||
opt.textContent = text;
|
||||
opt.value = value;
|
||||
$markedVerElem.insertBefore(opt, $markedVerElem.firstChild);
|
||||
}
|
||||
|
||||
function getPrCommit(pr) {
|
||||
return fetch('https://api.github.com/repos/markedjs/marked/pulls/' + pr + '/commits')
|
||||
.then(function(res) {
|
||||
return res.json();
|
||||
})
|
||||
.then(function(json) {
|
||||
return json[json.length - 1].sha;
|
||||
}).catch(function() {
|
||||
// return undefined
|
||||
});
|
||||
}
|
||||
|
||||
function setDefaultOptions() {
|
||||
return messageWorker({
|
||||
task: 'defaults',
|
||||
@@ -287,7 +184,7 @@ function setDefaultOptions() {
|
||||
function setOptions(opts) {
|
||||
$optionsElem.value = JSON.stringify(
|
||||
opts,
|
||||
function(key, value) {
|
||||
(key, value) => {
|
||||
if (value && typeof value === 'object' && Object.getPrototypeOf(value) !== Object.prototype) {
|
||||
return undefined;
|
||||
}
|
||||
@@ -314,12 +211,20 @@ function searchToObject() {
|
||||
}
|
||||
|
||||
function getScrollSize() {
|
||||
if (!$activeOutputElem) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const e = $activeOutputElem;
|
||||
|
||||
return e.scrollHeight - e.clientHeight;
|
||||
}
|
||||
|
||||
function getScrollPercent() {
|
||||
if (!$activeOutputElem) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
const size = getScrollSize();
|
||||
|
||||
if (size <= 0) {
|
||||
@@ -330,7 +235,9 @@ function getScrollPercent() {
|
||||
}
|
||||
|
||||
function setScrollPercent(percent) {
|
||||
$activeOutputElem.scrollTop = percent * getScrollSize();
|
||||
if ($activeOutputElem) {
|
||||
$activeOutputElem.scrollTop = percent * getScrollSize();
|
||||
}
|
||||
}
|
||||
|
||||
function updateLink() {
|
||||
@@ -347,11 +254,10 @@ function updateLink() {
|
||||
|
||||
function updateVersion() {
|
||||
handleInput();
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
function checkForChanges() {
|
||||
if (inputDirty && $markedVerElem.value !== 'commit' && $markedVerElem.value !== 'pr') {
|
||||
if (inputDirty && $markedVerElem.value !== 'pr') {
|
||||
inputDirty = false;
|
||||
|
||||
updateLink();
|
||||
@@ -419,7 +325,7 @@ function messageWorker(message) {
|
||||
markedWorker.terminate();
|
||||
}
|
||||
markedWorker = new Worker('worker.js');
|
||||
markedWorker.onmessage = function(e) {
|
||||
markedWorker.onmessage = (e) => {
|
||||
clearTimeout(markedWorker.timeout);
|
||||
markedWorker.working = false;
|
||||
switch (e.data.task) {
|
||||
@@ -444,7 +350,7 @@ function messageWorker(message) {
|
||||
workerPromises[e.data.id]();
|
||||
delete workerPromises[e.data.id];
|
||||
};
|
||||
markedWorker.onerror = markedWorker.onmessageerror = function(err) {
|
||||
markedWorker.onerror = markedWorker.onmessageerror = (err) => {
|
||||
clearTimeout(markedWorker.timeout);
|
||||
let error = 'There was an error in the Worker';
|
||||
if (err) {
|
||||
@@ -466,7 +372,7 @@ function messageWorker(message) {
|
||||
markedWorker.working = true;
|
||||
workerTimeout(0);
|
||||
}
|
||||
return new Promise(function(resolve) {
|
||||
return new Promise(resolve => {
|
||||
message.id = uniqueWorkerMessageId();
|
||||
workerPromises[message.id] = resolve;
|
||||
markedWorker.postMessage(message);
|
||||
@@ -482,7 +388,7 @@ function uniqueWorkerMessageId() {
|
||||
}
|
||||
|
||||
function workerTimeout(seconds) {
|
||||
markedWorker.timeout = setTimeout(function() {
|
||||
markedWorker.timeout = setTimeout(() => {
|
||||
seconds++;
|
||||
markedWorker.onerror('Marked has taken longer than ' + seconds + ' second' + (seconds > 1 ? 's' : '') + ' to respond...');
|
||||
workerTimeout(seconds);
|
||||
|
||||
@@ -37,11 +37,8 @@
|
||||
<a id="permalink">Permalink</a> ·
|
||||
<span>Version: </span>
|
||||
<select id="markedVersion">
|
||||
<option value="pr">Add PR:</option>
|
||||
<option value="commit">Add Commit:</option>
|
||||
<option value="master" selected>master</option>
|
||||
</select>
|
||||
<input type="text" id="commitVersion" title="Press ENTER to add commit" />·
|
||||
<option value="master"selected>master</option>
|
||||
</select> ·
|
||||
<button id="clear">Clear</button>
|
||||
<select id="inputType">
|
||||
<option value="markdown">Markdown</option>
|
||||
|
||||
Generated
-2402
File diff suppressed because it is too large
Load Diff
Generated
-1
File diff suppressed because one or more lines are too long
-616
@@ -1,616 +0,0 @@
|
||||
declare module "Tokens" {
|
||||
export type Token = (Tokens.Space | Tokens.Code | Tokens.Heading | Tokens.Table | Tokens.Hr | Tokens.Blockquote | Tokens.List | Tokens.ListItem | Tokens.Paragraph | Tokens.HTML | Tokens.Text | Tokens.Def | Tokens.Escape | Tokens.Tag | Tokens.Image | Tokens.Link | Tokens.Strong | Tokens.Em | Tokens.Codespan | Tokens.Br | Tokens.Del | Tokens.Generic);
|
||||
export namespace Tokens {
|
||||
interface Space {
|
||||
type: 'space';
|
||||
raw: string;
|
||||
}
|
||||
interface Code {
|
||||
type: 'code';
|
||||
raw: string;
|
||||
codeBlockStyle?: 'indented' | undefined;
|
||||
lang?: string | undefined;
|
||||
text: string;
|
||||
escaped?: boolean;
|
||||
}
|
||||
interface Heading {
|
||||
type: 'heading';
|
||||
raw: string;
|
||||
depth: number;
|
||||
text: string;
|
||||
tokens: Token[];
|
||||
}
|
||||
interface Table {
|
||||
type: 'table';
|
||||
raw: string;
|
||||
align: Array<'center' | 'left' | 'right' | null>;
|
||||
header: TableCell[];
|
||||
rows: TableCell[][];
|
||||
}
|
||||
interface TableCell {
|
||||
text: string;
|
||||
tokens: Token[];
|
||||
}
|
||||
interface Hr {
|
||||
type: 'hr';
|
||||
raw: string;
|
||||
}
|
||||
interface Blockquote {
|
||||
type: 'blockquote';
|
||||
raw: string;
|
||||
text: string;
|
||||
tokens: Token[];
|
||||
}
|
||||
interface List {
|
||||
type: 'list';
|
||||
raw: string;
|
||||
ordered: boolean;
|
||||
start: number | '';
|
||||
loose: boolean;
|
||||
items: ListItem[];
|
||||
}
|
||||
interface ListItem {
|
||||
type: 'list_item';
|
||||
raw: string;
|
||||
task: boolean;
|
||||
checked?: boolean | undefined;
|
||||
loose: boolean;
|
||||
text: string;
|
||||
tokens: Token[];
|
||||
}
|
||||
interface Paragraph {
|
||||
type: 'paragraph';
|
||||
raw: string;
|
||||
pre?: boolean | undefined;
|
||||
text: string;
|
||||
tokens: Token[];
|
||||
}
|
||||
interface HTML {
|
||||
type: 'html';
|
||||
raw: string;
|
||||
pre: boolean;
|
||||
text: string;
|
||||
block: boolean;
|
||||
}
|
||||
interface Text {
|
||||
type: 'text';
|
||||
raw: string;
|
||||
text: string;
|
||||
tokens?: Token[];
|
||||
}
|
||||
interface Def {
|
||||
type: 'def';
|
||||
raw: string;
|
||||
tag: string;
|
||||
href: string;
|
||||
title: string;
|
||||
}
|
||||
interface Escape {
|
||||
type: 'escape';
|
||||
raw: string;
|
||||
text: string;
|
||||
}
|
||||
interface Tag {
|
||||
type: 'text' | 'html';
|
||||
raw: string;
|
||||
inLink: boolean;
|
||||
inRawBlock: boolean;
|
||||
text: string;
|
||||
block: boolean;
|
||||
}
|
||||
interface Link {
|
||||
type: 'link';
|
||||
raw: string;
|
||||
href: string;
|
||||
title?: string | null;
|
||||
text: string;
|
||||
tokens: Token[];
|
||||
}
|
||||
interface Image {
|
||||
type: 'image';
|
||||
raw: string;
|
||||
href: string;
|
||||
title: string | null;
|
||||
text: string;
|
||||
}
|
||||
interface Strong {
|
||||
type: 'strong';
|
||||
raw: string;
|
||||
text: string;
|
||||
tokens: Token[];
|
||||
}
|
||||
interface Em {
|
||||
type: 'em';
|
||||
raw: string;
|
||||
text: string;
|
||||
tokens: Token[];
|
||||
}
|
||||
interface Codespan {
|
||||
type: 'codespan';
|
||||
raw: string;
|
||||
text: string;
|
||||
}
|
||||
interface Br {
|
||||
type: 'br';
|
||||
raw: string;
|
||||
}
|
||||
interface Del {
|
||||
type: 'del';
|
||||
raw: string;
|
||||
text: string;
|
||||
tokens: Token[];
|
||||
}
|
||||
interface Generic {
|
||||
[index: string]: any;
|
||||
type: string;
|
||||
raw: string;
|
||||
tokens?: Token[] | undefined;
|
||||
}
|
||||
}
|
||||
export type Links = Record<string, Pick<Tokens.Link | Tokens.Image, 'href' | 'title'>>;
|
||||
export type TokensList = Token[] & {
|
||||
links: Links;
|
||||
};
|
||||
}
|
||||
declare module "rules" {
|
||||
export type Rule = RegExp | string;
|
||||
export interface Rules {
|
||||
[ruleName: string]: Pick<RegExp, 'exec'> | Rule | Rules;
|
||||
}
|
||||
type BlockRuleNames = 'newline' | 'code' | 'fences' | 'hr' | 'heading' | 'blockquote' | 'list' | 'html' | 'def' | 'lheading' | '_paragraph' | 'text' | '_label' | '_title' | 'bullet' | 'listItemStart' | '_tag' | '_comment' | 'paragraph' | 'uote';
|
||||
type BlockSubRuleNames = 'normal' | 'gfm' | 'pedantic';
|
||||
type InlineRuleNames = 'escape' | 'autolink' | 'tag' | 'link' | 'reflink' | 'nolink' | 'reflinkSearch' | 'code' | 'br' | 'text' | '_punctuation' | 'punctuation' | 'blockSkip' | 'escapedEmSt' | '_comment' | '_escapes' | '_scheme' | '_email' | '_attribute' | '_label' | '_href' | '_title' | 'strong' | '_extended_email' | '_backpedal';
|
||||
type InlineSubRuleNames = 'gfm' | 'emStrong' | 'normal' | 'pedantic' | 'breaks';
|
||||
/**
|
||||
* Block-Level Grammar
|
||||
*/
|
||||
export const block: Record<BlockRuleNames, Rule> & Record<BlockSubRuleNames, Rules> & Rules;
|
||||
/**
|
||||
* Inline-Level Grammar
|
||||
*/
|
||||
export const inline: Record<InlineRuleNames, Rule> & Record<InlineSubRuleNames, Rules> & Rules;
|
||||
}
|
||||
declare module "helpers" {
|
||||
import type { Rule } from "rules";
|
||||
export function escape(html: string, encode?: boolean): string;
|
||||
export function unescape(html: string): string;
|
||||
export function edit(regex: Rule, opt?: string): {
|
||||
replace: (name: string | RegExp, val: string | RegExp) => any;
|
||||
getRegex: () => RegExp;
|
||||
};
|
||||
export function cleanUrl(href: string): string | null;
|
||||
export const noopTest: {
|
||||
exec: () => null;
|
||||
};
|
||||
export function splitCells(tableRow: string, count?: number): string[];
|
||||
/**
|
||||
* Remove trailing 'c's. Equivalent to str.replace(/c*$/, '').
|
||||
* /c*$/ is vulnerable to REDOS.
|
||||
*
|
||||
* @param str
|
||||
* @param c
|
||||
* @param invert Remove suffix of non-c chars instead. Default falsey.
|
||||
*/
|
||||
export function rtrim(str: string, c: string, invert?: boolean): string;
|
||||
export function findClosingBracket(str: string, b: string): number;
|
||||
}
|
||||
declare module "Renderer" {
|
||||
import type { MarkedOptions } from "MarkedOptions";
|
||||
/**
|
||||
* Renderer
|
||||
*/
|
||||
export class _Renderer {
|
||||
options: MarkedOptions;
|
||||
constructor(options?: MarkedOptions);
|
||||
code(code: string, infostring: string | undefined, escaped: boolean): string;
|
||||
blockquote(quote: string): string;
|
||||
html(html: string, block?: boolean): string;
|
||||
heading(text: string, level: number, raw: string): string;
|
||||
hr(): string;
|
||||
list(body: string, ordered: boolean, start: number | ''): string;
|
||||
listitem(text: string, task: boolean, checked: boolean): string;
|
||||
checkbox(checked: boolean): string;
|
||||
paragraph(text: string): string;
|
||||
table(header: string, body: string): string;
|
||||
tablerow(content: string): string;
|
||||
tablecell(content: string, flags: {
|
||||
header: boolean;
|
||||
align: 'center' | 'left' | 'right' | null;
|
||||
}): string;
|
||||
/**
|
||||
* span level renderer
|
||||
*/
|
||||
strong(text: string): string;
|
||||
em(text: string): string;
|
||||
codespan(text: string): string;
|
||||
br(): string;
|
||||
del(text: string): string;
|
||||
link(href: string, title: string | null | undefined, text: string): string;
|
||||
image(href: string, title: string | null, text: string): string;
|
||||
text(text: string): string;
|
||||
}
|
||||
}
|
||||
declare module "TextRenderer" {
|
||||
/**
|
||||
* TextRenderer
|
||||
* returns only the textual part of the token
|
||||
*/
|
||||
export class _TextRenderer {
|
||||
strong(text: string): string;
|
||||
em(text: string): string;
|
||||
codespan(text: string): string;
|
||||
del(text: string): string;
|
||||
html(text: string): string;
|
||||
text(text: string): string;
|
||||
link(href: string, title: string | null | undefined, text: string): string;
|
||||
image(href: string, title: string | null, text: string): string;
|
||||
br(): string;
|
||||
}
|
||||
}
|
||||
declare module "Parser" {
|
||||
import { _Renderer } from "Renderer";
|
||||
import { _TextRenderer } from "TextRenderer";
|
||||
import type { Token } from "Tokens";
|
||||
import type { MarkedOptions } from "MarkedOptions";
|
||||
/**
|
||||
* Parsing & Compiling
|
||||
*/
|
||||
export class _Parser {
|
||||
options: MarkedOptions;
|
||||
renderer: _Renderer;
|
||||
textRenderer: _TextRenderer;
|
||||
constructor(options?: MarkedOptions);
|
||||
/**
|
||||
* Static Parse Method
|
||||
*/
|
||||
static parse(tokens: Token[], options?: MarkedOptions): string;
|
||||
/**
|
||||
* Static Parse Inline Method
|
||||
*/
|
||||
static parseInline(tokens: Token[], options?: MarkedOptions): string;
|
||||
/**
|
||||
* Parse Loop
|
||||
*/
|
||||
parse(tokens: Token[], top?: boolean): string;
|
||||
/**
|
||||
* Parse Inline Tokens
|
||||
*/
|
||||
parseInline(tokens: Token[], renderer?: _Renderer | _TextRenderer): string;
|
||||
}
|
||||
}
|
||||
declare module "Tokenizer" {
|
||||
import type { _Lexer } from "Lexer";
|
||||
import type { Links, Tokens } from "Tokens";
|
||||
import type { MarkedOptions } from "MarkedOptions";
|
||||
/**
|
||||
* Tokenizer
|
||||
*/
|
||||
export class _Tokenizer {
|
||||
options: MarkedOptions;
|
||||
rules: any;
|
||||
lexer: _Lexer;
|
||||
constructor(options?: MarkedOptions);
|
||||
space(src: string): Tokens.Space | undefined;
|
||||
code(src: string): Tokens.Code | undefined;
|
||||
fences(src: string): Tokens.Code | undefined;
|
||||
heading(src: string): Tokens.Heading | undefined;
|
||||
hr(src: string): Tokens.Hr | undefined;
|
||||
blockquote(src: string): Tokens.Blockquote | undefined;
|
||||
list(src: string): Tokens.List | undefined;
|
||||
html(src: string): Tokens.HTML | undefined;
|
||||
def(src: string): Tokens.Def | undefined;
|
||||
table(src: string): Tokens.Table | undefined;
|
||||
lheading(src: string): Tokens.Heading | undefined;
|
||||
paragraph(src: string): Tokens.Paragraph | undefined;
|
||||
text(src: string): Tokens.Text | undefined;
|
||||
escape(src: string): Tokens.Escape | undefined;
|
||||
tag(src: string): Tokens.Tag | undefined;
|
||||
link(src: string): Tokens.Link | Tokens.Image | undefined;
|
||||
reflink(src: string, links: Links): Tokens.Link | Tokens.Image | Tokens.Text | undefined;
|
||||
emStrong(src: string, maskedSrc: string, prevChar?: string): Tokens.Em | Tokens.Strong | undefined;
|
||||
codespan(src: string): Tokens.Codespan | undefined;
|
||||
br(src: string): Tokens.Br | undefined;
|
||||
del(src: string): Tokens.Del | undefined;
|
||||
autolink(src: string): Tokens.Link | undefined;
|
||||
url(src: string): Tokens.Link | undefined;
|
||||
inlineText(src: string): Tokens.Text | undefined;
|
||||
}
|
||||
}
|
||||
declare module "Lexer" {
|
||||
import type { Token, TokensList } from "Tokens";
|
||||
import type { MarkedOptions } from "MarkedOptions";
|
||||
import type { Rules } from "rules";
|
||||
/**
|
||||
* Block Lexer
|
||||
*/
|
||||
export class _Lexer {
|
||||
tokens: TokensList;
|
||||
options: MarkedOptions;
|
||||
state: {
|
||||
inLink: boolean;
|
||||
inRawBlock: boolean;
|
||||
top: boolean;
|
||||
};
|
||||
private tokenizer;
|
||||
private inlineQueue;
|
||||
constructor(options?: MarkedOptions);
|
||||
/**
|
||||
* Expose Rules
|
||||
*/
|
||||
static get rules(): Rules;
|
||||
/**
|
||||
* Static Lex Method
|
||||
*/
|
||||
static lex(src: string, options?: MarkedOptions): TokensList;
|
||||
/**
|
||||
* Static Lex Inline Method
|
||||
*/
|
||||
static lexInline(src: string, options?: MarkedOptions): Token[];
|
||||
/**
|
||||
* Preprocessing
|
||||
*/
|
||||
lex(src: string): TokensList;
|
||||
/**
|
||||
* Lexing
|
||||
*/
|
||||
blockTokens(src: string, tokens?: Token[]): Token[];
|
||||
blockTokens(src: string, tokens?: TokensList): TokensList;
|
||||
inline(src: string, tokens?: Token[]): Token[];
|
||||
/**
|
||||
* Lexing/Compiling
|
||||
*/
|
||||
inlineTokens(src: string, tokens?: Token[]): Token[];
|
||||
}
|
||||
}
|
||||
declare module "MarkedOptions" {
|
||||
import type { Token, Tokens, TokensList } from "Tokens";
|
||||
import type { _Parser } from "Parser";
|
||||
import type { _Lexer } from "Lexer";
|
||||
import type { _Renderer } from "Renderer";
|
||||
import type { _Tokenizer } from "Tokenizer";
|
||||
export interface TokenizerThis {
|
||||
lexer: _Lexer;
|
||||
}
|
||||
export type TokenizerExtensionFunction = (this: TokenizerThis, src: string, tokens: Token[] | TokensList) => Tokens.Generic | undefined;
|
||||
export type TokenizerStartFunction = (this: TokenizerThis, src: string) => number | void;
|
||||
export interface TokenizerExtension {
|
||||
name: string;
|
||||
level: 'block' | 'inline';
|
||||
start?: TokenizerStartFunction | undefined;
|
||||
tokenizer: TokenizerExtensionFunction;
|
||||
childTokens?: string[] | undefined;
|
||||
}
|
||||
export interface RendererThis {
|
||||
parser: _Parser;
|
||||
}
|
||||
export type RendererExtensionFunction = (this: RendererThis, token: Tokens.Generic) => string | false | undefined;
|
||||
export interface RendererExtension {
|
||||
name: string;
|
||||
renderer: RendererExtensionFunction;
|
||||
}
|
||||
export type TokenizerAndRendererExtension = TokenizerExtension | RendererExtension | (TokenizerExtension & RendererExtension);
|
||||
type RendererApi = Omit<_Renderer, 'constructor' | 'options'>;
|
||||
type RendererObject = {
|
||||
[K in keyof RendererApi]?: (...args: Parameters<RendererApi[K]>) => ReturnType<RendererApi[K]> | false;
|
||||
};
|
||||
type TokenizerApi = Omit<_Tokenizer, 'constructor' | 'options' | 'rules' | 'lexer'>;
|
||||
type TokenizerObject = {
|
||||
[K in keyof TokenizerApi]?: (...args: Parameters<TokenizerApi[K]>) => ReturnType<TokenizerApi[K]> | false;
|
||||
};
|
||||
export interface MarkedExtension {
|
||||
/**
|
||||
* True will tell marked to await any walkTokens functions before parsing the tokens and returning an HTML string.
|
||||
*/
|
||||
async?: boolean;
|
||||
/**
|
||||
* Enable GFM line breaks. This option requires the gfm option to be true.
|
||||
*/
|
||||
breaks?: boolean | undefined;
|
||||
/**
|
||||
* Add tokenizers and renderers to marked
|
||||
*/
|
||||
extensions?: TokenizerAndRendererExtension[] | undefined | null;
|
||||
/**
|
||||
* Enable GitHub flavored markdown.
|
||||
*/
|
||||
gfm?: boolean | undefined;
|
||||
/**
|
||||
* Hooks are methods that hook into some part of marked.
|
||||
* preprocess is called to process markdown before sending it to marked.
|
||||
* postprocess is called to process html after marked has finished parsing.
|
||||
*/
|
||||
hooks?: {
|
||||
preprocess: (markdown: string) => string | Promise<string>;
|
||||
postprocess: (html: string) => string | Promise<string>;
|
||||
options?: MarkedOptions;
|
||||
} | null;
|
||||
/**
|
||||
* Conform to obscure parts of markdown.pl as much as possible. Don't fix any of the original markdown bugs or poor behavior.
|
||||
*/
|
||||
pedantic?: boolean | undefined;
|
||||
/**
|
||||
* Type: object Default: new Renderer()
|
||||
*
|
||||
* An object containing functions to render tokens to HTML.
|
||||
*/
|
||||
renderer?: RendererObject | undefined | null;
|
||||
/**
|
||||
* Shows an HTML error message when rendering fails.
|
||||
*/
|
||||
silent?: boolean | undefined;
|
||||
/**
|
||||
* The tokenizer defines how to turn markdown text into tokens.
|
||||
*/
|
||||
tokenizer?: TokenizerObject | undefined | null;
|
||||
/**
|
||||
* The walkTokens function gets called with every token.
|
||||
* Child tokens are called before moving on to sibling tokens.
|
||||
* Each token is passed by reference so updates are persisted when passed to the parser.
|
||||
* The return value of the function is ignored.
|
||||
*/
|
||||
walkTokens?: ((token: Token) => void | Promise<void>) | undefined | null;
|
||||
}
|
||||
export interface MarkedOptions extends Omit<MarkedExtension, 'renderer' | 'tokenizer' | 'extensions' | 'walkTokens'> {
|
||||
/**
|
||||
* Type: object Default: new Renderer()
|
||||
*
|
||||
* An object containing functions to render tokens to HTML.
|
||||
*/
|
||||
renderer?: _Renderer | undefined | null;
|
||||
/**
|
||||
* The tokenizer defines how to turn markdown text into tokens.
|
||||
*/
|
||||
tokenizer?: _Tokenizer | undefined | null;
|
||||
/**
|
||||
* Custom extensions
|
||||
*/
|
||||
extensions?: null | {
|
||||
renderers: {
|
||||
[name: string]: RendererExtensionFunction;
|
||||
};
|
||||
childTokens: {
|
||||
[name: string]: string[];
|
||||
};
|
||||
inline?: TokenizerExtensionFunction[];
|
||||
block?: TokenizerExtensionFunction[];
|
||||
startInline?: TokenizerStartFunction[];
|
||||
startBlock?: TokenizerStartFunction[];
|
||||
};
|
||||
/**
|
||||
* walkTokens function returns array of values for Promise.all
|
||||
*/
|
||||
walkTokens?: null | ((token: Token) => void | Promise<void> | (void | Promise<void>)[]);
|
||||
}
|
||||
}
|
||||
declare module "defaults" {
|
||||
import type { MarkedOptions } from "MarkedOptions";
|
||||
/**
|
||||
* Gets the original marked default options.
|
||||
*/
|
||||
export function _getDefaults(): MarkedOptions;
|
||||
export let _defaults: MarkedOptions;
|
||||
export function changeDefaults(newDefaults: MarkedOptions): void;
|
||||
}
|
||||
declare module "Hooks" {
|
||||
import type { MarkedOptions } from "MarkedOptions";
|
||||
export class _Hooks {
|
||||
options: MarkedOptions;
|
||||
constructor(options?: MarkedOptions);
|
||||
static passThroughHooks: Set<string>;
|
||||
/**
|
||||
* Process markdown before marked
|
||||
*/
|
||||
preprocess(markdown: string): string;
|
||||
/**
|
||||
* Process HTML after marked is finished
|
||||
*/
|
||||
postprocess(html: string): string;
|
||||
}
|
||||
}
|
||||
declare module "Instance" {
|
||||
import { _Lexer } from "Lexer";
|
||||
import { _Parser } from "Parser";
|
||||
import { _Hooks } from "Hooks";
|
||||
import { _Renderer } from "Renderer";
|
||||
import { _Tokenizer } from "Tokenizer";
|
||||
import { _TextRenderer } from "TextRenderer";
|
||||
import type { MarkedExtension, MarkedOptions } from "MarkedOptions";
|
||||
import type { Token, TokensList } from "Tokens";
|
||||
export type MaybePromise = void | Promise<void>;
|
||||
export class Marked {
|
||||
#private;
|
||||
defaults: MarkedOptions;
|
||||
options: (opt: MarkedOptions) => this;
|
||||
parse: (src: string, options?: MarkedOptions | undefined | null) => string | Promise<string>;
|
||||
parseInline: (src: string, options?: MarkedOptions | undefined | null) => string | Promise<string>;
|
||||
Parser: typeof _Parser;
|
||||
parser: typeof _Parser.parse;
|
||||
Renderer: typeof _Renderer;
|
||||
TextRenderer: typeof _TextRenderer;
|
||||
Lexer: typeof _Lexer;
|
||||
lexer: typeof _Lexer.lex;
|
||||
Tokenizer: typeof _Tokenizer;
|
||||
Hooks: typeof _Hooks;
|
||||
constructor(...args: MarkedExtension[]);
|
||||
/**
|
||||
* Run callback for every token
|
||||
*/
|
||||
walkTokens(tokens: Token[] | TokensList, callback: (token: Token) => MaybePromise | MaybePromise[]): MaybePromise[];
|
||||
use(...args: MarkedExtension[]): this;
|
||||
setOptions(opt: MarkedOptions): this;
|
||||
}
|
||||
}
|
||||
declare module "marked" {
|
||||
import { _Lexer } from "Lexer";
|
||||
import { _Parser } from "Parser";
|
||||
import { _Tokenizer } from "Tokenizer";
|
||||
import { _Renderer } from "Renderer";
|
||||
import { _TextRenderer } from "TextRenderer";
|
||||
import { _Hooks } from "Hooks";
|
||||
import { _getDefaults } from "defaults";
|
||||
import type { MarkedExtension, MarkedOptions } from "MarkedOptions";
|
||||
import type { Token, TokensList } from "Tokens";
|
||||
import type { MaybePromise } from "Instance";
|
||||
/**
|
||||
* Compiles markdown to HTML asynchronously.
|
||||
*
|
||||
* @param src String of markdown source to be compiled
|
||||
* @param options Hash of options, having async: true
|
||||
* @return Promise of string of compiled HTML
|
||||
*/
|
||||
export function marked(src: string, options: MarkedOptions & {
|
||||
async: true;
|
||||
}): Promise<string>;
|
||||
/**
|
||||
* Compiles markdown to HTML synchronously.
|
||||
*
|
||||
* @param src String of markdown source to be compiled
|
||||
* @param options Optional hash of options
|
||||
* @return String of compiled HTML
|
||||
*/
|
||||
export function marked(src: string, options?: MarkedOptions): string;
|
||||
/**
|
||||
* Compiles markdown to HTML synchronously.
|
||||
*
|
||||
* @param src String of markdown source to be compiled
|
||||
* @param options Optional hash of options
|
||||
* @return String of compiled HTML
|
||||
*/
|
||||
export namespace marked {
|
||||
var options: (options: MarkedOptions) => typeof marked;
|
||||
var setOptions: (options: MarkedOptions) => typeof marked;
|
||||
var getDefaults: typeof _getDefaults;
|
||||
var defaults: MarkedOptions;
|
||||
var use: (...args: MarkedExtension[]) => typeof marked;
|
||||
var walkTokens: (tokens: Token[] | TokensList, callback: (token: Token) => MaybePromise | MaybePromise[]) => MaybePromise[];
|
||||
var parseInline: (src: string, options?: MarkedOptions | null | undefined) => string | Promise<string>;
|
||||
var Parser: typeof _Parser;
|
||||
var parser: typeof _Parser.parse;
|
||||
var Renderer: typeof _Renderer;
|
||||
var TextRenderer: typeof _TextRenderer;
|
||||
var Lexer: typeof _Lexer;
|
||||
var lexer: typeof _Lexer.lex;
|
||||
var Tokenizer: typeof _Tokenizer;
|
||||
var Hooks: typeof _Hooks;
|
||||
var parse: typeof marked;
|
||||
}
|
||||
export const options: (options: MarkedOptions) => typeof marked;
|
||||
export const setOptions: (options: MarkedOptions) => typeof marked;
|
||||
export const use: (...args: MarkedExtension[]) => typeof marked;
|
||||
export const walkTokens: (tokens: Token[] | TokensList, callback: (token: Token) => MaybePromise | MaybePromise[]) => MaybePromise[];
|
||||
export const parseInline: (src: string, options?: MarkedOptions | null | undefined) => string | Promise<string>;
|
||||
export const parse: typeof marked;
|
||||
export const parser: typeof _Parser.parse;
|
||||
export const lexer: typeof _Lexer.lex;
|
||||
export { _defaults as defaults, _getDefaults as getDefaults } from "defaults";
|
||||
export { _Lexer as Lexer } from "Lexer";
|
||||
export { _Parser as Parser } from "Parser";
|
||||
export { _Tokenizer as Tokenizer } from "Tokenizer";
|
||||
export { _Renderer as Renderer } from "Renderer";
|
||||
export { _TextRenderer as TextRenderer } from "TextRenderer";
|
||||
export { _Hooks as Hooks } from "Hooks";
|
||||
export { Marked } from "Instance";
|
||||
export type * from "MarkedOptions";
|
||||
export type * from "rules";
|
||||
export type * from "Tokens";
|
||||
}
|
||||
Generated
-2384
File diff suppressed because it is too large
Load Diff
Generated
-1
File diff suppressed because one or more lines are too long
Generated
-2408
File diff suppressed because it is too large
Load Diff
Generated
-1
File diff suppressed because one or more lines are too long
@@ -1,79 +0,0 @@
|
||||
.ds q \N'34'
|
||||
.TH marked 1
|
||||
|
||||
.SH NAME
|
||||
marked \- a javascript markdown parser
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B marked
|
||||
[\-o \fI<output>\fP] [\-i \fI<input>\fP] [\-s \fI<string>\fP] [\-\-help]
|
||||
[\-c \fI<config>\fP] [\-\-tokens] [\-\-pedantic] [\-\-gfm] [\-\-breaks]
|
||||
[\-\-no\-etc...] [\-\-silent] [\fIfilename\fP]
|
||||
|
||||
.SH DESCRIPTION
|
||||
.B marked
|
||||
is a full-featured javascript markdown parser, built for speed.
|
||||
It also includes multiple GFM features.
|
||||
|
||||
.SH EXAMPLES
|
||||
.TP
|
||||
cat in.md | marked > out.html
|
||||
.TP
|
||||
echo "hello *world*" | marked
|
||||
.TP
|
||||
marked \-o out.html \-i in.md \-\-gfm
|
||||
.TP
|
||||
marked \-\-output="hello world.html" \-i in.md \-\-no-breaks
|
||||
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.BI \-o,\ \-\-output\ [\fIoutput\fP]
|
||||
Specify file output. If none is specified, write to stdout.
|
||||
.TP
|
||||
.BI \-i,\ \-\-input\ [\fIinput\fP]
|
||||
Specify file input, otherwise use last argument as input file.
|
||||
If no input file is specified, read from stdin.
|
||||
.TP
|
||||
.BI \-s,\ \-\-string\ [\fIstring\fP]
|
||||
Specify string input instead of a file.
|
||||
.TP
|
||||
.BI \-c,\ \-\-config\ [\fIconfig\fP]
|
||||
Specify a javascript file to be used as the config file
|
||||
instead of the default file in your home directory.
|
||||
.TP
|
||||
.BI \-t,\ \-\-tokens
|
||||
Output a token stream instead of html.
|
||||
.TP
|
||||
.BI \-\-pedantic
|
||||
Conform to obscure parts of markdown.pl as much as possible.
|
||||
Don't fix original markdown bugs.
|
||||
.TP
|
||||
.BI \-\-gfm
|
||||
Enable github flavored markdown.
|
||||
.TP
|
||||
.BI \-\-breaks
|
||||
Enable GFM line breaks. Only works with the gfm option.
|
||||
.TP
|
||||
.BI \-\-silent
|
||||
Silence error output.
|
||||
.TP
|
||||
.BI \-h,\ \-\-help
|
||||
Display help information.
|
||||
|
||||
.SH CONFIGURATION
|
||||
For configuring and running programmatically.
|
||||
|
||||
.B Example
|
||||
|
||||
import { marked } from 'marked';
|
||||
marked('*foo*', { gfm: true });
|
||||
|
||||
.SH BUGS
|
||||
Please report any bugs to https://github.com/markedjs/marked.
|
||||
|
||||
.SH LICENSE
|
||||
Copyright (c) 2011-2014, Christopher Jeffrey (MIT License).
|
||||
|
||||
.SH "SEE ALSO"
|
||||
.BR markdown(1),
|
||||
.BR node.js(1)
|
||||
@@ -0,0 +1,89 @@
|
||||
# marked(1) -- a javascript markdown parser
|
||||
|
||||
## SYNOPSIS
|
||||
|
||||
`marked` [`-o` <output file>] [`-i` <input file>] [`-s` <markdown string>] [`-c` <config file>] [`--help`] [`--version`] [`--tokens`] [`--pedantic`] [`--gfm`] [`--breaks`] [`--no-etc...`] [`--silent`] [filename]
|
||||
|
||||
## DESCRIPTION
|
||||
|
||||
marked is a full-featured javascript markdown parser, built for speed.
|
||||
It also includes multiple GFM features.
|
||||
|
||||
## EXAMPLES
|
||||
|
||||
```sh
|
||||
cat in.md | marked > out.html
|
||||
```
|
||||
|
||||
```sh
|
||||
echo "hello *world*" | marked
|
||||
```
|
||||
|
||||
```sh
|
||||
marked -o out.html -i in.md --gfm
|
||||
```
|
||||
|
||||
```sh
|
||||
marked --output="hello world.html" -i in.md --no-breaks
|
||||
```
|
||||
|
||||
## OPTIONS
|
||||
|
||||
* -o, --output [output file]
|
||||
Specify file output. If none is specified, write to stdout.
|
||||
|
||||
* -i, --input [input file]
|
||||
Specify file input, otherwise use last argument as input file.
|
||||
If no input file is specified, read from stdin.
|
||||
|
||||
* -s, --string [markdown string]
|
||||
Specify string input instead of a file.
|
||||
|
||||
* -c, --config [config file]
|
||||
Specify config file to use instead of the default `~/.marked.json` or `~/.marked.js` or `~/.marked/index.js`.
|
||||
|
||||
* -t, --tokens
|
||||
Output a token list instead of html.
|
||||
|
||||
* --pedantic
|
||||
Conform to obscure parts of markdown.pl as much as possible.
|
||||
Don't fix original markdown bugs.
|
||||
|
||||
* --gfm
|
||||
Enable github flavored markdown.
|
||||
|
||||
* --breaks
|
||||
Enable GFM line breaks. Only works with the gfm option.
|
||||
|
||||
* --no-breaks, -no-etc...
|
||||
The inverse of any of the marked options above.
|
||||
|
||||
* --silent
|
||||
Silence error output.
|
||||
|
||||
* -h, --help
|
||||
Display help information.
|
||||
|
||||
## CONFIGURATION
|
||||
|
||||
For configuring and running programmatically.
|
||||
|
||||
Example
|
||||
|
||||
```js
|
||||
import { Marked } from 'marked';
|
||||
const marked = new Marked({ gfm: true });
|
||||
marked.parse('*foo*');
|
||||
```
|
||||
|
||||
## BUGS
|
||||
|
||||
Please report any bugs to <https://github.com/markedjs/marked>.
|
||||
|
||||
## LICENSE
|
||||
|
||||
Copyright (c) 2011-2014, Christopher Jeffrey (MIT License).
|
||||
|
||||
## SEE ALSO
|
||||
|
||||
markdown(1), nodejs(1)
|
||||
@@ -1,73 +0,0 @@
|
||||
marked(1) General Commands Manual marked(1)
|
||||
|
||||
NAME
|
||||
marked - a javascript markdown parser
|
||||
|
||||
SYNOPSIS
|
||||
marked [-o <output>] [-i <input>] [-s <string>] [--help] [--tokens]
|
||||
[--pedantic] [--gfm] [--breaks] [--no-etc...] [--silent] [filename]
|
||||
|
||||
|
||||
DESCRIPTION
|
||||
marked is a full-featured javascript markdown parser, built for speed.
|
||||
It also includes multiple GFM features.
|
||||
|
||||
EXAMPLES
|
||||
cat in.md | marked > out.html
|
||||
|
||||
echo "hello *world*" | marked
|
||||
|
||||
marked -o out.html -i in.md --gfm
|
||||
|
||||
marked --output="hello world.html" -i in.md --no-breaks
|
||||
|
||||
OPTIONS
|
||||
-o, --output [output]
|
||||
Specify file output. If none is specified, write to stdout.
|
||||
|
||||
-i, --input [input]
|
||||
Specify file input, otherwise use last argument as input file.
|
||||
If no input file is specified, read from stdin.
|
||||
|
||||
-s, --string [string]
|
||||
Specify string input instead of a file.
|
||||
|
||||
-t, --tokens
|
||||
Output a token stream instead of html.
|
||||
|
||||
--pedantic
|
||||
Conform to obscure parts of markdown.pl as much as possible.
|
||||
Don't fix original markdown bugs.
|
||||
|
||||
--gfm Enable github flavored markdown.
|
||||
|
||||
--breaks
|
||||
Enable GFM line breaks. Only works with the gfm option.
|
||||
|
||||
--no-breaks, -no-etc...
|
||||
The inverse of any of the marked options above.
|
||||
|
||||
--silent
|
||||
Silence error output.
|
||||
|
||||
-h, --help
|
||||
Display help information.
|
||||
|
||||
CONFIGURATION
|
||||
For configuring and running programmatically.
|
||||
|
||||
Example
|
||||
|
||||
import { marked } from 'marked';
|
||||
marked('*foo*', { gfm: true });
|
||||
|
||||
BUGS
|
||||
Please report any bugs to https://github.com/markedjs/marked.
|
||||
|
||||
LICENSE
|
||||
Copyright (c) 2011-2014, Christopher Jeffrey (MIT License).
|
||||
|
||||
SEE ALSO
|
||||
markdown(1), node.js(1)
|
||||
|
||||
marked(1)
|
||||
-14
File diff suppressed because one or more lines are too long
Generated
+287
-15
@@ -13,6 +13,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@markedjs/html-differ": "^4.0.2",
|
||||
"@rollup/plugin-terser": "^0.4.3",
|
||||
"@rollup/plugin-typescript": "^11.1.3",
|
||||
"@semantic-release/commit-analyzer": "^10.0.4",
|
||||
"@semantic-release/git": "^10.0.1",
|
||||
@@ -34,6 +35,7 @@
|
||||
"jasmine": "^5.1.0",
|
||||
"markdown-it": "13.0.1",
|
||||
"marked-highlight": "^2.0.5",
|
||||
"marked-man": "^1.3.4",
|
||||
"node-fetch": "^3.3.2",
|
||||
"recheck": "^4.4.5",
|
||||
"rollup": "^3.28.1",
|
||||
@@ -41,8 +43,7 @@
|
||||
"titleize": "^4.0.0",
|
||||
"ts-expect": "^1.3.0",
|
||||
"ts-node": "^10.9.1",
|
||||
"typescript": "5.2.2",
|
||||
"uglify-js": "^3.17.4"
|
||||
"typescript": "5.2.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 16"
|
||||
@@ -309,6 +310,20 @@
|
||||
"url": "https://github.com/chalk/wrap-ansi?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/@jridgewell/gen-mapping": {
|
||||
"version": "0.3.3",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz",
|
||||
"integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@jridgewell/set-array": "^1.0.1",
|
||||
"@jridgewell/sourcemap-codec": "^1.4.10",
|
||||
"@jridgewell/trace-mapping": "^0.3.9"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@jridgewell/resolve-uri": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz",
|
||||
@@ -318,12 +333,41 @@
|
||||
"node": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@jridgewell/set-array": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz",
|
||||
"integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@jridgewell/source-map": {
|
||||
"version": "0.3.5",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.5.tgz",
|
||||
"integrity": "sha512-UTYAUj/wviwdsMfzoSJspJxbkH5o1snzwX0//0ENX1u/55kkZZkcTZP6u9bwKGkv+dkk9at4m1Cpt0uY80kcpQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@jridgewell/gen-mapping": "^0.3.0",
|
||||
"@jridgewell/trace-mapping": "^0.3.9"
|
||||
}
|
||||
},
|
||||
"node_modules/@jridgewell/sourcemap-codec": {
|
||||
"version": "1.4.14",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz",
|
||||
"integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@jridgewell/trace-mapping": {
|
||||
"version": "0.3.19",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.19.tgz",
|
||||
"integrity": "sha512-kf37QtfW+Hwx/buWGMPcR60iF9ziHa6r/CZJIHbmcm4+0qrXiVdxegAH0F6yddEVQ7zdkjcGCgCzUu+BcbhQxw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@jridgewell/resolve-uri": "^3.1.0",
|
||||
"@jridgewell/sourcemap-codec": "^1.4.14"
|
||||
}
|
||||
},
|
||||
"node_modules/@markedjs/html-differ": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@markedjs/html-differ/-/html-differ-4.0.2.tgz",
|
||||
@@ -569,6 +613,28 @@
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@rollup/plugin-terser": {
|
||||
"version": "0.4.3",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/plugin-terser/-/plugin-terser-0.4.3.tgz",
|
||||
"integrity": "sha512-EF0oejTMtkyhrkwCdg0HJ0IpkcaVg1MMSf2olHb2Jp+1mnLM04OhjpJWGma4HobiDTF0WCyViWuvadyE9ch2XA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"serialize-javascript": "^6.0.1",
|
||||
"smob": "^1.0.0",
|
||||
"terser": "^5.17.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"rollup": "^2.x || ^3.x"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"rollup": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@rollup/plugin-typescript": {
|
||||
"version": "11.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/plugin-typescript/-/plugin-typescript-11.1.3.tgz",
|
||||
@@ -2162,6 +2228,12 @@
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/buffer-from": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
|
||||
"integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/builtins": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/builtins/-/builtins-5.0.1.tgz",
|
||||
@@ -2366,6 +2438,12 @@
|
||||
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/commander": {
|
||||
"version": "2.20.3",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
|
||||
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/commonmark": {
|
||||
"version": "0.30.0",
|
||||
"resolved": "https://registry.npmjs.org/commonmark/-/commonmark-0.30.0.tgz",
|
||||
@@ -4147,15 +4225,6 @@
|
||||
"uglify-js": "^3.1.4"
|
||||
}
|
||||
},
|
||||
"node_modules/handlebars/node_modules/source-map": {
|
||||
"version": "0.6.1",
|
||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
|
||||
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/hard-rejection": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/hard-rejection/-/hard-rejection-2.1.0.tgz",
|
||||
@@ -5162,11 +5231,10 @@
|
||||
}
|
||||
},
|
||||
"node_modules/marked": {
|
||||
"version": "4.2.5",
|
||||
"resolved": "https://registry.npmjs.org/marked/-/marked-4.2.5.tgz",
|
||||
"integrity": "sha512-jPueVhumq7idETHkb203WDD4fMA3yV9emQ5vLwop58lu8bTclMghBWcYAavlDqIEMaisADinV1TooIFCfqOsYQ==",
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/marked/-/marked-4.3.0.tgz",
|
||||
"integrity": "sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A==",
|
||||
"dev": true,
|
||||
"peer": true,
|
||||
"bin": {
|
||||
"marked": "bin/marked.js"
|
||||
},
|
||||
@@ -5183,6 +5251,148 @@
|
||||
"marked": ">=4 <9"
|
||||
}
|
||||
},
|
||||
"node_modules/marked-man": {
|
||||
"version": "1.3.4",
|
||||
"resolved": "https://registry.npmjs.org/marked-man/-/marked-man-1.3.4.tgz",
|
||||
"integrity": "sha512-IIGGEfxGCwJpQuQslhiVF0Vx45GiOIiwnUp5cf6xYu1Go4zcQmcYoOh9cEq44qAlXr/sbLryxlFjPmvLAtJu7g==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"marked": "^4.2.12",
|
||||
"read-pkg-up": "^9.1.0"
|
||||
},
|
||||
"bin": {
|
||||
"marked-man": "bin/marked-man.js"
|
||||
}
|
||||
},
|
||||
"node_modules/marked-man/node_modules/find-up": {
|
||||
"version": "6.3.0",
|
||||
"resolved": "https://registry.npmjs.org/find-up/-/find-up-6.3.0.tgz",
|
||||
"integrity": "sha512-v2ZsoEuVHYy8ZIlYqwPe/39Cy+cFDzp4dXPaxNvkEuouymu+2Jbz0PxpKarJHYJTmv2HWT3O382qY8l4jMWthw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"locate-path": "^7.1.0",
|
||||
"path-exists": "^5.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/marked-man/node_modules/locate-path": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-7.2.0.tgz",
|
||||
"integrity": "sha512-gvVijfZvn7R+2qyPX8mAuKcFGDf6Nc61GdvGafQsHL0sBIxfKzA+usWn4GFC/bk+QdwPUD4kWFJLhElipq+0VA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"p-locate": "^6.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/marked-man/node_modules/p-limit": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-4.0.0.tgz",
|
||||
"integrity": "sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"yocto-queue": "^1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/marked-man/node_modules/p-locate": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-6.0.0.tgz",
|
||||
"integrity": "sha512-wPrq66Llhl7/4AGC6I+cqxT07LhXvWL08LNXz1fENOw0Ap4sRZZ/gZpTTJ5jpurzzzfS2W/Ge9BY3LgLjCShcw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"p-limit": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/marked-man/node_modules/path-exists": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-5.0.0.tgz",
|
||||
"integrity": "sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/marked-man/node_modules/read-pkg": {
|
||||
"version": "7.1.0",
|
||||
"resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-7.1.0.tgz",
|
||||
"integrity": "sha512-5iOehe+WF75IccPc30bWTbpdDQLOCc3Uu8bi3Dte3Eueij81yx1Mrufk8qBx/YAbR4uL1FdUr+7BKXDwEtisXg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/normalize-package-data": "^2.4.1",
|
||||
"normalize-package-data": "^3.0.2",
|
||||
"parse-json": "^5.2.0",
|
||||
"type-fest": "^2.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.20"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/marked-man/node_modules/read-pkg-up": {
|
||||
"version": "9.1.0",
|
||||
"resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-9.1.0.tgz",
|
||||
"integrity": "sha512-vaMRR1AC1nrd5CQM0PhlRsO5oc2AAigqr7cCrZ/MW/Rsaflz4RlgzkpL4qoU/z1F6wrbd85iFv1OQj/y5RdGvg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"find-up": "^6.3.0",
|
||||
"read-pkg": "^7.1.0",
|
||||
"type-fest": "^2.5.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/marked-man/node_modules/type-fest": {
|
||||
"version": "2.19.0",
|
||||
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-2.19.0.tgz",
|
||||
"integrity": "sha512-RAH822pAdBgcNMAfWnCBU3CFZcfZ/i1eZjwFU/dsLKumyuuP3niueg2UAukXYF0E2AAoc82ZSSf9J0WQBinzHA==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=12.20"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/marked-man/node_modules/yocto-queue": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.0.0.tgz",
|
||||
"integrity": "sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=12.20"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/marked-terminal": {
|
||||
"version": "5.1.1",
|
||||
"resolved": "https://registry.npmjs.org/marked-terminal/-/marked-terminal-5.1.1.tgz",
|
||||
@@ -9126,6 +9336,15 @@
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/randombytes": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz",
|
||||
"integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"safe-buffer": "^5.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/rc": {
|
||||
"version": "1.2.8",
|
||||
"resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz",
|
||||
@@ -10090,6 +10309,15 @@
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/serialize-javascript": {
|
||||
"version": "6.0.1",
|
||||
"resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.1.tgz",
|
||||
"integrity": "sha512-owoXEFjWRllis8/M1Q+Cw5k8ZH40e3zhp/ovX+Xr/vi1qj6QesbyXXViFbpNvWvPNAD62SutwEXavefrLJWj7w==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"randombytes": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/shebang-command": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
|
||||
@@ -10169,6 +10397,31 @@
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/smob": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/smob/-/smob-1.4.0.tgz",
|
||||
"integrity": "sha512-MqR3fVulhjWuRNSMydnTlweu38UhQ0HXM4buStD/S3mc/BzX3CuM9OmhyQpmtYCvoYdl5ris6TI0ZqH355Ymqg==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/source-map": {
|
||||
"version": "0.6.1",
|
||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
|
||||
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/source-map-support": {
|
||||
"version": "0.5.21",
|
||||
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz",
|
||||
"integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"buffer-from": "^1.0.0",
|
||||
"source-map": "^0.6.0"
|
||||
}
|
||||
},
|
||||
"node_modules/spawn-error-forwarder": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/spawn-error-forwarder/-/spawn-error-forwarder-1.0.0.tgz",
|
||||
@@ -10500,6 +10753,24 @@
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/terser": {
|
||||
"version": "5.19.3",
|
||||
"resolved": "https://registry.npmjs.org/terser/-/terser-5.19.3.tgz",
|
||||
"integrity": "sha512-pQzJ9UJzM0IgmT4FAtYI6+VqFf0lj/to58AV0Xfgg0Up37RyPG7Al+1cepC6/BVuAxR9oNb41/DL4DEoHJvTdg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@jridgewell/source-map": "^0.3.3",
|
||||
"acorn": "^8.8.2",
|
||||
"commander": "^2.20.0",
|
||||
"source-map-support": "~0.5.20"
|
||||
},
|
||||
"bin": {
|
||||
"terser": "bin/terser"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/text-table": {
|
||||
"version": "0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz",
|
||||
@@ -10754,6 +11025,7 @@
|
||||
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.17.4.tgz",
|
||||
"integrity": "sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"bin": {
|
||||
"uglifyjs": "bin/uglifyjs"
|
||||
},
|
||||
|
||||
+8
-7
@@ -45,6 +45,7 @@
|
||||
],
|
||||
"devDependencies": {
|
||||
"@markedjs/html-differ": "^4.0.2",
|
||||
"@rollup/plugin-terser": "^0.4.3",
|
||||
"@rollup/plugin-typescript": "^11.1.3",
|
||||
"@semantic-release/commit-analyzer": "^10.0.4",
|
||||
"@semantic-release/git": "^10.0.1",
|
||||
@@ -66,6 +67,7 @@
|
||||
"jasmine": "^5.1.0",
|
||||
"markdown-it": "13.0.1",
|
||||
"marked-highlight": "^2.0.5",
|
||||
"marked-man": "^1.3.4",
|
||||
"node-fetch": "^3.3.2",
|
||||
"recheck": "^4.4.5",
|
||||
"rollup": "^3.28.1",
|
||||
@@ -73,11 +75,10 @@
|
||||
"titleize": "^4.0.0",
|
||||
"ts-expect": "^1.3.0",
|
||||
"ts-node": "^10.9.1",
|
||||
"typescript": "5.2.2",
|
||||
"uglify-js": "^3.17.4"
|
||||
"typescript": "5.2.2"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "cross-env NODE_OPTIONS=--loader=ts-node/esm jasmine --config=jasmine.json",
|
||||
"test": "npm run build && cross-env NODE_OPTIONS=--loader=ts-node/esm jasmine --config=jasmine.json",
|
||||
"test:all": "npm test && npm run test:umd && npm run test:types && npm run test:lint",
|
||||
"test:unit": "npm test -- test/unit/**/*-spec.js",
|
||||
"test:specs": "npm test -- test/specs/**/*-spec.js",
|
||||
@@ -90,11 +91,11 @@
|
||||
"bench": "npm run build && node test/bench.js",
|
||||
"lint": "eslint --fix .",
|
||||
"build:reset": "git checkout upstream/master lib/marked.cjs lib/marked.umd.js lib/marked.esm.js marked.min.js",
|
||||
"build": "npm run rollup && npm run minify && npm run build:types",
|
||||
"build:docs": "node build-docs.js",
|
||||
"build": "npm run rollup && npm run build:types && npm run build:man",
|
||||
"build:docs": "npm run build && node docs/build.js",
|
||||
"build:types": "tsc --project tsconfig-types.json",
|
||||
"rollup": "rollup -c rollup.config.js",
|
||||
"minify": "uglifyjs lib/marked.umd.js -cm --comments /Copyright/ -o marked.min.js"
|
||||
"build:man": "marked-man man/marked.1.md > man/marked.1",
|
||||
"rollup": "rollup -c rollup.config.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 16"
|
||||
|
||||
+10
-2
@@ -1,9 +1,9 @@
|
||||
import typescript from '@rollup/plugin-typescript';
|
||||
import terser from '@rollup/plugin-terser';
|
||||
import { defineConfig } from 'rollup';
|
||||
import fs from 'fs';
|
||||
|
||||
const pkg = JSON.parse(fs.readFileSync('./package.json'));
|
||||
const version = process.env.SEMANTIC_RELEASE_NEXT_VERSION || pkg.version;
|
||||
const version = process.env.SEMANTIC_RELEASE_NEXT_VERSION || JSON.parse(fs.readFileSync('./package.json')).version;
|
||||
|
||||
console.log('building version:', version);
|
||||
|
||||
@@ -35,6 +35,14 @@ export default defineConfig([
|
||||
sourcemap: true,
|
||||
banner
|
||||
},
|
||||
{
|
||||
file: 'marked.min.js',
|
||||
format: 'umd',
|
||||
name: 'marked',
|
||||
sourcemap: false,
|
||||
banner,
|
||||
plugins: [terser()]
|
||||
},
|
||||
{
|
||||
file: 'lib/marked.cjs',
|
||||
format: 'cjs',
|
||||
|
||||
Reference in New Issue
Block a user