Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add x, y to images

  • Loading branch information...
commit 1a967dfa8906ba45a750e130041184c744245560 1 parent 27053a7
@gjtorikian authored
Showing with 14 additions and 4 deletions.
  1. +2 −0  doc/SYNTAX.md
  2. +11 −3 lib/namp.js
  3. +1 −1  package.json
View
2  doc/SYNTAX.md
@@ -34,6 +34,8 @@ Reference-style:
[id2]: http://upload.wikimedia.org/wikipedia/en/math/b/8/b/b8b4326ebb88870f8cc97ab3f59a0867.png "Still, a random image"
+Add `<x, y>` at the end to provide width and height attributes!
+
## HEADERS
---------------
View
14 lib/namp.js
@@ -390,7 +390,7 @@ var inline = {
autolink: /^<([^ >]+(@|:\/)[^ >]+)>/,
url: noop,
tag: /^<!--[^\0]*?-->|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,
- link: /^!?\[(inside)\]\(href\)/,
+ link: /^!?\[(inside)\]\(href\)(<\d+,\s*\d+>)?/,
reflink: /^!?\[(inside)\]\s*\[([^\]]*)\]/,
nolink: /^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,
strong: /^__([^\0]+?)__(?!_)|^\*\*([^\0]+?)\*\*(?!\*)/,
@@ -685,6 +685,12 @@ function outputLink(cap, link) {
+ inline.lexer(cap[1])
+ '</a>';
} else {
+ if (cap[4] !== undefined) {
+ var dim = cap[4].split(",");
+ var width = dim[0].slice(1);
+ var height = dim[1].slice(0, dim[1].length - 1);
+ }
+
return '<img src="'
+ escape(link.href)
+ '" alt="'
@@ -695,7 +701,9 @@ function outputLink(cap, link) {
+ escape(link.title)
+ '"'
: '')
- + '>';
+ + ' width="' + (width || '')
+ + '" height="' + (height || '')
+ + '">';
}
}
@@ -746,7 +754,7 @@ function tok(metadata) {
// intentionally skip 'no-highlight'
if (token.demo !== undefined)
- return '<textarea class="demo language-' + token.lang + '">' + token.text + '</textarea>';
+ return '<div class="demo language-' + token.lang + '">' + token.text + '</div>';
var pretag = '<pre>';
View
2  package.json
@@ -1,6 +1,6 @@
{
"name" : "namp",
- "version" : "0.2.24",
+ "version" : "0.2.25",
"description" : "Markdown parser for Node, with Maruku, GFM, and PHP Extras support, plus more. Based on marked.",
"keywords" : [ "markdown", "maruku", "gfm", "text processing", "ast" ],
"maintainers" : [
Please sign in to comment.
Something went wrong with that request. Please try again.