当前位置:网站首页>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
边栏推荐
- R language ggplot2 visualization: ggplot2 visualizes the scatter diagram and uses geom_ mark_ The ellipse function adds ellipses around data points of data clusters or data groups for annotation
- CVPR 2022 | QueryDet:使用级联稀疏query加速高分辨率下的小目标检测
- Devops integration - environment variables and building tools of Jenkins service
- DTMF dual tone multi frequency signal simulation demonstration system
- Don't bother tensorflow learning notes (10-12) -- Constructing a simple neural network and its visualization
- 论文写作 19: 会议论文与期刊论文的区别
- Video understanding
- NC basic usage 2
- 山东大学软件学院项目实训-创新实训-网络安全靶场实验平台(七)
- Mysql database - single table query (II)
猜你喜欢
Handwritten Google's first generation distributed computing framework MapReduce
基于pytorch搭建GoogleNet神经网络用于花类识别
JDBC tool class jdbcfiledateutil uploads files and date format conversion, including the latest, simplest and easiest way to upload single files and multiple files
DNS cloud school | quickly locate DNS resolution exceptions and keep these four DNS status codes in mind
Grafana shares links with variable parameters
SIGIR'22「微软」CTR估计:利用上下文信息促进特征表征学习
Kubernetes introduction to mastery - ktconnect (full name: kubernetes toolkit connect) is a small tool based on kubernetes environment to improve the efficiency of local test joint debugging.
AQS learning
Sqoop imports tinyint type fields to boolean type
antd dropdown + modal + textarea导致的textarea光标不可被键盘控制问题
随机推荐
SIGIR'22 "Microsoft" CTR estimation: using context information to promote feature representation learning
nc基础用法2
Mysql database - connection query
Rédaction de thèses 19: différences entre les thèses de conférence et les thèses périodiques
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
CVPR 2022 | QueryDet:使用级联稀疏query加速高分辨率下的小目标检测
JDBC tool class jdbcconutil gets the connection to the database
Grafana shares links with variable parameters
Electron入门教程4 —— 切换应用的主题
nc基础用法
Five minutes to show you what JWT is
How to do product innovation—— Exploration of product innovation methodology I
PCL点云处理之直线与平面的交点计算(五十三)
Sqoop imports data from Mysql to HDFS using lzop compression format and reports NullPointerException
还在用 ListView?使用 AnimatedList 让列表元素动起来
Unity general steps for creating a hyper realistic 3D scene
Lpc1768 optimization comparison of delay time and different levels
JDBC database addition, deletion, query and modification tool class
Fundamentals of programming language (2)
Leetcode dynamic planning training camp (1-5 days)