From 74db2d4740b09f5e08e87d7e6fd4dfad42fd4f48 Mon Sep 17 00:00:00 2001 From: Tatsuya Yatagawa <tatsy.mail@gmail.com> Date: Thu, 19 Feb 2015 18:05:02 +0900 Subject: [PATCH] Update README.md --- README.md | 44 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b096bb8..852309e 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 + +``` + +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(""); + console.log(rendered); + document.getElementById('image-box').innerHTML = rendered; +}); +``` -- GitLab