markdown-it-imsize

WebJar for markdown-it-imsize

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

markdown-it-imsize
Last Version

Last Version

2.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

markdown-it-imsize
WebJar for markdown-it-imsize
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/tatsy/markdown-it-imsize

Download markdown-it-imsize

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/markdown-it-imsize/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>markdown-it-imsize</artifactId>
    <version>2.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/markdown-it-imsize/
implementation 'org.webjars.npm:markdown-it-imsize:2.0.1'
// https://jarcasting.com/artifacts/org.webjars.npm/markdown-it-imsize/
implementation ("org.webjars.npm:markdown-it-imsize:2.0.1")
'org.webjars.npm:markdown-it-imsize:jar:2.0.1'
<dependency org="org.webjars.npm" name="markdown-it-imsize" rev="2.0.1">
  <artifact name="markdown-it-imsize" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='markdown-it-imsize', version='2.0.1')
)
libraryDependencies += "org.webjars.npm" % "markdown-it-imsize" % "2.0.1"
[org.webjars.npm/markdown-it-imsize "2.0.1"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

markdown-it-imsize

Build Status NPM version Coverage Status Dependency Status devDependency Status

A markdown-it plugin for size-specified image markups. This plugin overloads original image renderer of markdown-it.

Usage

Enable plugin

var md = require('markdown-it')({
  html: true,
  linkify: true,
  typography: true
}).use(require('markdown-it-imsize')); // <-- this use(package_name) is required

Example

![test](image.png =100x200)

is interpreted as

<p><img src="image.png" alt="test" width="100" height="200"></p>

Options

Auto fill

var md = require('markdown-it')({
  html: true,
  linkify: true,
  typography: true
}).use(require('markdown-it-imsize'), { autofill: true });

will fill the width and height fields automatically if the specified image path is valid.

Therefore,

![test](image.png)

is interpreted as

<p><img src="image.png" alt="test" width="200" height="200"></p>

where image.png is a valid path and its size is 200 x 200.

Use with RequireJS

markdown-it-imsize is available with bower and RequireJS. First, you can install the package with,

bower install markdown-it-imsize

Script for using markdown-it-imsize with RequireJS is like,

require(['require', 'MarkdownIt', 'MarkdownItImsize'], function(require) {
  var md = require('MarkdownIt')({
    html: true,
    linkify: true,
    typography: true
  }).use(require('MarkdownItImsize'));

  var rendered = md.render("![test](test.jpg =100x)");
  document.getElementById('image-box').innerHTML = rendered;
});

Versions

Version
2.0.1