Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tweet.md

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tweet.md - npm Package Compare versions

Comparing version 1.2.2 to 1.3.0

33

index.es5.js

@@ -14,18 +14,27 @@ 'use strict';

function escapeMarkdownPart(input) {
return [
var i = 0;
// escaping symbols: # * ( ) [ ] _ `
[/([\#\*\(\)\[\]\_\`\\])/g, '\\$1'],
return input.split(/(`.*?`)/g).map(function (part) {
// do not escape the code
if (0 !== i++ % 2) {
return part;
}
// escaping less and more signs
[/\</g, '&lt;'], [/\>/g, '&gt;'],
return [
// convert line break into markdown hardbrake
[/\n/g, ' \n']].reduce(function (input, _ref) {
var _ref2 = _slicedToArray(_ref, 2);
// escaping symbols: # * ( ) [ ] _ `
[/([\#\*\(\)\[\]\_\`\\])/g, '\\$1'],
var replaceFrom = _ref2[0];
var replaceTo = _ref2[1];
return input.replace(replaceFrom, replaceTo);
}, input);
// escaping less and more signs
[/\</g, '&lt;'], [/\>/g, '&gt;'],
// convert line break into markdown hardbrake
[/\n/g, ' \n']].reduce(function (input, _ref) {
var _ref2 = _slicedToArray(_ref, 2);
var replaceFrom = _ref2[0];
var replaceTo = _ref2[1];
return input.replace(replaceFrom, replaceTo);
}, part);
}).join('');
}

@@ -32,0 +41,0 @@

function escapeMarkdownPart(input) {
return [
let i = 0;
// escaping symbols: # * ( ) [ ] _ `
[/([\#\*\(\)\[\]\_\`\\])/g, '\\$1'],
return input.split(/(`.*?`)/g).map(part => {
// do not escape the code
if (0 !== i++ % 2) {
return part;
}
// escaping less and more signs
[/\</g, '&lt;'],
[/\>/g, '&gt;'],
return [
// convert line break into markdown hardbrake
[/\n/g, ' \n']
// escaping symbols: # * ( ) [ ] _ `
[/([\#\*\(\)\[\]\_\`\\])/g, '\\$1'],
].reduce((input, [replaceFrom, replaceTo]) => input.replace(replaceFrom, replaceTo), input);
// escaping less and more signs
[/\</g, '&lt;'],
[/\>/g, '&gt;'],
// convert line break into markdown hardbrake
[/\n/g, ' \n']
].reduce((input, [replaceFrom, replaceTo]) => input.replace(replaceFrom, replaceTo), part);
}).join('');
}

@@ -16,0 +25,0 @@

{
"name": "tweet.md",
"version": "1.2.2",
"version": "1.3.0",
"description": "Render tweet to markdown",

@@ -5,0 +5,0 @@ "main": "index.es5.js",

@@ -59,1 +59,9 @@ # Tweet markdown renderer

### [04-code.json](examples/04-code.json)
Tweet [572444133740179457](https://twitter.com/jsunderhood/status/572444133740179457) by Разработчик
- - -
`capitalize(trim(string))` — композиция двух операций.
- - -
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