Socket
Socket
Sign inDemoInstall

namp

Package Overview
Dependencies
1
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.3 to 0.1.4

19

doc/SYNTAX.md

@@ -152,3 +152,3 @@ Author: A noble spirit

## TABLES (todo)
## TABLES (PHP Extras)
-----------------

@@ -160,12 +160,20 @@

|a |b |c
|:--|:--:|:--
|1 |2 |3
|4 |5 | 6
or
a |b |c
x |y |z
--|--|--
1 |2 |3
8 |9 |10
{: .table .table-striped .table-bordered .table-condensed}
alignment
right|left | center
-----:|:-----|------
-----:|:-----|:------:
0001 | 2 | 003

@@ -195,2 +203,4 @@ 4 | 0005 | 6

because of the blank line preceding it.
{: #TestingIDHere}

@@ -203,2 +213,3 @@ ## ATTRIBUTES (Maruku) {: #myid .myclass}

attributes!
{: #bigBlock tutorial=yes}

@@ -205,0 +216,0 @@

@@ -1290,2 +1290,112 @@ // Released under MIT license

Markdown.dialects.NAMP.block.table1 = function table1_maker( block, next ) {
var tableRE = /^[ ]{0,3}[|](.+)\n[ ]{0,3}[|]([ ]*[-:]+[-| :]*)\n((?:[|].*\n)*)/; //(?=\\n|\n\n)
var table = [ "table" ];
var header = [ "thead" ];
if ( ( m = block.match( tableRE ) ) ) {
var lines = block.split("\n");
var tHeaders = lines[0];
var tableRERow = /^|.+/; // lazy.
if (tHeaders.length) {
var tr = [ "tr" ]
tHeaders = tHeaders.split("|");
for (var h = 1; h < tHeaders.length; h++) {
tr.push( ["th", tHeaders[h] ] );
}
header.push(tr);
table.push(header);
}
var separators = lines[1].split( /[ ]*[|][ ]*/ );
var alignAttr = [ ];
for( var i = 0, len = separators.length; i < len; i++ ) {
var separator = separators[i];
if ( separator.match( /^[ ]*-+:[ ]*$/ ) ) alignAttr.push("right");
else if ( separator.match( /^[ ]*:-+:[ ]*$/ ) ) alignAttr.push("center");
else if ( separator.match( /^[ ]*:-+[ ]*$/ ) ) alignAttr.push("left");
else alignAttr.push("");
}
for (var i = 2; i < lines.length; i++) {
var tr = [ "tr" ];
if ( (r = lines[i].match(tableRERow ) ) ) {
var rows = lines[i].split("|");
for (var j = 1; j < rows.length; j++) {
tr.push( ["td", {align: alignAttr[j]}].concat(rows[j]) );
}
}
table.push(tr);
}
}
else {
return undefined;
}
return [ table ];
}
Markdown.dialects.NAMP.block.table2 = function table1_maker( block, next ) {
var tableRE = /^[ ]{0,3}(\S.*[|].*)\n[ ]{0,3}([-:]+[ ]*[|][-| :]*)\n/;
var table = [ "table" ];
var header = [ "thead" ];
if ( ( m = block.match( tableRE ) ) ) {
var lines = block.split("\n");
var tHeaders = lines[0];
var tableRERow = /^[^{:]/; // lazy.
var metadataRE = /^{:/;
var metadata = "";
if (tHeaders.length) {
var tr = [ "tr" ]
tHeaders = tHeaders.split("|");
for (var h = 0; h < tHeaders.length; h++) {
tr.push( ["th", tHeaders[h] ] );
}
header.push(tr);
table.push(header);
}
var separators = lines[1].split( /[ ]*[|][ ]*/ );
var alignAttr = [ ];
for( var i = 0, len = separators.length; i < len; i++ ) {
var separator = separators[i];
if ( separator.match( /^[ ]*-+:[ ]*$/ ) ) alignAttr.push("right");
else if ( separator.match( /^[ ]*:-+:[ ]*$/ ) ) alignAttr.push("center");
else if ( separator.match( /^[ ]*:-+[ ]*$/ ) ) alignAttr.push("left");
else alignAttr.push("");
}
for (var i = 2; i < lines.length; i++) {
var tr = [ "tr" ];
if ( (r = lines[i].match(tableRERow ) ) ) {
var rows = lines[i].split("|");
for (var j = 0; j < rows.length; j++) {
tr.push( ["td", {align: alignAttr[j]}].concat(rows[j]) );
}
table.push(tr);
}
else if ( (r = lines[i].match(metadataRE ) ) ) {
metadata = lines[i];
}
}
}
else {
return undefined;
}
return [ table ];
}
Markdown.buildBlockOrder ( Markdown.dialects.NAMP.block );

@@ -1292,0 +1402,0 @@ Markdown.buildInlinePatterns( Markdown.dialects.NAMP.inline );

{
"name" : "namp",
"version" : "0.1.3",
"version" : "0.1.4",
"description" : "Markdown parser for Node, with Maruku, GFM, and PHP Extras support, plus more.",

@@ -5,0 +5,0 @@ "keywords" : [ "markdown", "maruku", "gfm", "text processing", "ast" ],

@@ -21,2 +21,3 @@ # Introduction

* Strikethroughs, using `~~`. For example, `This is a ~~strikethrough~~` turns into `This is a <del>strikethrough</del>`
* Tables, with support for `left`,`right`, and `center` alignment
* Conversion of `Note: `, `Tip: `, and `Warning: ` blocks into [Twitter Bootstrap alert blocks](http://twitter.github.com/bootstrap/components.html#alerts). Awesome!

@@ -23,0 +24,0 @@ * Build-time highlighting of `<pre>` code blocks. Enabled by default, see below for configuration instructions.

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc