chenjiahan 6a054ca0e3 Revert "chore: remove @vant/markdown-loader package"
This reverts commit 6eec7f3c2f9207227c178baedf767f3031e040f8.
2021-09-30 10:32:29 +08:00

17 lines
342 B
JavaScript

module.exports = function cardWrapper(html) {
const group = html
.replace(/<h3/g, ':::<h3')
.replace(/<h2/g, ':::<h2')
.split(':::');
return group
.map(fragment => {
if (fragment.indexOf('<h3') !== -1) {
return `<div class="card">${fragment}</div>`;
}
return fragment;
})
.join('');
};