当前位置:网站首页>Markdown < a > tag new page open link
Markdown < a > tag new page open link
2022-04-23 20:16:00 【_ Carpediem】
markdown-it The version is 11.0.0 No, ’target,_blank’ attribute , The default a The link of the tag is this page , The previous page data will be lost , You need to create a new page in the browser to open , Add the following code to solve .
// Remember old renderer, if overridden, or proxy to default renderer
var md=require('markdown-it')
var defaultRender = md.renderer.rules.link_open || function(tokens, idx, options, env, self) {
return self.renderToken(tokens, idx, options);
};
md.renderer.rules.link_open = function (tokens, idx, options, env, self) {
// If you are sure other plugins can't add `target` - drop check below
var aIndex = tokens[idx].attrIndex('target');
if (aIndex < 0) {
tokens[idx].attrPush(['target', '_blank']); // add new attribute
} else {
tokens[idx].attrs[aIndex][1] = '_blank'; // replace value of existing attr
}
// pass token to default renderer.
return defaultRender(tokens, idx, options, env, self);
};
版权声明
本文为[_ Carpediem]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204210553547118.html
边栏推荐
- Change the material of unity model as a whole
- 网络通信基础(局域网、广域网、IP地址、端口号、协议、封装、分用)
- aqs的学习
- R语言使用timeROC包计算无竞争风险情况下的生存资料多时间AUC值、使用confint函数计算无竞争风险情况下的生存资料多时间AUC指标的置信区间值
- Leetcode dynamic planning training camp (1-5 days)
- The flinkcdc reports an error: but this is no longer available on the server
- Mysql database - single table query (I)
- How about Bohai futures. Is it safe to open futures accounts?
- 还在用 ListView?使用 AnimatedList 让列表元素动起来
- R语言使用caret包的preProcess函数进行数据预处理:对所有的数据列进行BoxCox变换处理(将非正态分布数据列转换为正态分布数据、不可以处理负数)、设置method参数为BoxCox
猜你喜欢
selenium.common.exceptions.WebDriverException: Message: ‘chromedriver‘ executable needs to be in PAT
[numerical prediction case] (3) LSTM time series electricity quantity prediction, with tensorflow complete code attached
Shanda Wangan shooting range experimental platform project - personal record (V)
Understanding various team patterns in scrum patterns
Grafana shares links with variable parameters
MySQL 进阶 锁 -- MySQL锁概述、MySQL锁的分类:全局锁(数据备份)、表级锁(表共享读锁、表独占写锁、元数据锁、意向锁)、行级锁(行锁、间隙锁、临键锁)
Software College of Shandong University Project Training - Innovation Training - network security shooting range experimental platform (8)
Project training of Software College of Shandong University - Innovation Training - network security shooting range experimental platform (V)
JDBC tool class jdbcfiledateutil uploads files and date format conversion, including the latest, simplest and easiest way to upload single files and multiple files
Kubernetes entry to mastery - bare metal loadbalance 80 443 port exposure precautions
随机推荐
DNS cloud school | quickly locate DNS resolution exceptions and keep these four DNS status codes in mind
微信中金财富高端专区安全吗,证券如何开户呢
antd dropdown + modal + textarea导致的textarea光标不可被键盘控制问题
nc基础用法3
山东大学软件学院项目实训-创新实训-网络安全靶场实验平台(七)
使用 WPAD/PAC 和 JScript在win11中进行远程代码执行1
MySQL advanced lock - overview of MySQL locks and classification of MySQL locks: global lock (data backup), table level lock (table shared read lock, table exclusive write lock, metadata lock and inte
Shanda Wangan shooting range experimental platform project - personal record (IV)
使用 WPAD/PAC 和 JScript在win11中进行远程代码执行3
Project training of Software College of Shandong University - Innovation Training - network security shooting range experimental platform (VII)
Project training of Software College of Shandong University - Innovation Training - network security shooting range experimental platform (V)
Remote code execution in Win 11 using wpad / PAC and JScript
使用 WPAD/PAC 和 JScript在win11中进行远程代码执行
Understanding various team patterns in scrum patterns
uIP1. 0 actively sent problem understanding
NC basic usage 3
如何做产品创新?——产品创新方法论探索一
CVPR 2022 | querydet: use cascaded sparse query to accelerate small target detection under high resolution
【问题解决】‘ascii‘ codec can‘t encode characters in position xx-xx: ordinal not in range(128)
程序设计语言基础(2)