3.0.2 • Published 1 year ago

marked-images v3.0.2

Weekly downloads
161
License
MIT
Repository
github
Last release
1 year ago

marked-images

CI

Simple marked renderer to include image attributes in markdown. Also generates vimeo links.

installation

npm install marked-images

usage

NOTE: breaking changes:

  • As of v2.0.0, this library uses the marked.use() plugin api.
  • As of v3.0.0, since marked v4.x the marked() function is no longer the default export. CommonJS code which does marked = require(marked) should be changed to call marked.marked(<markdown-string>) instead of marked().
var marked = require('marked');

var markedImages = require('marked-images');

// opts are optional
var opts = {
  xhtml: false,
  fqImages: { route: '/images/', url:'https://images.example.com' }, // use custom image endpoint url when link starts with route
  fqLinks: 'https://www.example.com',                                // generate fully qualified links if fqImages is not set
  relPath: false
}

marked.use(markedImages(opts));

var html = marked.marked(markdown);

simple width and height

{number}x{number} in the title text part of the link in quotes after the url e.g.

![](src "1x2 title text")
or
![](src "title text 1x2")

generates:

<img src="src" alt="" width="1" height="2" title="title text">

explicit attributes

any attribute name=value, no quotes around the value e.g.

![](src "width=1 height=2 align=right title text")

generates:

<img src="src" alt="" width="1" height="2" align="right" title="title text">

CSS classnames

.{classname}

![Alt-text](src ".class1 .class-2 .class_3 10x10"

generates:

<img src="src" alt="Alt-text" width="10" height="10" class="class1 class-2 class_3">

vimeo link

start src with 'vimeo/' e.g.

![](vimeo/00000000 "500x281")

generates:

<iframe src="//player.vimeo.com/video/00000000" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen width="500" height="281"></iframe>
3.0.2

1 year ago

3.0.1

2 years ago

3.0.0

2 years ago

2.4.0

3 years ago

2.3.0

3 years ago

2.2.1

3 years ago

2.2.0

3 years ago

2.1.1

3 years ago

2.1.0

3 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.4.0

4 years ago

1.3.1

4 years ago

1.3.0

5 years ago

1.2.5

5 years ago

1.2.4

5 years ago

1.2.3

5 years ago

1.2.2

5 years ago

1.2.1

9 years ago

1.2.0

9 years ago

1.1.1

9 years ago

1.1.0

9 years ago

1.0.0

9 years ago

0.5.0

9 years ago