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.0.2 to 1.1.0

examples/01-link.json

22

index.es5.js

@@ -13,7 +13,7 @@ 'use strict';

function escapeMarkdown(input) {
function escapeMarkdownPart(input) {
return [
// escaping symbols: # * ( ) [ ] _
[/([#\*\(\)\[\]\_\/`])/g, '\\$1'],
// escaping symbols: # * ( ) [ ] _ `
[/([\#\*\(\)\[\]\_\`\\])/g, '\\$1'],

@@ -30,16 +30,22 @@ // escaping less and more signs

function escapeMarkdown(input) {
return escapeMarkdownPart(input)
// escaping period after number at the string start
.replace(/^(\d+)\./, '$1\\.');
}
function renderEntityMention(data) {
return '[@' + escapeMarkdown(data.screen_name) + '](https://twitter.com/' + data.screen_name + ' "' + data.name + '")';
return '[@' + escapeMarkdownPart(data.screen_name) + '](https://twitter.com/' + data.screen_name + ' "' + data.name + '")';
}
function renderEntityMedia(data) {
return '[' + escapeMarkdown(data.display_url) + '](' + data.url + ')';
return '[' + escapeMarkdownPart(data.display_url) + '](' + data.url + ')';
}
function renderEntityHashtag(data) {
return '[#' + escapeMarkdown(data.text) + '](https://twitter.com/search?q=%23' + data.text + ')';
return '[#' + escapeMarkdownPart(data.text) + '](https://twitter.com/search?q=%23' + data.text + ')';
}
function renderEntityUrl(data) {
return '[' + escapeMarkdown(data.display_url) + '](' + data.url + ' "' + data.expanded_url + '")';
return '[' + escapeMarkdownPart(data.display_url) + '](' + data.url + ' "' + data.expanded_url + '")';
}

@@ -86,3 +92,3 @@

if (replacement[2] < lastPos) {
output.push(escapeMarkdown(text.substr(replacement[2], lastPos - replacement[2])));
output.push(escapeMarkdownPart(text.substr(replacement[2], lastPos - replacement[2])));
}

@@ -89,0 +95,0 @@

@@ -1,6 +0,6 @@

function escapeMarkdown(input) {
function escapeMarkdownPart(input) {
return [
// escaping symbols: # * ( ) [ ] _
[/([#\*\(\)\[\]\_\/`])/g, '\\$1'],
// escaping symbols: # * ( ) [ ] _ `
[/([\#\*\(\)\[\]\_\`\\])/g, '\\$1'],

@@ -14,16 +14,22 @@ // escaping less and more signs

function escapeMarkdown(input) {
return escapeMarkdownPart(input)
// escaping period after number at the string start
.replace(/^(\d+)\./, '$1\\.');
}
function renderEntityMention(data) {
return `[@${escapeMarkdown(data.screen_name)}](https://twitter.com/${data.screen_name} "${data.name}")`;
return `[@${escapeMarkdownPart(data.screen_name)}](https://twitter.com/${data.screen_name} "${data.name}")`;
}
function renderEntityMedia(data) {
return `[${escapeMarkdown(data.display_url)}](${data.url})`;
return `[${escapeMarkdownPart(data.display_url)}](${data.url})`;
}
function renderEntityHashtag(data) {
return `[#${escapeMarkdown(data.text)}](https://twitter.com/search?q=%23${data.text})`;
return `[#${escapeMarkdownPart(data.text)}](https://twitter.com/search?q=%23${data.text})`;
}
function renderEntityUrl(data) {
return `[${escapeMarkdown(data.display_url)}](${data.url} "${data.expanded_url}")`;
return `[${escapeMarkdownPart(data.display_url)}](${data.url} "${data.expanded_url}")`;
}

@@ -70,3 +76,3 @@

output.push(
escapeMarkdown(
escapeMarkdownPart(
text.substr(

@@ -73,0 +79,0 @@ replacement[2],

{
"name": "tweet.md",
"version": "1.0.2",
"version": "1.1.0",
"description": "Render tweet to markdown",

@@ -8,4 +8,6 @@ "main": "index.es5.js",

"transpile": "babel index.js --out-file index.es5.js",
"examples": "babel-node examples.js",
"test": "mocha -r babel/register",
"prepublish": "npm run test && npm run transpile"
"preversion": "npm run examples",
"prepublish": "npm run test && npm run transpile && npm run examples"
},

@@ -12,0 +14,0 @@ "keywords": [

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