vfm
vfm copied to clipboard
remark-shortcodes, being used for undocumented features, is preventing remark upgrade
10月の開発者会議で話題にした機能の棚卸しに関連するIssueです。
現在のVFMには、[[ ]]で囲んだ文字列を削除し、[[toc 〜]]という文字列をほぼ決め打ちで空のdiv要素に変換する機能があります。この機能には特にテストやドキュメントがなく、もとはどのような使い方を想定されていたのかよくわからなくなっています。
$ echo -e '[[foobar]]' | npx --yes @vivliostyle/vfm
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body></body>
</html>
$ echo -e '[[toc id="toc"]]\n目次?' | npx --yes @vivliostyle/vfm
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<div></div>
<p>目次?</p>
</body>
</html>
この機能はsrc/plugins/toc.tsで実装されています。この機能のためにVFMはremark-shortcodesに依存していますが、remark-shortcodesはremark v13への対応が行われず、移行のボトルネックのひとつになっています。