Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ test: $(SPEC)
npm test

bench:
node -r esm bench/bench.js ${BENCHINP}
node bench/bench.js ${BENCHINP}

bench-detailed:
sudo renice -10 $$$$; \
for x in bench/samples/*.md; do echo $$x; node -r esm bench/bench.js $$x; done | \
for x in bench/samples/*.md; do echo $$x; node bench/bench.js $$x; done | \
awk -f bench/format_benchmarks.awk

npm:
Expand Down
3 changes: 3 additions & 0 deletions bench/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"type": "module"
}
28 changes: 11 additions & 17 deletions bin/commonmark
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
#!/usr/bin/env -S node -r esm
#!/usr/bin/env node
"use strict";

import util from "util";
import fs from "fs";
import os from "os";
import * as commonmark from "../lib/index.js";
var util = require('util');
var fs = require('fs');
var commonmark = require('../');
var version = require('../package.json').version;
import parseArgs from "minimist";

var parseArgs = require('minimist');
var args = process.argv.slice(2);
var argv = parseArgs(args,
{boolean: ["ast", "xml", "time", "smart",
Expand Down Expand Up @@ -77,16 +75,12 @@ if (format === 'html') {
}

if (files.length === 0) {
if (os.platform() === "win32") {
inps.push(fs.readFileSync(0, 'utf-8'));
} else {
inps.push(fs.readFileSync('/dev/tty', 'utf-8'));
}
} else {
for (i = 0; i < files.length; i++) {
var file = files[i];
inps.push(fs.readFileSync(file, 'utf8'));
}
files = ['/dev/stdin'];
}

for (i = 0; i < files.length; i++) {
var file = files[i];
inps.push(fs.readFileSync(file, 'utf8'));
Comment on lines -80 to +83

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was there a reason for removing the platform-specific handling here?
cf. discussion in #198.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No reason for removing the platform stuff in the bin script. Looks like it was done in the same commit as ESM-ification: 9bcf45b. So git revert rolled those changes back, too.

I can replace them, or you can fee free to. Whatever's easiest for you.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not really sure why this got included with the other changes.
Well, I guess I can add them back after mrging.

}

var inp = inps.join('\n');
Expand Down
3 changes: 3 additions & 0 deletions dist/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"type": "commonjs"
}
4 changes: 2 additions & 2 deletions lib/common.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use strict";

import encode from "mdurl/encode.js";
import * as entities from "entities";
import { decodeHTML } from "entities";

var C_BACKSLASH = 92;

Expand Down Expand Up @@ -58,7 +58,7 @@ var unescapeChar = function(s) {
if (s.charCodeAt(0) === C_BACKSLASH) {
return s.charAt(1);
} else {
return entities.decodeHTML(s);
return decodeHTML(s);
}
};

Expand Down
4 changes: 2 additions & 2 deletions lib/inlines.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import Node from "./node.js";
import * as common from "./common.js";
import fromCodePoint from "./from-code-point.js";
import * as entities from "entities";
import { decodeHTML } from "entities";
import "string.prototype.repeat"; // Polyfill for String.prototype.repeat

var normalizeURI = common.normalizeURI;
Expand Down Expand Up @@ -756,7 +756,7 @@ var removeBracket = function() {
var parseEntity = function(block) {
var m;
if ((m = this.match(reEntityHere))) {
block.appendChild(text(entities.decodeHTML(m)));
block.appendChild(text(decodeHTML(m)));
return true;
} else {
return false;
Expand Down
3 changes: 3 additions & 0 deletions lib/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"type": "module"
}
5 changes: 0 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,13 @@
"scripts": {
"build": "rollup -c",
"lint": "eslint .",
"test": "node -r esm ./test/test"
"test": "node ./test/test"
},
"dependencies": {
"entities": "~2.0",
"esm": "^3.2.25",
"mdurl": "~1.0.1",
"string.prototype.repeat": "^0.2.0",
"minimist": ">=1.2.2"
"minimist": ">=1.2.2",
"string.prototype.repeat": "^0.2.0"
},
"directories": {
"lib": "./lib"
Expand Down
3 changes: 3 additions & 0 deletions test/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"type": "module"
}