@tkzwhr/rehype-mahjong-tiles
v1.0.0
Published
rehype-mahjong-tiles ==
Readme
rehype-mahjong-tiles
This is a rehype plugin for representing mahjong tiles.
Installation
npm install @tkzwhr/rehype-mahjong-tilesUsage
Say we have the following file example.html:
<mahjong-tiles src="123s" />…and our module example.js looks as follows:
import {read} from 'to-vfile'
import {rehype} from 'rehype'
import rehypeMahjongTiles from '@tkzwhr/rehype-mahjong-tiles'
const file = await rehype()
.data('settings', {fragment: true})
.use(rehypeMahjongTiles)
.process(await read('example.html'))
console.log(String(file))…then running node example.js yields:
<div>
<div class="mahjong-tiles-wrapper">
<svg><!-- the content of '1s' --></svg>
<svg><!-- the content of '2s' --></svg>
<svg><!-- the content of '3s' --></svg>
</div>
</div>