可以通过头部匹配
<!doctype html>
<html>
<head>
<meta charset="utf-8"/>
<title>Marked in the browser</title>
</head>
<body>
<div id="content"></div>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/marked.umd.min.js"></script>
<script>
// 创建自定义渲染器
const renderer = new marked.Renderer();
// 重写 paragraph 方法来处理自定义段落
renderer.paragraph = function(text) {
if (text.startsWith(':customparagraph:')) {
return `<p class="custom-paragraph">${text.replace(':customparagraph:', '')}</p>\n`;
}
return `<p>${text}</p>\n`;
};
// 使用自定义渲染器
marked.setOptions({
renderer: renderer
});
const markdown = `
:customparagraph: This is a custom paragraph content.
:aet: This is a custom paragraph content.
`;
document.getElementById('content').innerHTML =
marked.parse(markdown);
</script>
</body>
</html> 网友回复
有没有兼容Puppeteer和 Playwright使用的docker独立chrome浏览器?
geo与seo区别?
chrome插件能否实现网页远程控制鼠标选择网页文字滚动网页?
nativescript开发的安卓与ios app应用是原生的吗?
go如何写一个类似redis的nosql数据库让python客户端调用?
php7中为啥无法使用$_SERVER['HTTP_RAW_POST_DATA'] ?
chrome插件能否实现2台电脑的远程协助桌面控制?
python如何通过webrtc网页远程协助控制python运行的电脑?
systemd-nspawn与unshare区别?
Firejail、Bubblewrap沙箱与docker、podman容器区别?


