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

msee

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

msee - npm Package Compare versions

Comparing version 0.1.2 to 0.2.0

Example.md

7

Help.md

@@ -22,4 +22,11 @@ msee

// ...with options
// @see https://github.com/firede/msee/blob/master/lib/msee.js#L9
msee.parse(str, {
collapseNewlines: false,
width: 120
});
// parse markdown file
msee.parseFile('~/doc/readme.md');
```

@@ -0,2 +1,7 @@

0.2.0 / 2015-11-03
==================
* Added table support #13
* Added *Example.md*
0.1.2 / 2015-10-14

@@ -3,0 +8,0 @@ ==================

1

lib/color.js

@@ -14,2 +14,3 @@ var chalk = require('chalk');

"del": chalk.strikethrough,
"ul": null,
"paragraph": null

@@ -16,0 +17,0 @@ }

@@ -7,2 +7,3 @@ var fs = require('fs');

var color = require('./color');
var table = require('text-table');

@@ -13,2 +14,3 @@ var defaultOptions = {

hrStart: '',
hrChar: '-',
hrEnd: '',

@@ -34,3 +36,7 @@ headingStart: '\n',

paragraphStart: '',
paragraphEnd: '\n'
paragraphEnd: '\n',
width: process.stdout.columns || 80,
tableStart: '\n',
tableSeparator: ' ',
tableEnd: '\n\n'
};

@@ -155,3 +161,3 @@

case 'hr': {
var hrStr = new Array(80).join('-') + '\n';
var hrStr = new Array(options.width).join(options.hrChar) + '\n';
return options.hrStart + color(hrStr, type) + options.hrEnd;

@@ -178,3 +184,3 @@ }

}
content = blockFormat(content, {

@@ -187,3 +193,4 @@ pad_str: options.codePad

case 'table': {
// TODO
content = tableFormat(token, options);
return options.tableStart + content + options.tableEnd;
}

@@ -225,7 +232,10 @@ case 'blockquote_start': {

}
content = blockFormat(content, {
block_color: options.listItemColor,
pad_str: options.listItemPad,
pad_color: options.listItemPadColor
});
content = blockFormat(
processInline(content),
{
block_color: options.listItemColor,
pad_str: options.listItemPad,
pad_color: options.listItemPadColor
}
);
return options.listItemStart + content + options.listItemEnd;

@@ -274,2 +284,98 @@ }

function tableFormat (token, options) {
var aligns = token.align.map(function (a) {
return (a===null) ? 'l' : a[0];
});
var rows = token.cells.map(function (row) {
return row.map(processInline);
});
rows.unshift(
token.header.map(function () {
return '--';
})
);
rows.unshift(
token.header.map(function (s) {
return processInline('**'+s+'**');
})
);
return table(rows, {
align: aligns,
stringLength: getStringWidth,
hsep: options.tableSeparator
});
}
/**
* Returns the number of columns required to display the given string.
* @see https://github.com/nodejs/node/blob/cff7300a578be1b10001f2d967aaedc88aee6402/lib/readline.js#L1345
*/
function getStringWidth(str) {
// Trim formatting from string
var rAnsi = require('ansi-regex')();
str = str.replace(rAnsi, '');
var width = 0;
for (var i = 0, len = str.length; i < len; i++) {
var code = str.codePointAt(i);
if (code >= 0x10000) { // surrogates
i++;
}
if (isFullWidthCodePoint(code)) {
width += 2;
}
else {
width++;
}
}
return width;
}
function isFullWidthCodePoint(code) {
if (isNaN(code)) {
return false;
}
// Code points are derived from:
// http://www.unicode.org/Public/UNIDATA/EastAsianWidth.txt
if (code >= 0x1100
&& (
// Hangul Jamo
code <= 0x115f
// LEFT-POINTING ANGLE BRACKET
|| 0x2329 === code
// RIGHT-POINTING ANGLE BRACKET
|| 0x232a === code
// CJK Radicals Supplement .. Enclosed CJK Letters and Months
|| (0x2e80 <= code && code <= 0x3247 && code !== 0x303f)
// Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A
|| 0x3250 <= code && code <= 0x4dbf
// CJK Unified Ideographs .. Yi Radicals
|| 0x4e00 <= code && code <= 0xa4c6
// Hangul Jamo Extended-A
|| 0xa960 <= code && code <= 0xa97c
// Hangul Syllables
|| 0xac00 <= code && code <= 0xd7a3
// CJK Compatibility Ideographs
|| 0xf900 <= code && code <= 0xfaff
// Vertical Forms
|| 0xfe10 <= code && code <= 0xfe19
// CJK Compatibility Forms .. Small Form Variants
|| 0xfe30 <= code && code <= 0xfe6b
// Halfwidth and Fullwidth Forms
|| 0xff01 <= code && code <= 0xff60
|| 0xffe0 <= code && code <= 0xffe6
// Kana Supplement
|| 0x1b000 <= code && code <= 0x1b001
// Enclosed Ideographic Supplement
|| 0x1f200 <= code && code <= 0x1f251
// CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane
|| 0x20000 <= code && code <= 0x3fffd
)
) {
return true;
}
return false;
}
exports.parse = function(text, options) {

@@ -300,3 +406,3 @@ tokens = marked.lexer(text);

var ret = '';
try {

@@ -303,0 +409,0 @@ var text = fs.readFileSync(filePath).toString();

12

package.json
{
"name": "msee",
"version": "0.1.2",
"version": "0.2.0",
"description": "Msee is a command-line tool to read Markdown file in your terminal, and it's a library help your command-line software to output readable markdown content.",

@@ -12,7 +12,9 @@ "main": "./lib/msee.js",

"dependencies": {
"ansi-regex": "^2.0.0",
"cardinal": "^0.5.0",
"chalk": "~0.4.0",
"marked": "~0.3.0",
"nopt": "~2.1.1",
"xtend": "~2.1.1"
"chalk": "^1.1.1",
"marked": "^0.3.5",
"nopt": "^3.0.4",
"text-table": "^0.2.0",
"xtend": "^4.0.0"
},

@@ -19,0 +21,0 @@ "keywords": [

msee
===
[![Dependencies Status](https://david-dm.org/firede/msee.png)](https://david-dm.org/firede/msee)
[![NPM version](https://img.shields.io/npm/v/msee.svg?style=flat-square)](https://npmjs.org/package/msee)
[![Dependencies Status](https://img.shields.io/david/firede/msee.svg?style=flat-square)](https://david-dm.org/firede/msee)
[![download per month](https://img.shields.io/npm/dm/msee.svg?style=flat-square)](https://npmjs.org/package/msee)
[![License](https://img.shields.io/npm/l/msee.svg?style=flat-square)](https://npmjs.org/package/msee)

@@ -12,3 +15,3 @@ *msee* is a command-line tool to read markdown file.

![msee](https://f.cloud.github.com/assets/157338/1808778/175a83aa-6d77-11e3-8cf7-7c756bab34f8.png)
<img width="752" alt="msee" src="https://cloud.githubusercontent.com/assets/157338/10902801/531ba216-823d-11e5-87ac-986b8d5ea4cc.png">

@@ -45,4 +48,4 @@ ## Installation

===
---
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/firede/msee/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
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