Skip to content

Latest commit

 

History

History
50 lines (27 loc) · 2.5 KB

File metadata and controls

50 lines (27 loc) · 2.5 KB

markdown-it-incremental-dom

A markdown-it renderer plugin by using Incremental DOM. Say goodbye innerHTML!

Features

How to use

Refer below for the examples and usages.

Why Incremental DOM?

Repainting on innerHTML

Element.innerHTML is the simplest way to update HTML. But it triggers repainting the whole passed HTML.

Screen cast of repainting in innerHTML

This is the visualization of repainting in innerHTML, and repainted area will be colorful. As you see, The whole markdown is always repainted.

It means the rendering performance would slow in large markdown if innerHTML would be called many times in a short time. (e.g. live rendering feature)

Incremental DOM

Google's Incremental DOM can update DOMs by in-place. In other words, elements that have not changed contents or arguments are not changed on rendered DOM too.

Screen cast of repainting in innerHTML

As you see above, repainting is triggered to the differences only. So it would expect to reduce the impact of repainting to the minimum by using Incremental DOM.

Let's try!

In this page, you can switch rendering method of markdown: innerHTML and Incremental DOM.

If you wanna confirm the behavior of repainting, turn on paint flashing in developer tools of your browser.

Helps are here: Chrome and Firefox

Author

Yuki Hattori (@yhatt)

markdown-it-incremental-dom is the sub-project of Marp.