mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-23 18:00:27 +08:00
14 lines
327 B
JavaScript
14 lines
327 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('');
|
|
};
|