Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
tatsy committed Feb 19, 2015
1 parent d3ddaa5 commit 74db2d4
Showing 1 changed file with 41 additions and 3 deletions.
44 changes: 41 additions & 3 deletions README.md
Expand Up @@ -27,10 +27,10 @@ var md = require('markdown-it')({
is interpreted as

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

### Options
## Options

#### Auto fill

Expand All @@ -42,4 +42,42 @@ var md = require('markdown-it')({
}).use(require('markdown-it-imsize'), { autofill: true });
```

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

Therefore,

```js
![test](image.png)
```

is interpreted as

```html
<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,

```shell
bower install markdown-it-imsize
```

Script for using ```markdown-it-imsize``` with RequireJS is as follows.

```js
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)");
console.log(rendered);
document.getElementById('image-box').innerHTML = rendered;
});
```

0 comments on commit 74db2d4

Please sign in to comment.