Socket
Socket
Sign inDemoInstall

@parcel/markdown-ansi

Package Overview
Dependencies
Maintainers
1
Versions
884
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@parcel/markdown-ansi - npm Package Compare versions

Comparing version 2.0.0-alpha.3.1 to 2.0.0-beta.1

3

lib/markdown-ansi.js

@@ -17,3 +17,3 @@ "use strict";

const ITALIC_REGEX = /\*([^*]+)\*|_([^_]+)_/g;
const ITALIC_REGEX = /(?<!\\)\*(.+)(?<!\\)\*|(?<!\\)_(.+)(?<!\\)_/g;

@@ -25,3 +25,4 @@ function markdownParser(input) {

input = input.replace(ITALIC_REGEX, (...args) => _chalk.default.italic(args[1] || args[2]));
input = input.replace(/(?<!\\)\\/g, '');
return input;
}
{
"name": "@parcel/markdown-ansi",
"version": "2.0.0-alpha.3.1",
"version": "2.0.0-beta.1",
"description": "Blazing fast, zero configuration web application bundler",

@@ -21,3 +21,3 @@ "publishConfig": {

},
"gitHead": "291f3e6815a1a857a6165fafb1691ceeb878b8f6"
"gitHead": "74335525be92e23bac4ed1bf30595443cfb238e3"
}

@@ -10,3 +10,3 @@ // @flow

// single char markdown matchers
const ITALIC_REGEX = /\*([^*]+)\*|_([^_]+)_/g;
const ITALIC_REGEX = /(?<!\\)\*(.+)(?<!\\)\*|(?<!\\)_(.+)(?<!\\)_/g;

@@ -17,9 +17,10 @@ export default function markdownParser(input: string): string {

input = input.replace(STRIKETHROUGH_REGEX, (...args) =>
chalk.strikethrough(args[1])
chalk.strikethrough(args[1]),
);
input = input.replace(ITALIC_REGEX, (...args) =>
chalk.italic(args[1] || args[2])
chalk.italic(args[1] || args[2]),
);
input = input.replace(/(?<!\\)\\/g, '');
return input;
}

@@ -30,2 +30,12 @@ import assert from 'assert';

});
it('should support escape character', () => {
let res = mdAnsi('\\*\\*bold\\*\\* \\\\escape\\\\');
assert.equal(res, '**bold** \\escape\\');
});
it('should support italic with escape character', () => {
let res = mdAnsi('\\__italic_\\_');
assert.equal(res, '_\u001b[3mitalic\u001b[23m_');
});
});
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