1.修改帮助显示,变更帮助页面实现,采用markdown格式文件
2.添加markdown工具栏国际化
This commit is contained in:
@@ -113,9 +113,8 @@ public class SystemController extends BaseController{
|
||||
public boolean saveHelp(HttpServletRequest request, HttpServletResponse response,ModelMap model,@RequestParam(required=true,value="editedHelpInfo")String editedHelpInfo,@RequestParam(required=true,value="helpHrefVal")String helpHrefVal){
|
||||
|
||||
try {
|
||||
StringBuffer helpInfo=new StringBuffer("<!DOCTYPE html>");
|
||||
StringBuffer helpInfo=new StringBuffer();
|
||||
helpInfo.append(URLDecoder.decode(editedHelpInfo,"utf-8"));
|
||||
helpInfo.append("</html>");
|
||||
String htmlName=URLDecoder.decode(helpHrefVal,"utf-8");
|
||||
String htmlPath=request.getServletContext().getRealPath("/")+htmlName;
|
||||
|
||||
|
||||
@@ -1,120 +1,120 @@
|
||||
#jdbc for oracle
|
||||
#jdbc.driver=oracle.jdbc.driver.OracleDriver
|
||||
jdbc.devlop.driver=com.mysql.jdbc.Driver
|
||||
jdbc.devlop.url=jdbc:mysql://10.0.4.221:3306/ntc_test?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&rewriteBatchedStatements=true
|
||||
jdbc.devlop.username=root
|
||||
jdbc.devlop.key=pR3JFt5dsGCW0nZO3TLF7Q==
|
||||
jdbc.devlop.password=JgW5tsiGBNAtcqCgSQIP0g==
|
||||
|
||||
jdbc.product.driver=com.mysql.jdbc.Driver
|
||||
jdbc.product.url=jdbc:mysql://10.0.4.221:3306/ntc_test?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&rewriteBatchedStatements=true
|
||||
jdbc.product.username=root
|
||||
jdbc.product.key=pR3JFt5dsGCW0nZO3TLF7Q==
|
||||
jdbc.product.password=JgW5tsiGBNAtcqCgSQIP0g==
|
||||
|
||||
#jdbc.log.driver=oracle.jdbc.driver.OracleDriver
|
||||
#jdbc.log.url=jdbc:oracle:thin:@10.0.6.212:1523:app
|
||||
##jdbc.log.url=jdbc:oracle:thin:@10.174.196.22:1521:orcl
|
||||
#jdbc.log.username=gk_log
|
||||
##jdbc.log.username=z2_5x9logb
|
||||
#jdbc.log.key=pHl+0udycGQWNZcN68Sv9A==
|
||||
#jdbc.log.password=Z/pVMDXcWNxzVGAX0yRp3Q==
|
||||
#
|
||||
#jdbc.logA.driver=oracle.jdbc.driver.OracleDriver
|
||||
##jdbc.logA.url=jdbc:oracle:thin:@10.0.6.212:1523:app
|
||||
#jdbc.logA.url=jdbc:oracle:thin:@10.174.196.21:1521:orcl
|
||||
##jdbc.logA.username=gk_log_a
|
||||
#jdbc.logA.username=z2_5x9loga
|
||||
#jdbc.logA.key=SXHfLUwzPw0cQEc1wzwM4w==
|
||||
#jdbc.logA.password=auvtDoVZpGP6P4OqfBrWAg==
|
||||
#
|
||||
#jdbc.logC.driver=oracle.jdbc.driver.OracleDriver
|
||||
#jdbc.logC.url=jdbc:oracle:thin:@10.0.6.212:1523:app
|
||||
#jdbc.logC.username=gk_log_c
|
||||
#jdbc.logC.key=MvwfUIYP0nLyiQeprHB/5A==
|
||||
#jdbc.logC.password=3HXvsqpbOoNBIkHDS5c9Aw==
|
||||
#
|
||||
#jdbc.jk.driver=oracle.jdbc.driver.OracleDriver
|
||||
#jdbc.jk.url=jdbc:oracle:thin:@10.0.6.212:1523:app
|
||||
##jdbc.jk.url=jdbc:oracle:thin:@10.174.196.20:1521:orcl
|
||||
#jdbc.jk.username=gk_jk
|
||||
##jdbc.jk.username=z2_5x9jk
|
||||
#jdbc.jk.key=+FaavsHgQ0qBSebsAoochw==
|
||||
#jdbc.jk.password=wBrNar7gX/iQR7IyCSHuSg==
|
||||
|
||||
|
||||
|
||||
bonecp.idleMaxAgeInMinutes=60
|
||||
bonecp.idleConnectionTestPeriodInMinutes=240
|
||||
bonecp.maxConnectionsPerPartition=50
|
||||
bonecp.minConnectionsPerPartition=10
|
||||
bonecp.partitionCount=3
|
||||
bonecp.acquireIncrement=5
|
||||
bonecp.statementsCacheSize=100
|
||||
|
||||
############################################################################################################################################
|
||||
#数据中心神通数据库接口配置
|
||||
############################################################################################################################################
|
||||
#bonecp.cluster.idleMaxAgeInMinutes=60
|
||||
#bonecp.cluster.idleConnectionTestPeriodInMinutes=240
|
||||
#bonecp.cluster.maxConnectionsPerPartition=10
|
||||
#bonecp.cluster.minConnectionsPerPartition=5
|
||||
#bonecp.cluster.partitionCount=3
|
||||
#bonecp.cluster.acquireIncrement=5
|
||||
#bonecp.cluster.statementsCacheSize=100
|
||||
#
|
||||
#jdbc.log.cluster.driver=com.oscar.cluster.BulkDriver
|
||||
#jdbc.log.cluster.url=jdbc:oscarclusterbulk://10.3.129.125:2010/logdb
|
||||
#jdbc.log.cluster.username=xa_z2_iie
|
||||
#jdbc.log.cluster.key=2fa3hQn28+4AOdJXL4Ud2w==
|
||||
#jdbc.log.cluster.password=uut+weC9of5ocPheagBJ4A==
|
||||
############################################################################################################################################
|
||||
#数据中心hive接口配置
|
||||
############################################################################################################################################
|
||||
|
||||
#A版日志库
|
||||
#jdbc.hiveA.driver=org.apache.hive.jdbc.HiveDriver
|
||||
#jdbc.hiveA.url=jdbc:hive2://10.3.130.24:10000/default
|
||||
#jdbc.hiveA.username=xa_z2_mesa
|
||||
#jdbc.hiveA.key=aC/8fTC9vfPVhCk+CDzbAQ==
|
||||
##加密后密码
|
||||
##jdbc.hiveA.password=V3GyFlG8Mg01bTt8ykFVaA==
|
||||
##实际密码
|
||||
#jdbc.hiveA.password=123!@#qwe
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
##B版日志库
|
||||
#jdbc.hiveB.driver=org.apache.hive.jdbc.HiveDriver
|
||||
#jdbc.hiveB.url=jdbc:hive2://10.3.130.25:10000/default
|
||||
#jdbc.hiveB.username=xa_z2_mesa
|
||||
#jdbc.hiveB.key=aC/8fTC9vfPVhCk+CDzbAQ==
|
||||
##加密后密码
|
||||
##jdbc.hiveB.password=V3GyFlG8Mg01bTt8ykFVaA==
|
||||
##实际密码
|
||||
#jdbc.hiveB.password=123!@#qwe
|
||||
#
|
||||
#
|
||||
#bonecp.hive.idleMaxAgeInMinutes=60
|
||||
#bonecp.hive.idleConnectionTestPeriodInMinutes=240
|
||||
#bonecp.hive.maxConnectionsPerPartition=20
|
||||
#bonecp.hive.minConnectionsPerPartition=10
|
||||
#bonecp.hive.partitionCount=3
|
||||
#bonecp.hive.acquireIncrement=5
|
||||
#bonecp.hive.statementsCacheSize=100
|
||||
#
|
||||
#
|
||||
#
|
||||
#############################################################################################################################################
|
||||
##下面的库为测试库,测试完成后会删除
|
||||
#############################################################################################################################################
|
||||
#
|
||||
#jdbc.test.driver=oracle.jdbc.driver.OracleDriver
|
||||
#jdbc.test.url=jdbc:oracle:thin:@10.0.6.212:1523:app
|
||||
#jdbc.test.username=gk_pztest
|
||||
#jdbc.test.key=cV9126WUYdojQjvuKNjidw==
|
||||
#jdbc.test.password=OrTu/cLwlduYPW/tmxqNgQ==
|
||||
|
||||
|
||||
#jdbc for oracle
|
||||
#jdbc.driver=oracle.jdbc.driver.OracleDriver
|
||||
jdbc.devlop.driver=com.mysql.jdbc.Driver
|
||||
jdbc.devlop.url=jdbc:mysql://192.168.10.204:3306/gwall_dev?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&rewriteBatchedStatements=true
|
||||
jdbc.devlop.username=root
|
||||
jdbc.devlop.key=pR3JFt5dsGCW0nZO3TLF7Q==
|
||||
jdbc.devlop.password=JgW5tsiGBNAtcqCgSQIP0g==
|
||||
|
||||
jdbc.product.driver=com.mysql.jdbc.Driver
|
||||
jdbc.product.url=jdbc:mysql://192.168.10.204:3306/gwall_dev?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&rewriteBatchedStatements=true
|
||||
jdbc.product.username=root
|
||||
jdbc.product.key=pR3JFt5dsGCW0nZO3TLF7Q==
|
||||
jdbc.product.password=JgW5tsiGBNAtcqCgSQIP0g==
|
||||
|
||||
#jdbc.log.driver=oracle.jdbc.driver.OracleDriver
|
||||
#jdbc.log.url=jdbc:oracle:thin:@10.0.6.212:1523:app
|
||||
##jdbc.log.url=jdbc:oracle:thin:@10.174.196.22:1521:orcl
|
||||
#jdbc.log.username=gk_log
|
||||
##jdbc.log.username=z2_5x9logb
|
||||
#jdbc.log.key=pHl+0udycGQWNZcN68Sv9A==
|
||||
#jdbc.log.password=Z/pVMDXcWNxzVGAX0yRp3Q==
|
||||
#
|
||||
#jdbc.logA.driver=oracle.jdbc.driver.OracleDriver
|
||||
##jdbc.logA.url=jdbc:oracle:thin:@10.0.6.212:1523:app
|
||||
#jdbc.logA.url=jdbc:oracle:thin:@10.174.196.21:1521:orcl
|
||||
##jdbc.logA.username=gk_log_a
|
||||
#jdbc.logA.username=z2_5x9loga
|
||||
#jdbc.logA.key=SXHfLUwzPw0cQEc1wzwM4w==
|
||||
#jdbc.logA.password=auvtDoVZpGP6P4OqfBrWAg==
|
||||
#
|
||||
#jdbc.logC.driver=oracle.jdbc.driver.OracleDriver
|
||||
#jdbc.logC.url=jdbc:oracle:thin:@10.0.6.212:1523:app
|
||||
#jdbc.logC.username=gk_log_c
|
||||
#jdbc.logC.key=MvwfUIYP0nLyiQeprHB/5A==
|
||||
#jdbc.logC.password=3HXvsqpbOoNBIkHDS5c9Aw==
|
||||
#
|
||||
#jdbc.jk.driver=oracle.jdbc.driver.OracleDriver
|
||||
#jdbc.jk.url=jdbc:oracle:thin:@10.0.6.212:1523:app
|
||||
##jdbc.jk.url=jdbc:oracle:thin:@10.174.196.20:1521:orcl
|
||||
#jdbc.jk.username=gk_jk
|
||||
##jdbc.jk.username=z2_5x9jk
|
||||
#jdbc.jk.key=+FaavsHgQ0qBSebsAoochw==
|
||||
#jdbc.jk.password=wBrNar7gX/iQR7IyCSHuSg==
|
||||
|
||||
|
||||
|
||||
bonecp.idleMaxAgeInMinutes=60
|
||||
bonecp.idleConnectionTestPeriodInMinutes=240
|
||||
bonecp.maxConnectionsPerPartition=50
|
||||
bonecp.minConnectionsPerPartition=10
|
||||
bonecp.partitionCount=3
|
||||
bonecp.acquireIncrement=5
|
||||
bonecp.statementsCacheSize=100
|
||||
|
||||
############################################################################################################################################
|
||||
#数据中心神通数据库接口配置
|
||||
############################################################################################################################################
|
||||
#bonecp.cluster.idleMaxAgeInMinutes=60
|
||||
#bonecp.cluster.idleConnectionTestPeriodInMinutes=240
|
||||
#bonecp.cluster.maxConnectionsPerPartition=10
|
||||
#bonecp.cluster.minConnectionsPerPartition=5
|
||||
#bonecp.cluster.partitionCount=3
|
||||
#bonecp.cluster.acquireIncrement=5
|
||||
#bonecp.cluster.statementsCacheSize=100
|
||||
#
|
||||
#jdbc.log.cluster.driver=com.oscar.cluster.BulkDriver
|
||||
#jdbc.log.cluster.url=jdbc:oscarclusterbulk://10.3.129.125:2010/logdb
|
||||
#jdbc.log.cluster.username=xa_z2_iie
|
||||
#jdbc.log.cluster.key=2fa3hQn28+4AOdJXL4Ud2w==
|
||||
#jdbc.log.cluster.password=uut+weC9of5ocPheagBJ4A==
|
||||
############################################################################################################################################
|
||||
#数据中心hive接口配置
|
||||
############################################################################################################################################
|
||||
|
||||
#A版日志库
|
||||
#jdbc.hiveA.driver=org.apache.hive.jdbc.HiveDriver
|
||||
#jdbc.hiveA.url=jdbc:hive2://10.3.130.24:10000/default
|
||||
#jdbc.hiveA.username=xa_z2_mesa
|
||||
#jdbc.hiveA.key=aC/8fTC9vfPVhCk+CDzbAQ==
|
||||
##加密后密码
|
||||
##jdbc.hiveA.password=V3GyFlG8Mg01bTt8ykFVaA==
|
||||
##实际密码
|
||||
#jdbc.hiveA.password=123!@#qwe
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
##B版日志库
|
||||
#jdbc.hiveB.driver=org.apache.hive.jdbc.HiveDriver
|
||||
#jdbc.hiveB.url=jdbc:hive2://10.3.130.25:10000/default
|
||||
#jdbc.hiveB.username=xa_z2_mesa
|
||||
#jdbc.hiveB.key=aC/8fTC9vfPVhCk+CDzbAQ==
|
||||
##加密后密码
|
||||
##jdbc.hiveB.password=V3GyFlG8Mg01bTt8ykFVaA==
|
||||
##实际密码
|
||||
#jdbc.hiveB.password=123!@#qwe
|
||||
#
|
||||
#
|
||||
#bonecp.hive.idleMaxAgeInMinutes=60
|
||||
#bonecp.hive.idleConnectionTestPeriodInMinutes=240
|
||||
#bonecp.hive.maxConnectionsPerPartition=20
|
||||
#bonecp.hive.minConnectionsPerPartition=10
|
||||
#bonecp.hive.partitionCount=3
|
||||
#bonecp.hive.acquireIncrement=5
|
||||
#bonecp.hive.statementsCacheSize=100
|
||||
#
|
||||
#
|
||||
#
|
||||
#############################################################################################################################################
|
||||
##下面的库为测试库,测试完成后会删除
|
||||
#############################################################################################################################################
|
||||
#
|
||||
#jdbc.test.driver=oracle.jdbc.driver.OracleDriver
|
||||
#jdbc.test.url=jdbc:oracle:thin:@10.0.6.212:1523:app
|
||||
#jdbc.test.username=gk_pztest
|
||||
#jdbc.test.key=cV9126WUYdojQjvuKNjidw==
|
||||
#jdbc.test.password=OrTu/cLwlduYPW/tmxqNgQ==
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -4,9 +4,10 @@
|
||||
<head>
|
||||
|
||||
<title></title>
|
||||
<link rel="stylesheet" href="${pageContext.request.contextPath}/static/global/plugins/editor.md-master/css/editormd.css" />
|
||||
<link href="${pageContext.request.contextPath}/static/global/plugins/jquery-ztree/3.5.12/css/zTreeStyle/zTreeStyle.min.css" rel="stylesheet" type="text/css"/>
|
||||
<script src="${pageContext.request.contextPath}/static/global/plugins/jquery-ztree/3.5.12/js/jquery.ztree.all-3.5.min.js" type="text/javascript"></script>
|
||||
|
||||
<script type="text/javascript" src="${pageContext.request.contextPath}/static/global/plugins/showdown-master/dist/showdown.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
|
||||
@@ -39,33 +40,54 @@ $(document).ready(function(){
|
||||
//隐藏没有分配父节点权限,却有子节点权限的叶子节点
|
||||
//$("#menuTree").children("li:not(:eq(0))").hide();
|
||||
});
|
||||
var helpHrefVal=null;
|
||||
var helpHrefVal=null;//用于在editHelp页面使用
|
||||
var toolLang=null;//用于editorHelp页面初始化语言
|
||||
var markdown="";//用于editorHelp填充编辑器内容
|
||||
function showHelp(helpHref) {
|
||||
|
||||
|
||||
var editBtn=$("#editHelp");
|
||||
if(editBtn!=null&&editBtn!=undefined){
|
||||
editBtn.remove();
|
||||
}
|
||||
if(helpHref!=''){
|
||||
var lang = "${cookie.Language.value }".toLowerCase();
|
||||
if(lang=="" || lang.indexOf("en")!=-1) {
|
||||
|
||||
/* if(lang=="" || lang.indexOf("en")!=-1) {
|
||||
helpHref += ".html";
|
||||
}else if(lang.indexOf("cn")!=-1) {
|
||||
helpHref += ".html";
|
||||
}else if(lang.indexOf("ru")!=-1) {
|
||||
helpHref += ".html";
|
||||
} */
|
||||
if(lang=="" || lang.indexOf("en")!=-1) {
|
||||
helpHref += ".md";
|
||||
}else if(lang.indexOf("cn")!=-1) {
|
||||
helpHref += ".md";
|
||||
}else if(lang.indexOf("ru")!=-1) {
|
||||
helpHref += ".md";
|
||||
}
|
||||
toolLang=lang;
|
||||
helpHrefVal=helpHref;
|
||||
$(".help").load("${pageContext.request.contextPath}"+helpHref+"?time="+new Date().getTime());
|
||||
//$(".help").load("${pageContext.request.contextPath}"+helpHref+"?time="+new Date().getTime());
|
||||
markdown = $.ajax({
|
||||
type:"get",
|
||||
url: "${pageContext.request.contextPath}"+helpHref,
|
||||
dataType:"text",
|
||||
cache: false,
|
||||
async: false
|
||||
}).responseText;
|
||||
var converter = new showdown.Converter();//初始化showdown
|
||||
$(".help").html(converter.makeHtml(markdown));//将markdown格式文件转为html展示
|
||||
var permission="${fns:getUser().isAdmin() }";
|
||||
|
||||
if(permission!=null&&permission!=undefined&&permission=="true"){
|
||||
$("#menuTree").parent().after('<button class="btn btn-default" id="editHelp" style="margin-left:15px;"onclick="javascript:editHelp();"><spring:message code="edit"/></button>');
|
||||
$("#menuTree").parent().after('<button class="btn btn-default" id="editHelp" onclick="javascript:editHelp();"><spring:message code="edit"/></button>');
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
var helpInfo=null;
|
||||
var helpInfo=null;//保存加载的信息,用于在editHelp页面使用
|
||||
function editHelp(){
|
||||
helpInfo=null;
|
||||
var editBtn=$("#editHelp");
|
||||
@@ -76,6 +98,7 @@ function editHelp(){
|
||||
$(".help").load("${pageContext.request.contextPath}/online-help/editHelp.html");
|
||||
|
||||
};
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
@@ -87,7 +110,8 @@ function editHelp(){
|
||||
<div class="col-md-2">
|
||||
<div id="menuTree" class="ztree" style="margin-top:3px;float:left;"></div>
|
||||
</div>
|
||||
<div class="col-md-10 help">
|
||||
<div class="col-md-10 help" >
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
22
src/main/webapp/online-help/app/DNS_feature_advance.md
Normal file
22
src/main/webapp/online-help/app/DNS_feature_advance.md
Normal file
@@ -0,0 +1,22 @@
|
||||
#### [1.功能简介](#accordion1_1)
|
||||
|
||||
用户自定义DNS协议特征,为特定应用添加DNS协议的特征。
|
||||
|
||||
#### [2.基础配置信息](#accordion1_2)
|
||||
|
||||
* 社交应用:用户选择APP。
|
||||
* 配置描述:用户自定义该条配置的描述信息。
|
||||
|
||||
#### [3.配置约束条件](#accordion1_3)
|
||||
|
||||
* 匹配区域:只支持DNS_NAME。
|
||||
* 关键字:添加1个DNS请求域名(只能添加1个),最长1024个字符。
|
||||
* 匹配方式:包含子串匹配、左匹配、有匹配和完全匹配。
|
||||
* 是否十六进制:若关键字填写十六进制格式的DNS请求域名,选择十六进制,否则为非十六进制。
|
||||
* 表达式类型:分为“无表达式”和“与表达式”,“无表达式”可以和任意一种匹配方式组合使用,“与表达式”只能和子串匹配组合使用。
|
||||
|
||||
#### [4.预期效果](#accordion1_4)
|
||||
|
||||
将该DNS特征添加给了指定的APP,如用户产生具有该特征的数据,会有如下效果。* 若用户下发该APP阻断配置,该DNS被阻断,若用户选择生成日志,会有该APP的阻断日志。
|
||||
* 若用户下发该APP监视配置,DNS请求正常工作,若用户选择生成日志,会有该APP的监视日志。
|
||||
* 若用户下发该APP限速配置,户会感知DNS响应变差,若用户选择生成日志,会有该APP的限速日志。
|
||||
33
src/main/webapp/online-help/app/HTTP_feature_advance.md
Normal file
33
src/main/webapp/online-help/app/HTTP_feature_advance.md
Normal file
@@ -0,0 +1,33 @@
|
||||
#### [1.功能简介](#accordion1_1)
|
||||
|
||||
用户自定义HTTP协议特征,为特定应用添加HTTP协议的特征。
|
||||
|
||||
#### [2.基础配置信息](#accordion1_2)
|
||||
|
||||
* 社交应用:用户选择APP。
|
||||
* 配置描述:用户自定义该条配置的描述信息。
|
||||
|
||||
#### [3.配置约束条件](#accordion1_3)
|
||||
|
||||
APP HTTP特征限制条件:
|
||||
|
||||
* 匹配区域:选择具体的HTTP特征,包括请求包的特征和应答包的特征。
|
||||
* 关键字:可填多个关键字,最长1024个字符,用回车键分割。
|
||||
* 匹配方式:包含子串匹配、左匹配、有匹配和完全匹配。
|
||||
* 表达式类型:分为“无表达式”和“与表达式”,“无表达式”可以和任意一种匹配方式组合使用,“与表达式”只能和子串匹配组合使用。
|
||||
* 是否十六进制:若关键字填写十六进制格式的特征,选择十六进制,否则为非十六进制。
|
||||
|
||||
IP范围特征限制条件:
|
||||
|
||||
* IP类型:可选IPV4或IPV6。
|
||||
* IP格式:可选IP、IP范围和IP/子网掩码。
|
||||
* 目的IP:IP格式选择“IP”,该文本框填合法的单个IP;IP格式选择“IP范围”,IP段只能配置x.x.x.0-x.x.x.255;IP/子网掩码中子网掩码值限制为16-32。
|
||||
* 目的端口:端口与端口掩码范围是0-65535。
|
||||
* 协议:可选TCP、UDP、全部。全部表示TCP或UDP。
|
||||
* 可为一个应用添加最多3个APP HTTP特征和1个IP范围特征。当同时满足APP HTTP特征和IP范围特征时,该配置才生效。
|
||||
|
||||
#### [4.预期效果](#accordion1_4)
|
||||
|
||||
将该HTTP特征添加给了指定的APP,如用户产生具有该特征的数据,会有如下效果。* 若用户下发该APP阻断配置,请求该HTTP请求被阻断,若用户选择生成日志,会有该APP的阻断日志。
|
||||
* 若用户下发该APP监视配置,HTTP请求正常工作,若用户选择生成日志,会有该APP的监视日志。
|
||||
* 若用户下发该APP限速配置,户会感知HTTP响应变差,若用户选择生成日志,会有该APP的限速日志。
|
||||
22
src/main/webapp/online-help/app/IP_feature_advance.md
Normal file
22
src/main/webapp/online-help/app/IP_feature_advance.md
Normal file
@@ -0,0 +1,22 @@
|
||||
#### [1.功能简介](#accordion1_1)
|
||||
|
||||
用户自定义IP特征,为特定应用添加IP的特征。
|
||||
|
||||
#### [2.基础配置信息](#accordion1_2)
|
||||
|
||||
* 社交应用:用户选择APP。
|
||||
* 配置描述:用户自定义该条配置的描述信息。
|
||||
|
||||
#### [3.配置约束条件](#accordion1_3)
|
||||
|
||||
* IP类型:可选IPV4或IPV6。
|
||||
* IP格式:可选IP、IP范围和IP/子网掩码。
|
||||
* 目的IP:IP格式选择“IP”,该文本框填合法的单个IP;IP格式选择“IP范围”,IP段只能配置x.x.x.0-x.x.x.255;IP/子网掩码中子网掩码值限制为16-32。
|
||||
* 目的端口:端口与端口掩码范围是0-65535。
|
||||
* 协议:可选TCP、UDP、全部。全部表示TCP或UDP。
|
||||
|
||||
#### [4.预期效果](#accordion1_4)
|
||||
|
||||
将该IP特征添加给了指定的APP,并产生了该特征的数据流量,有如下效果。* 若用户下发该APP阻断配置,无法连接到该IP地址;
|
||||
* 若用户下发该APP监视配置,IP请求正常工作,若用户选择生成日志,会有该APP的监视日志。
|
||||
* 若用户下发该APP限速配置,户会感知响应变差,若用户选择生成日志,会有该APP的限速日志。
|
||||
43
src/main/webapp/online-help/app/app.md
Normal file
43
src/main/webapp/online-help/app/app.md
Normal file
@@ -0,0 +1,43 @@
|
||||
#### [1.功能简介](#accordion1_1)
|
||||
|
||||
APP的识别和管控,配置指定APP的封堵、监视、限速功能界面。
|
||||
|
||||
#### [2.基础配置信息](#accordion1_2)
|
||||
|
||||
* 配置描述:用户自定义该条配置的描述信息。
|
||||
* 是否记录日志:是否生成日志信息。
|
||||
* 社交应用:选择管控的应用。
|
||||
* 行为类型:选择管控具体行为类型。可选项,不选则对该应用的所有行为进行管控。
|
||||
* 执行动作:APP有3种管控动作:阻断、监视和限速。若选择监视,用户需指定客户端IP。若选择限速,用户需指定限速比例。
|
||||
|
||||
#### [3.配置约束条件](#accordion1_3)
|
||||
|
||||
IP类配置,当执行动作选择“监视”,必须填写对应的IP配置。
|
||||
|
||||
* IP类型:IPV4或IPV6。
|
||||
* 协议:可选TCP、UDP和全部。
|
||||
* IP格式:可选IP、IP范围和IP/子网掩码。
|
||||
* 源IP:IP格式选择“IP”,该文本框填合法的单IP;IP格式选择“IP范围”,IP段只能配置x.x.x.0-x.x.x.255;IP/子网掩码中子网掩码值限制为16-32。
|
||||
* 源端口:端口与端口掩码范围是0-65535。
|
||||
* 目的IP:限制同源IP。
|
||||
* 目的端口:端口与端口掩码范围是0-65535。
|
||||
* 另:源IP与目的IP不能相同
|
||||
|
||||
#### [4.配置生效范围](#accordion1_4)
|
||||
|
||||
配置生效范围,分为“全部”和“选择区域”。“全部”指所有地区;“选择区域”需选择区域和运营商,并且可以同时选择多个区域和多个运营商,即某个地区的某个运营商流量生效, 或者某个地区的所有流量生效,或者某个运营商的所有流量生效。
|
||||
|
||||
#### [5.配置标签](#accordion1_6)
|
||||
|
||||
* 来函:选择来函文件类型,必选项;
|
||||
* 类型:指明该配置的类型,可同时选多个,比如信息内容安全、网络攻击等,非必选项;
|
||||
* 性质:指明该配置的性质,可同时选多个,比如政治事务、暴力恐怖等,非必选项;
|
||||
* 用户标签:用户自定义标签,可同时选多个,非必选项;
|
||||
|
||||
#### [6.预期效果](#accordion1_7)
|
||||
|
||||
* 执行动作选择“阻断”,未选择行为类型,该APP全部功能无法正常使用;如果选择了行为类型,该APP的对应行为无法正常使用;
|
||||
* 执行动作选择“监视”,该APP被正常使用。
|
||||
* 执行动作选择“限速”,户会感知网速变差,当限速比例高达**时,APP出现无法使用的情况。
|
||||
* 若指定了客户端IP,该配置只对该用户生效,其他用户不受影响。
|
||||
* 若选择了记录日志,日志界面出现该配置的日志。
|
||||
41
src/main/webapp/online-help/app/basic_protocol.md
Normal file
41
src/main/webapp/online-help/app/basic_protocol.md
Normal file
@@ -0,0 +1,41 @@
|
||||
#### [1.功能简介](#accordion1_1)
|
||||
|
||||
基础协议的识别和管控,配置指定协议的封堵、监视界面。
|
||||
|
||||
#### [2.基础配置信息](#accordion1_2)
|
||||
|
||||
* 配置描述:用户自定义该条配置的描述信息。
|
||||
* 是否记录日志:是否生成日志信息。
|
||||
* 基础协议:选择管控的协议。
|
||||
* 执行动作:基础协议有两种管控动作:阻断、监视。若选择监视,用户需指定客户端IP相关信息。
|
||||
|
||||
#### [3.配置约束条件](#accordion1_3)
|
||||
|
||||
IP类配置,当执行动作选择“监视”,必须填写对应的IP配置。
|
||||
|
||||
* IP类型:IPV4或IPV6。
|
||||
* 协议:可选TCP、UDP和全部。
|
||||
* IP格式:可选IP、IP范围和IP/子网掩码。
|
||||
* 源IP:IP格式选择“IP”,该文本框填合法的单IP;IP格式选择“IP范围”,IP段只能配置x.x.x.0-x.x.x.255;IP/子网掩码中子网掩码值限制为16-32。
|
||||
* 源端口:端口与端口掩码范围是0-65535。
|
||||
* 目的IP:限制同源IP。
|
||||
* 目的端口:端口与端口掩码范围是0-65535。
|
||||
* 另:源IP与目的IP不能相同
|
||||
|
||||
#### [4.配置生效范围](#accordion1_4)
|
||||
|
||||
配置生效范围,分为“全部”和“选择区域”。“全部”指所有地区;“选择区域”需选择区域和运营商,并且可以同时选择多个区域和多个运营商,即某个地区的某个运营商流量生效, 或者某个地区的所有流量生效,或者某个运营商的所有流量生效。
|
||||
|
||||
#### [5.配置标签](#accordion1_6)
|
||||
|
||||
* 来函:选择来函文件类型,必选项;
|
||||
* 类型:指明该配置的类型,可同时选多个,比如信息内容安全、网络攻击等,非必选项;
|
||||
* 性质:指明该配置的性质,可同时选多个,比如政治事务、暴力恐怖等,非必选项;
|
||||
* 用户标签:用户自定义标签,可同时选多个,非必选项;
|
||||
|
||||
#### [6.预期效果](#accordion1_7)
|
||||
|
||||
* 执行动作选择“阻断”,使用该协议的应用全部无法正常使用;
|
||||
* 执行动作选择“监视”,使用该协议的应用不受影响。
|
||||
* 若指定了客户端IP,该配置只对该用户生效,其他用户不受影响。
|
||||
* 若选择了记录日志,日志界面出现该配置的日志。
|
||||
20
src/main/webapp/online-help/app/domain_feature_advance.md
Normal file
20
src/main/webapp/online-help/app/domain_feature_advance.md
Normal file
@@ -0,0 +1,20 @@
|
||||
#### [1.功能简介](#accordion1_1)
|
||||
|
||||
用户自定义域名特征,为特定应用添加域名的特征。
|
||||
|
||||
#### [2.基础配置信息](#accordion1_2)
|
||||
|
||||
* 社交应用:用户选择APP。
|
||||
* 配置描述:用户自定义该条配置的描述信息。
|
||||
|
||||
#### [3.配置约束条件](#accordion1_3)
|
||||
|
||||
* 域名:填写正确的域名,最长1024字符。
|
||||
* 匹配方式:包含子串匹配、左匹配、有匹配和完全匹配。
|
||||
* 是否十六进制:若关键字填写十六进制格式的特征,选择十六进制,否则为非十六进制。
|
||||
|
||||
#### [4.预期效果](#accordion1_4)
|
||||
|
||||
将该域名特征添加给了指定的APP,如用户产生具有该特征的数据,会有如下效果。* 若用户下发该APP阻断配置,请求该域名被阻断,若用户选择生成日志,会有该APP的阻断日志。
|
||||
* 若用户下发该APP监视配置,域名请求正常工作,若用户选择生成日志,会有该APP的监视日志。
|
||||
* 若用户下发该APP限速配置,户会感知域名响应变差,若用户选择生成日志,会有该APP的限速日志。
|
||||
34
src/main/webapp/online-help/app/payload_feature_advance.md
Normal file
34
src/main/webapp/online-help/app/payload_feature_advance.md
Normal file
@@ -0,0 +1,34 @@
|
||||
#### [1.功能简介](#accordion1_1)
|
||||
|
||||
用户自定义数据包载荷特征,为特定应用添加载荷的特征。
|
||||
|
||||
#### [2.基础配置信息](#accordion1_2)
|
||||
|
||||
* 社交应用:用户选择APP。
|
||||
* 配置描述:用户自定义该条配置的描述信息。
|
||||
|
||||
#### [3.配置约束条件](#accordion1_3)
|
||||
|
||||
APP载荷类约束条件:
|
||||
|
||||
* 匹配区域:共7类APP载荷特征,分别是:载荷、C2S载荷、S2C载荷,C2S方向包序列,S2C方向包序列,二层头,三层头。
|
||||
* 关键字:可填多个关键字,最长1024字符,用回车键分割。
|
||||
* 匹配方式:包含子串匹配、左匹配、有匹配和完全匹配。
|
||||
* 表达式类型:分为“无表达式”和“与表达式”,“无表达式”可以和任意一种匹配方式组合使用,“与表达式”只能和子串匹配组合使用。
|
||||
* 是否十六进制:十六进制的
|
||||
|
||||
IP类约束条件:
|
||||
|
||||
* IP类型:可选IPV4或IPV6。
|
||||
* IP格式:可选IP、IP范围和IP/子网掩码。
|
||||
* 目的IP:IP格式选择“IP”,该文本框填合法的单个IP;IP格式选择“IP范围”,IP段只能配置x.x.x.0-x.x.x.255;IP/子网掩码中子网掩码值限制为16-32。
|
||||
* 目的端口:端口与端口掩码范围是0-65535。
|
||||
* 协议:可选TCP、UDP、全部。全部表示TCP或UDP。
|
||||
|
||||
可为一个应用添加最多3个APP载荷特征和1个IP范围特征。当同时满足APP载荷特征和IP范围特征时,该配置才生效。
|
||||
|
||||
#### [4.预期效果](#accordion1_4)
|
||||
|
||||
将该载荷特征添加给了指定的APP,如用户产生具有该载荷特征的数据,会有如下效果。* 若用户下发该APP阻断配置,具有该载荷特征的数据流被阻断,若用户选择生成日志,会有该APP的阻断日志。;
|
||||
* 若用户下发该APP监视配置,具有该载荷特征的数据正常工作,若用户选择生成日志,会有该APP的监视日志。
|
||||
* 若用户下发该APP限速配置,户会感知响应变差,若用户选择生成日志,会有该APP的限速日志。
|
||||
33
src/main/webapp/online-help/app/ssl_feature_advance.md
Normal file
33
src/main/webapp/online-help/app/ssl_feature_advance.md
Normal file
@@ -0,0 +1,33 @@
|
||||
#### [1.功能简介](#accordion1_1)
|
||||
|
||||
用户自定义SSL协议特征,为特定应用添加SSL协议的特征。
|
||||
|
||||
#### [2.基础配置信息](#accordion1_2)
|
||||
|
||||
* 社交应用:用户选择APP。
|
||||
* 配置描述:用户自定义该条配置的描述信息。
|
||||
|
||||
#### [3.配置约束条件](#accordion1_3)
|
||||
|
||||
APP SSL类约束条件:
|
||||
|
||||
* 匹配区域:选择具体的SSL特征。
|
||||
* 关键字:可填多个关键字,最长1024字符,用回车键分割。比如匹配区域选择SSL_SNI,关键字填完整的域名,用户需按实际情况填写,可参考抓包工具的数据包解析结果。
|
||||
* 匹配方式:包含子串匹配、左匹配、有匹配和完全匹配。
|
||||
* 是否十六进制:若关键字填写十六进制格式的特征,选择十六进制,否则为非十六进制。
|
||||
|
||||
IP类约束条件:
|
||||
|
||||
* IP类型:可选IPV4或IPV6。
|
||||
* IP格式:可选IP、IP范围和IP/子网掩码。
|
||||
* 目的IP:IP格式选择“IP”,该文本框填合法的单个IP;IP格式选择“IP范围”,IP段只能配置x.x.x.0-x.x.x.255;IP/子网掩码中子网掩码值限制为16-32。
|
||||
* 目的端口:端口与端口掩码范围是0-65535。
|
||||
* 协议:可选TCP、UDP、全部。全部表示TCP或UDP。
|
||||
|
||||
可为一个应用添加最多3个APP SSL特征和1个IP范围特征。当同时满足APP SSL特征和IP范围特征时,该配置才生效。
|
||||
|
||||
#### [4.预期效果](#accordion1_4)
|
||||
|
||||
将该SLL特征添加给了指定的APP,如用户产生具有该特征的数据,会有如下效果。* 若用户下发该APP阻断配置,具有该特征的数据流被阻断,若用户选择生成日志,会有该APP的阻断日志。
|
||||
* 若用户下发该APP监视配置,具有该特征的数据正常工作,若用户选择生成日志,会有该APP的监视日志。
|
||||
* 若用户下发该APP限速配置,户会感知响应变差,若用户选择生成日志,会有该APP的限速日志。
|
||||
42
src/main/webapp/online-help/app/tunnel_behavior.md
Normal file
42
src/main/webapp/online-help/app/tunnel_behavior.md
Normal file
@@ -0,0 +1,42 @@
|
||||
#### [1.功能简介](#accordion1_1)
|
||||
|
||||
对用户使用加密隧道的行为进行识别和管控,比如识别用户使用加密隧道进行视频通话的行为。
|
||||
|
||||
#### [2.基础配置信息](#accordion1_2)
|
||||
|
||||
* 配置描述:用户自定义该条配置的描述信息。
|
||||
* 是否记录日志:是否生成日志信息。
|
||||
* 加密隧道协议:选择一种加密隧道协议。
|
||||
* 行为类型:包括“视频”和“其他”,视频指实时视频通话,注意,使用youtube播放视频属于“其他”。
|
||||
* 执行动作:加密隧道行为有两种管控动作:阻断、监视。若选择监视,用户需指定客户端相关信息。
|
||||
|
||||
#### [3.配置约束条件](#accordion1_3)
|
||||
|
||||
IP类配置,当执行动作选择“监视”,必须填写对应的IP配置。
|
||||
|
||||
* IP类型:IPV4或IPV6。
|
||||
* 协议:可选TCP、UDP和全部。
|
||||
* IP格式:可选IP、IP范围和IP/子网掩码。
|
||||
* 源IP:IP格式选择“IP”,该文本框填合法的单IP;IP格式选择“IP范围”,IP段只能配置x.x.x.0-x.x.x.255;IP/子网掩码中子网掩码值限制为16-32。
|
||||
* 源端口:端口与端口掩码范围是0-65535。
|
||||
* 目的IP:限制同源IP。
|
||||
* 目的端口:端口与端口掩码范围是0-65535。
|
||||
* 另:源IP与目的IP不能相同
|
||||
|
||||
#### [4.配置生效范围](#accordion1_4)
|
||||
|
||||
配置生效范围,分为“全部”和“选择区域”。“全部”指所有地区;“选择区域”需选择区域和运营商,并且可以同时选择多个区域和多个运营商,即某个地区的某个运营商流量生效, 或者某个地区的所有流量生效,或者某个运营商的所有流量生效。
|
||||
|
||||
#### [5.配置标签](#accordion1_6)
|
||||
|
||||
* 来函:选择来函文件类型,必选项;
|
||||
* 类型:指明该配置的类型,可同时选多个,比如信息内容安全、网络攻击等,非必选项;
|
||||
* 性质:指明该配置的性质,可同时选多个,比如政治事务、暴力恐怖等,非必选项;
|
||||
* 用户标签:用户自定义标签,可同时选多个,非必选项;
|
||||
|
||||
#### [6.预期效果](#accordion1_7)
|
||||
|
||||
* 执行动作选择“阻断”,使用该协议的应用全部无法正常使用;若指定了行为,只有该行为无法正常使用。
|
||||
* 执行动作选择“监视”,使用该协议的应用不受影响。
|
||||
* 若指定了客户端IP,该配置只对该用户生效,其他用户不受影响。
|
||||
* 若选择了记录日志,日志界面出现该配置的日志。
|
||||
@@ -6,12 +6,15 @@
|
||||
<script type="text/javascript" src="../../static/global/plugins/jquery.min.js"></script>
|
||||
<link rel="stylesheet" href="../../static/global/plugins/editor.md-master/css/editormd.css" />
|
||||
<script type="text/javascript" src="../../static/global/plugins/editor.md-master/editormd.js"></script>
|
||||
<script type="text/javascript" src="../../static/global/plugins/showdown-master/dist/showdown.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
//初始化编辑器
|
||||
var testEditor;
|
||||
var converter = new showdown.Converter();//初始化showdown编辑器
|
||||
$(function () {
|
||||
testEditor = editormd("editormd-help", {
|
||||
width: "100%",
|
||||
width: "90%",
|
||||
height: 740,
|
||||
path: '../../static/global/plugins/editor.md-master/lib/',
|
||||
toolbarIcons:function(){
|
||||
@@ -34,17 +37,33 @@
|
||||
tocm: true, // Using [TOCM]
|
||||
tex: true, // 开启科学公式TeX语言支持,默认关闭
|
||||
flowChart: true, // 开启流程图支持,默认关闭
|
||||
sequenceDiagram: true // 开启时序/序列图支持,默认关闭
|
||||
|
||||
sequenceDiagram: true ,// 开启时序/序列图支持,默认关闭
|
||||
onload: function(){
|
||||
if(toolLang!=null&&toolLang!=undefined){
|
||||
if(toolLang.indexOf("cn")==-1){
|
||||
var path="../../static/global/plugins/editor.md-master/languages/";//插件语言包目录
|
||||
if(toolLang==""||toolLang.indexOf("en")!=-1){//设置菜单栏默认语言为 en
|
||||
toolLang="en";
|
||||
}else if(toolLang.indexOf("ru")!=-1){
|
||||
//toolLang="ru";
|
||||
toolLang="en";//暂时设置为英文,如有俄文,需改为ru
|
||||
}
|
||||
editormd.loadScript(path + toolLang, function() {
|
||||
testEditor.lang = editormd.defaults.lang;
|
||||
// 只重建涉及语言包的部分,如工具栏、弹出对话框等
|
||||
testEditor.recreate();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
$("#edit_help_textarea").text(helpInfo);
|
||||
//var markdown=converter.makeMarkdown(helpInfo);//将提取的页面数据
|
||||
$("#edit_help_textarea").text(markdown);
|
||||
});
|
||||
function saveHelpInfo(){
|
||||
//var helpInfoval=testEditor.getTextareaSavedHTML();
|
||||
var helpInfoval=$("#edit_help_textarea").text();
|
||||
var alertObj=$(".alert");
|
||||
if(alertObj!=null&&alertObj!=undefined){
|
||||
alertObj.remove();
|
||||
}
|
||||
clearAlter();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/gwall/nis/sys/saveHelp",
|
||||
@@ -52,22 +71,31 @@
|
||||
data: "editedHelpInfo="+encodeURIComponent(encodeURIComponent(helpInfoval))+"&helpHrefVal="+encodeURIComponent(helpHrefVal),
|
||||
success: function(data){
|
||||
if(data){
|
||||
|
||||
clearAlter();
|
||||
$(".help").prepend("<div class=\"alert alert-success alert-dismissable\"><button type=\"button\" class=\"close\" data-dismiss=\"alert\"aria-hidden=\"true\">×</button>save successs</div>");
|
||||
}else{
|
||||
clearAlter();
|
||||
$(".help").prepend("<div class=\"alert alert-danger alert-dismissable\"><button type=\"button\" class=\"close\" data-dismiss=\"alert\"aria-hidden=\"true\">×</button>save faild</div>");
|
||||
}
|
||||
},
|
||||
error:function(msg){
|
||||
clearAlter();
|
||||
$(".help").prepend("<div class=\"alert alert-danger alert-dismissable\"><button type=\"button\" class=\"close\" data-dismiss=\"alert\"aria-hidden=\"true\">×</button>save faild</div>");
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function clearAlter(){
|
||||
var alertObj=$(".alert");
|
||||
if(alertObj!=null&&alertObj!=undefined){
|
||||
alertObj.remove();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="editormd-help">
|
||||
<div id="editormd-help" >
|
||||
<textarea style="display:none;" id="edit_help_textarea"></textarea>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
44
src/main/webapp/online-help/ntc/BGP.md
Normal file
44
src/main/webapp/online-help/ntc/BGP.md
Normal file
@@ -0,0 +1,44 @@
|
||||
#### [0.功能简介](#accordion1_0)
|
||||
|
||||
本页面完成针对BGP流量的配置,从而对包含特定IP或AS特征的BGP流量进行监测或阻断。
|
||||
|
||||
#### [1.配置基础信息](#accordion1_1)
|
||||
|
||||
配置基础信息包括:规则名称,执行动作,是否记录管控日志。
|
||||
|
||||
* 规则名称:用户自定义的该条配置的描述信息。
|
||||
* 执行动作:配置施加于网络传输单元时,对网络流量施加什么样的动作,此处为阻断、监测二选一。
|
||||
* 是否记录日志:对网络流量施加执行动作时,是否记录命中BGP协议配置的流量信息,包括发现时间、IP、AS等。
|
||||
|
||||
#### [2.业务配置属性](#accordion1_2)
|
||||
|
||||
BGP协议管控的流量属性信息:
|
||||
|
||||
* AS:配置自治系统的关键词,精确匹配,非二进制,大小写不敏感。
|
||||
* IP:选择IP类型、协议、IP模式、端口模式,并且填写对应的具体IP与端口值,选择匹配方向是单向还是双向匹配。
|
||||
|
||||
#### [3.配置约束条件](#accordion1_3)
|
||||
|
||||
BGP协议管控配置的属性信息:
|
||||
|
||||
* 源IP:合法的单IP;IP段只能配置x.x.x.0-x.x.x.255;IP/mask中mask值限制为16-32。
|
||||
* 源端口:端口与端口掩码范围是0-65535。
|
||||
* 目的IP:合法的单IP;IP段只能配置x.x.x.0-x.x.x.255;IP/mask中mask值限制为16-32。
|
||||
* 目的端口:端口与端口掩码范围是0-65535。
|
||||
* 另:源IP与目的IP不能相同。
|
||||
|
||||
#### [4.配置生效区域](#accordion1_5)
|
||||
|
||||
配置的生效区域,生效区域包括地区,以及ISP,地区和ISP可组合,即某个地区的某个运营商流量生效, 或者某个地区的所有流量生效,或者某个运营商的所有流量生效,也可全域生效。
|
||||
|
||||
#### [5.配置标签](#accordion1_6)
|
||||
|
||||
* 来函:必选项,官方或其他组织下达的配置流量管控依据
|
||||
* 分类:非必选项,配置分类,例如内容安全、网络攻击等。
|
||||
* 性质:非必选项,配置性质,例如政治、暴力、宗教等。
|
||||
* 标签:非必选项,自定义标签。
|
||||
|
||||
#### [6.预期效果](#accordion1_7)
|
||||
|
||||
* 监测预期效果:记录符合配置条件的BGP流量监测日志。
|
||||
* 阻断预期效果:阻断符合配置条件的BGP流量,并记录阻断日志。
|
||||
45
src/main/webapp/online-help/ntc/DNS.md
Normal file
45
src/main/webapp/online-help/ntc/DNS.md
Normal file
@@ -0,0 +1,45 @@
|
||||
#### [0.功能简介](#accordion1_0)
|
||||
|
||||
本页面完成针对DNS流量的配置,从而对包含特定IP或DNS关键词特征的DNS流量进行监测或阻断。
|
||||
|
||||
#### [1.配置基础信息](#accordion1_1)
|
||||
|
||||
配置基础信息包括:规则名称,执行动作,是否记录管控日志。
|
||||
|
||||
* 规则名称:用户自定义的该条配置的描述信息。
|
||||
* 执行动作:配置施加于网络传输单元时,对网络流量施加什么样的动作,此处为阻断、监测二选一。
|
||||
* 是否记录日志:对网络流量施加执行动作时,是否记录命中DNS协议配置的流量信息,包括发现时间、IP、请求内容等。
|
||||
|
||||
#### [2.业务配置属性](#accordion1_2)
|
||||
|
||||
DNS协议管控的流量属性信息:
|
||||
|
||||
* keyword:DNS关键词。匹配字段选择,例如QNAME;关键字填写;表达式类型选择,支持选择与表达式;匹配方式选择,例如子串匹配、前缀匹配、后缀匹配与精确匹配;是否二进制选择(此处是指关键字内容是否为二进制原始码流,选择是,则关键字处填写十六进制数);是否大小写敏感选择。
|
||||
* IP:选择IP类型、协议、IP模式、端口模式,并且填写对应的具体IP与端口值,选择匹配方向是单向还是双向匹配。
|
||||
* Subscribe ID:IP地址对应的用户信息关键字,子串匹配,非二进制,大小写不敏感。
|
||||
|
||||
#### [3.配置约束条件](#accordion1_3)
|
||||
|
||||
DNS协议管控配置的属性信息:
|
||||
|
||||
* 客户端IP:合法的单IP;IP段只能配置x.x.x.0-x.x.x.255;IP/mask中mask值限制为16-32。
|
||||
* 客户端端口:端口与端口掩码范围是0-65535。
|
||||
* 服务端IP:合法的单IP;IP段只能配置x.x.x.0-x.x.x.255;IP/mask中mask值限制为16-32。
|
||||
* 服务端端口:端口与端口掩码范围是0-65535。
|
||||
* 另:客户端IP与服务端IP不能相同。
|
||||
|
||||
#### [4.配置生效区域](#accordion1_5)
|
||||
|
||||
配置的生效区域,生效区域包括地区,以及ISP,地区和ISP可组合,即某个地区的某个运营商流量生效, 或者某个地区的所有流量生效,或者某个运营商的所有流量生效,也可全域生效。
|
||||
|
||||
#### [5.配置标签](#accordion1_6)
|
||||
|
||||
* 来函:必选项,官方或其他组织下达的配置流量管控依据
|
||||
* 分类:非必选项,配置分类,例如内容安全、网络攻击等。
|
||||
* 性质:非必选项,配置性质,例如政治、暴力、宗教等。
|
||||
* 标签:非必选项,自定义标签。
|
||||
|
||||
#### [6.预期效果](#accordion1_7)
|
||||
|
||||
* 监测预期效果:记录符合配置条件的DNS流量监测日志。
|
||||
* 阻断预期效果:阻断符合配置条件的DNS请求或对符合配置条件的DNS请求抢答欺骗包,并记录阻断日志。
|
||||
46
src/main/webapp/online-help/ntc/FTP.md
Normal file
46
src/main/webapp/online-help/ntc/FTP.md
Normal file
@@ -0,0 +1,46 @@
|
||||
#### [0.功能简介](#accordion1_0)
|
||||
|
||||
本页面完成针对FTP流量的配置,从而对包含特定IP、URL或内容特征的FTP流量进行监测或阻断。
|
||||
|
||||
#### [1.配置基础信息](#accordion1_1)
|
||||
|
||||
配置基础信息包括:规则名称,执行动作,是否记录管控日志。
|
||||
|
||||
* 规则名称:用户自定义的该条配置的描述信息。
|
||||
* 执行动作:配置施加于网络传输单元时,对网络流量施加什么样的动作,此处为阻断、监测二选一。
|
||||
* 是否记录日志:对网络流量施加执行动作时,是否记录命中FTP协议配置的流量信息,包括发现时间、IP、URL等。
|
||||
|
||||
#### [2.业务配置属性](#accordion1_2)
|
||||
|
||||
FTP协议扩展管控的流量属性信息:
|
||||
|
||||
* URL:FTP的URL。关键字填写;匹配方式选择,例如子串匹配、前缀匹配、后缀匹配与精确匹配;非二进制;大小写不敏感。
|
||||
* FTP内容:关键字填写;匹配方式选择,例如子串匹配、前缀匹配、后缀匹配与精确匹配;是否二进制选择(此处是指关键字内容是否为二进制原始码流,选择是,则关键字处填写十六进制数);是否大小写敏感选择。
|
||||
* IP:选择IP类型、协议、IP模式、端口模式,并且填写对应的具体IP与端口值,选择匹配方向是单向还是双向匹配。
|
||||
* Subscribe ID:IP地址对应的用户信息关键字,子串匹配,非二进制,大小写不敏感。
|
||||
|
||||
#### [3.配置约束条件](#accordion1_3)
|
||||
|
||||
FTP协议管控配置的属性信息:
|
||||
|
||||
* 客户端IP:合法的单IP;IP段只能配置x.x.x.0-x.x.x.255;IP/mask中mask值限制为16-32。
|
||||
* 客户端端口:端口与端口掩码范围是0-65535。
|
||||
* 服务端IP:合法的单IP;IP段只能配置x.x.x.0-x.x.x.255;IP/mask中mask值限制为16-32。
|
||||
* 服务端端口:端口与端口掩码范围是0-65535。
|
||||
* 另:客户端IP与服务端IP不能相同。
|
||||
|
||||
#### [4.配置生效区域](#accordion1_5)
|
||||
|
||||
配置的生效区域,生效区域包括地区,以及ISP,地区和ISP可组合,即某个地区的某个运营商流量生效, 或者某个地区的所有流量生效,或者某个运营商的所有流量生效,也可全域生效。
|
||||
|
||||
#### [5.配置标签](#accordion1_6)
|
||||
|
||||
* 来函:必选项,官方或其他组织下达的配置流量管控依据
|
||||
* 分类:非必选项,配置分类,例如内容安全、网络攻击等。
|
||||
* 性质:非必选项,配置性质,例如政治、暴力、宗教等。
|
||||
* 标签:非必选项,自定义标签。
|
||||
|
||||
#### [6.预期效果](#accordion1_7)
|
||||
|
||||
* 监测预期效果:记录符合配置条件的FTP流量监测日志。
|
||||
* 阻断预期效果:阻断符合配置条件的FTP访问,即无法获取到该FTP内容,并记录阻断日志。
|
||||
34
src/main/webapp/online-help/ntc/HTTP_URL.md
Normal file
34
src/main/webapp/online-help/ntc/HTTP_URL.md
Normal file
@@ -0,0 +1,34 @@
|
||||
#### [0.功能简介](#accordion1_0)
|
||||
|
||||
本页面完成针对HTTP流量的配置,从而对包含特定URL特征的HTTP流量进行加入白名单、监测或阻断。
|
||||
|
||||
#### [1.配置基础信息](#accordion1_1)
|
||||
|
||||
配置基础信息包括:规则名称,执行动作。
|
||||
|
||||
* 规则名称:用户自定义的该条配置的描述信息。
|
||||
* 执行动作:配置施加于网络传输单元时,对网络流量施加什么样的动作,此处为白名单、阻断、监测三选一。
|
||||
|
||||
#### [2.业务配置属性](#accordion1_2)
|
||||
|
||||
HTTP协议管控的流量属性信息:
|
||||
|
||||
* URL:HTTP统一资源定位符关键词。关键字填写;匹配方式选择,例如子串匹配、前缀匹配、后缀匹配与精确匹配;非二进制;大小写不敏感。
|
||||
|
||||
#### [3.配置约束条件](#accordion1_3)
|
||||
|
||||
#### [4.配置生效区域](#accordion1_5)
|
||||
|
||||
配置的生效区域,生效区域包括地区,以及ISP,地区和ISP可组合,即某个地区的某个运营商流量生效, 或者某个地区的所有流量生效,或者某个运营商的所有流量生效,也可全域生效。
|
||||
|
||||
#### [5.配置标签](#accordion1_6)
|
||||
|
||||
* 来函:必选项,官方或其他组织下达的配置流量管控依据
|
||||
* 分类:非必选项,配置分类,例如内容安全、网络攻击等。
|
||||
* 性质:非必选项,配置性质,例如政治、暴力、宗教等。
|
||||
* 标签:非必选项,自定义标签。
|
||||
|
||||
#### [6.预期效果](#accordion1_7)
|
||||
|
||||
* 监测预期效果:记录符合配置条件的HTTP流量监测日志。
|
||||
* 阻断预期效果:阻断符合配置条件的HTTP访问,即访问页面无响应,并记录阻断日志。
|
||||
54
src/main/webapp/online-help/ntc/HTTP_advanced.md
Normal file
54
src/main/webapp/online-help/ntc/HTTP_advanced.md
Normal file
@@ -0,0 +1,54 @@
|
||||
#### [0.功能简介](#accordion1_0)
|
||||
|
||||
本页面完成针对HTTP流量的扩展配置,从而对包含特定IP、URL、字段或内容特征的HTTP流量进行监测或阻断。
|
||||
|
||||
#### [1.配置基础信息](#accordion1_1)
|
||||
|
||||
配置基础信息包括:规则名称,执行动作,是否记录管控日志。
|
||||
|
||||
* 规则名称:用户自定义的该条配置的描述信息。
|
||||
* 执行动作:配置施加于网络传输单元时,对网络流量施加什么样的动作,此处为阻断、监测二选一。
|
||||
* 是否记录日志:对网络流量施加执行动作时,是否记录命中HTTP扩展配置的流量信息,包括发现时间、IP、URL、请求头、请求体、响应头、响应体等。
|
||||
|
||||
#### [2.业务配置属性](#accordion1_2)
|
||||
|
||||
HTTP协议扩展管控的流量属性信息,分为请求侧与响应侧。 请求侧:
|
||||
|
||||
* URL:关键字填写;匹配方式选择,例如子串匹配、前缀匹配、后缀匹配与精确匹配;是否二进制选择(此处是指关键字内容是否为二进制原始码流,选择是,则关键字处填写十六进制数);是否大小写敏感选择。
|
||||
* 字段:匹配字段选择,例如User Agent、Cookie等;关键字填写;匹配方式选择,例如子串匹配、前缀匹配、后缀匹配与精确匹配;是否二进制选择(此处是指关键字内容是否为二进制原始码流,选择是,则关键字处填写十六进制数);是否大小写敏感选择。
|
||||
* 请求消息体:关键字填写;匹配方式选择,例如子串匹配、前缀匹配、后缀匹配与精确匹配;是否二进制选择(此处是指关键字内容是否为二进制原始码流,选择是,则关键字处填写十六进制数);是否大小写敏感选择。
|
||||
* IP:选择IP类型、协议、IP模式、端口模式,并且填写对应的具体IP与端口值,选择匹配方向是单向还是双向匹配。
|
||||
* Subscribe ID:IP地址对应的用户信息关键字,子串匹配,非二进制,大小写不敏感。
|
||||
|
||||
响应侧:
|
||||
|
||||
* 响应头域字段:匹配字段选择,例如set-cookie、Content-Type等;关键字填写;匹配方式选择,例如子串匹配、前缀匹配、后缀匹配与精确匹配;是否二进制选择(此处是指关键字内容是否为二进制原始码流,选择是,则关键字处填写十六进制数);是否大小写敏感选择。
|
||||
* 响应消息体:关键字填写;匹配方式选择,例如子串匹配、前缀匹配、后缀匹配与精确匹配;是否二进制选择(此处是指关键字内容是否为二进制原始码流,选择是,则关键字处填写十六进制数);是否大小写敏感选择。
|
||||
* IP:选择IP类型、协议、IP模式、端口模式,并且填写对应的具体IP与端口值,选择匹配方向是单向还是双向匹配。
|
||||
* Subscribe ID:IP地址对应的用户信息关键字,子串匹配,非二进制,大小写不敏感。
|
||||
|
||||
#### [3.配置约束条件](#accordion1_3)
|
||||
|
||||
HTTP协议扩展管控配置的属性信息:
|
||||
|
||||
* 客户端IP:合法的单IP;IP段只能配置x.x.x.0-x.x.x.255;IP/mask中mask值限制为16-32。
|
||||
* 客户端端口:端口与端口掩码范围是0-65535。
|
||||
* 服务端IP:合法的单IP;IP段只能配置x.x.x.0-x.x.x.255;IP/mask中mask值限制为16-32。
|
||||
* 服务端端口:端口与端口掩码范围是0-65535。
|
||||
* 另:客户端IP与服务端IP不能相同。
|
||||
|
||||
#### [4.配置生效区域](#accordion1_5)
|
||||
|
||||
配置的生效区域,生效区域包括地区,以及ISP,地区和ISP可组合,即某个地区的某个运营商流量生效, 或者某个地区的所有流量生效,或者某个运营商的所有流量生效,也可全域生效。
|
||||
|
||||
#### [5.配置标签](#accordion1_6)
|
||||
|
||||
* 来函:必选项,官方或其他组织下达的配置流量管控依据
|
||||
* 分类:非必选项,配置分类,例如内容安全、网络攻击等。
|
||||
* 性质:非必选项,配置性质,例如政治、暴力、宗教等。
|
||||
* 标签:非必选项,自定义标签。
|
||||
|
||||
#### [6.预期效果](#accordion1_7)
|
||||
|
||||
* 监测预期效果:记录符合配置条件的HTTP流量监测日志。
|
||||
* 阻断预期效果:阻断符合配置条件的HTTP访问,即访问页面无响应,并记录阻断日志。
|
||||
36
src/main/webapp/online-help/ntc/HTTP_website.md
Normal file
36
src/main/webapp/online-help/ntc/HTTP_website.md
Normal file
@@ -0,0 +1,36 @@
|
||||
#### [0.功能简介](#accordion1_0)
|
||||
|
||||
本页面完成针对HTTP流量的配置,从而对包含特定网站关键词特征的HTTP流量进行监测或阻断。
|
||||
|
||||
#### [1.配置基础信息](#accordion1_1)
|
||||
|
||||
配置基础信息包括:规则名称,执行动作,是否记录管控日志。
|
||||
|
||||
* 规则名称:用户自定义的该条配置的描述信息。
|
||||
* 执行动作:配置施加于网络传输单元时,对网络流量施加什么样的动作,此处为阻断、监测二选一。
|
||||
* 是否记录日志:对网络流量施加执行动作时,是否记录命中配置的HTTP流量信息,包括发现时间、IP、URL、请求头、请求体、响应头、响应体等。
|
||||
|
||||
#### [2.业务配置属性](#accordion1_2)
|
||||
|
||||
HTTP协议网站管控的流量属性信息,分为请求侧与响应侧:
|
||||
|
||||
* 请求侧消息体关键词:关键字填写;匹配方式选择,例如子串匹配、前缀匹配、后缀匹配与精确匹配;是否二进制选择(此处是指关键字内容是否为二进制原始码流,选择是,则关键字处填写十六进制数);是否大小写敏感选择。
|
||||
* 响应侧消息体关键词:关键字填写;匹配方式选择,例如子串匹配、前缀匹配、后缀匹配与精确匹配;是否二进制选择(此处是指关键字内容是否为二进制原始码流,选择是,则关键字处填写十六进制数);是否大小写敏感选择。
|
||||
|
||||
#### [3.配置约束条件](#accordion1_3)
|
||||
|
||||
#### [4.配置生效区域](#accordion1_5)
|
||||
|
||||
配置的生效区域,生效区域包括地区,以及ISP,地区和ISP可组合,即某个地区的某个运营商流量生效, 或者某个地区的所有流量生效,或者某个运营商的所有流量生效,也可全域生效。
|
||||
|
||||
#### [5.配置标签](#accordion1_6)
|
||||
|
||||
* 来函:必选项,官方或其他组织下达的配置流量管控依据
|
||||
* 分类:非必选项,配置分类,例如内容安全、网络攻击等。
|
||||
* 性质:非必选项,配置性质,例如政治、暴力、宗教等。
|
||||
* 标签:非必选项,自定义标签。
|
||||
|
||||
#### [6.预期效果](#accordion1_7)
|
||||
|
||||
* 监测预期效果:记录符合配置条件的HTTP流量监测日志。
|
||||
* 阻断预期效果:阻断符合配置条件的HTTP访问,即访问页面无响应,并记录阻断日志。
|
||||
45
src/main/webapp/online-help/ntc/Mail.md
Normal file
45
src/main/webapp/online-help/ntc/Mail.md
Normal file
@@ -0,0 +1,45 @@
|
||||
#### [0.功能简介](#accordion1_0)
|
||||
|
||||
本页面完成针对Mail流量的配置,从而对包含特定IP、收发件人特征的Mail流量进行监测或阻断。
|
||||
|
||||
#### [1.配置基础信息](#accordion1_1)
|
||||
|
||||
配置基础信息包括:规则名称,执行动作,是否记录管控日志。
|
||||
|
||||
* 规则名称:用户自定义的该条配置的描述信息。
|
||||
* 执行动作:配置施加于网络传输单元时,对网络流量施加什么样的动作,此处为阻断、监测二选一。
|
||||
* 是否记录日志:对网络流量施加执行动作时,是否记录命中Mail协议配置的流量信息,包括发现时间、IP、收发件人等。
|
||||
|
||||
#### [2.业务配置属性](#accordion1_2)
|
||||
|
||||
MAIL协议管控的流量属性信息:
|
||||
|
||||
* Mail头部关键词:匹配字段选择,例如发件人From与收件人To;关键字填写;匹配方式选择,例如子串匹配、前缀匹配、后缀匹配与精确匹配;是否二进制选择(此处是指关键字内容是否为二进制原始码流,选择是,则关键字处填写十六进制数);是否大小写敏感选择。
|
||||
* IP:选择IP类型、协议、IP模式、端口模式,并且填写对应的具体IP与端口值,选择匹配方向是单向还是双向匹配。
|
||||
* Subscribe ID:IP地址对应的用户信息关键字,子串匹配,非二进制,大小写不敏感。
|
||||
|
||||
#### [3.配置约束条件](#accordion1_3)
|
||||
|
||||
MAIL协议管控配置的属性信息:
|
||||
|
||||
* 客户端IP:合法的单IP;IP段只能配置x.x.x.0-x.x.x.255;IP/mask中mask值限制为16-32。
|
||||
* 客户端端口:端口与端口掩码范围是0-65535。
|
||||
* 服务端IP:合法的单IP;IP段只能配置x.x.x.0-x.x.x.255;IP/mask中mask值限制为16-32。
|
||||
* 服务端端口:端口与端口掩码范围是0-65535。
|
||||
* 另:客户端IP与服务端IP不能相同。
|
||||
|
||||
#### [4.生效区域](#accordion1_5)
|
||||
|
||||
配置的生效区域,生效区域包括地区,以及ISP,地区和ISP可组合,即某个地区的某个运营商流量生效, 或者某个地区的所有流量生效,或者某个运营商的所有流量生效,也可全域生效。
|
||||
|
||||
#### [5.配置标签](#accordion1_6)
|
||||
|
||||
* 来函:必选项,官方或其他组织下达的配置流量管控依据
|
||||
* 分类:非必选项,配置分类,例如内容安全、网络攻击等。
|
||||
* 性质:非必选项,配置性质,例如政治、暴力、宗教等。
|
||||
* 标签:非必选项,自定义标签。
|
||||
|
||||
#### [6.预期效果](#accordion1_7)
|
||||
|
||||
* 监测预期效果:记录符合配置条件的Mail流量监测日志。
|
||||
* 阻断预期效果:阻断符合配置条件的Mail邮件,即该邮件无法正常发送或接收,并记录阻断日志。
|
||||
46
src/main/webapp/online-help/ntc/Mail_advanced.md
Normal file
46
src/main/webapp/online-help/ntc/Mail_advanced.md
Normal file
@@ -0,0 +1,46 @@
|
||||
#### [0.功能简介](#accordion1_0)
|
||||
|
||||
本页面完成针对Mail流量的扩展配置,从而对包含特定IP、收发件人、主题或邮件正文特征的Mail流量进行监测或阻断。
|
||||
|
||||
#### [1.配置基础信息](#accordion1_1)
|
||||
|
||||
配置基础信息包括:规则名称,执行动作,是否记录管控日志。
|
||||
|
||||
* 规则名称:用户自定义的该条配置的描述信息。
|
||||
* 执行动作:配置施加于网络传输单元时,对网络流量施加什么样的动作,此处为阻断、监测二选一。
|
||||
* 是否记录日志:对网络流量施加执行动作时,是否记录命中Mail协议扩展配置的流量信息,包括发现时间、IP、收发件人等。
|
||||
|
||||
#### [2.业务配置属性](#accordion1_2)
|
||||
|
||||
MAIL协议扩展管控的流量属性信息:
|
||||
|
||||
* Mail头部关键词:匹配字段选择,例如发件人From、收件人To、主题;关键字填写;匹配方式选择,例如子串匹配、前缀匹配、后缀匹配与精确匹配;是否二进制选择(此处是指关键字内容是否为二进制原始码流,选择是,则关键字处填写十六进制数);是否大小写敏感选择。
|
||||
* Mail正文关键词:匹配字段选择,例如正文内容、附件名称、附件内容;关键字填写;匹配方式选择,例如子串匹配、前缀匹配、后缀匹配与精确匹配;是否二进制选择(此处是指关键字内容是否为二进制原始码流,选择是,则关键字处填写十六进制数);是否大小写敏感选择。
|
||||
* IP:选择IP类型、协议、IP模式、端口模式,并且填写对应的具体IP与端口值,选择匹配方向是单向还是双向匹配。
|
||||
* Subscribe ID:IP地址对应的用户信息关键字,子串匹配,非二进制,大小写不敏感。
|
||||
|
||||
#### [3.配置约束条件](#accordion1_3)
|
||||
|
||||
MAIL协议管控配置的属性信息:
|
||||
|
||||
* 客户端IP:合法的单IP;IP段只能配置x.x.x.0-x.x.x.255;IP/mask中mask值限制为16-32。
|
||||
* 客户端端口:端口与端口掩码范围是0-65535。
|
||||
* 服务端IP:合法的单IP;IP段只能配置x.x.x.0-x.x.x.255;IP/mask中mask值限制为16-32。
|
||||
* 服务端端口:端口与端口掩码范围是0-65535。
|
||||
* 另:客户端IP与服务端IP不能相同。
|
||||
|
||||
#### [4.配置生效区域](#accordion1_5)
|
||||
|
||||
配置的生效区域,生效区域包括地区,以及ISP,地区和ISP可组合,即某个地区的某个运营商流量生效, 或者某个地区的所有流量生效,或者某个运营商的所有流量生效,也可全域生效。
|
||||
|
||||
#### [5.配置标签](#accordion1_6)
|
||||
|
||||
* 来函:必选项,官方或其他组织下达的配置流量管控依据
|
||||
* 分类:非必选项,配置分类,例如内容安全、网络攻击等。
|
||||
* 性质:非必选项,配置性质,例如政治、暴力、宗教等。
|
||||
* 标签:非必选项,自定义标签。
|
||||
|
||||
#### [6.预期效果](#accordion1_7)
|
||||
|
||||
* 监测预期效果:记录符合配置条件的Mail流量监测日志。
|
||||
* 阻断预期效果:阻断符合配置条件的Mail邮件,即该邮件无法正常发送或接收,并记录阻断日志。
|
||||
47
src/main/webapp/online-help/ntc/SSL.md
Normal file
47
src/main/webapp/online-help/ntc/SSL.md
Normal file
@@ -0,0 +1,47 @@
|
||||
#### [0.功能简介](#accordion1_0)
|
||||
|
||||
本页面完成针对SSL流量的配置,从而对包含特定IP、SNI、SAN或CN特征的SSL流量进行监测或阻断。
|
||||
|
||||
#### [1.配置基础信息](#accordion1_1)
|
||||
|
||||
配置基础信息包括:规则名称,执行动作,是否记录管控日志。
|
||||
|
||||
* 规则名称:用户自定义的该条配置的描述信息。
|
||||
* 执行动作:配置施加于网络传输单元时,对网络流量施加什么样的动作,此处为阻断、监测二选一。
|
||||
* 是否记录日志:对网络流量施加执行动作时,是否记录命中SSL协议配置的流量信息,包括发现时间、IP、SNI、SAN、CN等。
|
||||
|
||||
#### [2.业务配置属性](#accordion1_2)
|
||||
|
||||
SSL协议管控的流量属性信息:
|
||||
|
||||
* SNI:SSL请求服务器名称指示关键词。关键字填写;匹配方式选择,例如子串匹配、前缀匹配、后缀匹配与精确匹配;是否二进制选择(此处是指关键字内容是否为二进制原始码流,选择是,则关键字处填写十六进制数);是否大小写敏感选择。
|
||||
* SAN:SSL域名主体替代名称关键词。关键字填写;匹配方式选择,例如子串匹配、前缀匹配、后缀匹配与精确匹配;是否二进制选择(此处是指关键字内容是否为二进制原始码流,选择是,则关键字处填写十六进制数);是否大小写敏感选择。
|
||||
* CN:SSL域名通用名关键词。关键字填写;匹配方式选择,例如子串匹配、前缀匹配、后缀匹配与精确匹配;是否二进制选择(此处是指关键字内容是否为二进制原始码流);是否大小写敏感选择。
|
||||
* IP:选择IP类型、协议、IP模式、端口模式,并且填写对应的具体IP与端口值,选择匹配方向是单向还是双向匹配。
|
||||
* Subscribe ID:IP地址对应的用户信息关键字,子串匹配,非二进制,大小写不敏感。
|
||||
|
||||
#### [3.配置约束条件](#accordion1_3)
|
||||
|
||||
SSL协议管控配置的属性信息:
|
||||
|
||||
* 客户端IP:合法的单IP;IP段只能配置x.x.x.0-x.x.x.255;IP/mask中mask值限制为16-32。
|
||||
* 客户端端口:端口与端口掩码范围是0-65535。
|
||||
* 服务端IP:合法的单IP;IP段只能配置x.x.x.0-x.x.x.255;IP/mask中mask值限制为16-32。
|
||||
* 服务端端口:端口与端口掩码范围是0-65535。
|
||||
* 另:客户端IP与服务端IP不能相同。
|
||||
|
||||
#### [4.配置生效区域](#accordion1_5)
|
||||
|
||||
配置的生效区域,生效区域包括地区,以及ISP,地区和ISP可组合,即某个地区的某个运营商流量生效, 或者某个地区的所有流量生效,或者某个运营商的所有流量生效,也可全域生效。
|
||||
|
||||
#### [5.配置标签](#accordion1_6)
|
||||
|
||||
* 来函:必选项,官方或其他组织下达的配置流量管控依据
|
||||
* 分类:非必选项,配置分类,例如内容安全、网络攻击等。
|
||||
* 性质:非必选项,配置性质,例如政治、暴力、宗教等。
|
||||
* 标签:非必选项,自定义标签。
|
||||
|
||||
#### [6.预期效果](#accordion1_7)
|
||||
|
||||
* 监测预期效果:记录符合配置条件的SSL流量监测日志。
|
||||
* 阻断预期效果:阻断符合配置条件的SSL网络流量,例如阻止某次特定HTTPS访问,并记录阻断日志。
|
||||
46
src/main/webapp/online-help/ntc/ip_address.md
Normal file
46
src/main/webapp/online-help/ntc/ip_address.md
Normal file
@@ -0,0 +1,46 @@
|
||||
#### [0.功能简介](#accordion1_0)
|
||||
|
||||
本页面完成对网络流量IP特征的配置,对包含特定IP特征的流量进行阻断、监测、丢弃或限速。
|
||||
|
||||
#### [1.配置基础信息](#accordion1_1)
|
||||
|
||||
配置基础信息包括:规则名称,执行动作,是否记录管控日志。
|
||||
|
||||
* 规则名称:用户自定义的该条配置的描述信息。
|
||||
* 执行动作:配置施加于网络传输单元时,对网络流量施加什么样的动作,此处为阻断、监测、丢弃、限速四选一。
|
||||
* 是否记录日志:对网络流量施加执行动作时,是否命中IP配置的网络流量信息,包括发现时间、IP、端口等。
|
||||
|
||||
#### [2.业务配置属性](#accordion1_2)
|
||||
|
||||
IP地址管控的流量属性信息:
|
||||
|
||||
* IP:选择IP类型、协议、IP模式、端口模式,并且填写对应的具体IP与端口值,选择匹配方向是单向还是双向匹配。
|
||||
* ASN:自治系统号选择,可以选择下拉菜单中的自治系统。
|
||||
|
||||
#### [3.配置约束条件](#accordion1_3)
|
||||
|
||||
IP管控配置的属性信息:
|
||||
|
||||
* 客户端IP:合法的单IP;IP段只能配置x.x.x.0-x.x.x.255;IP/mask中mask值限制为16-32。
|
||||
* 客户端端口:端口与端口掩码范围是0-65535。
|
||||
* 服务端IP:合法的单IP;IP段只能配置x.x.x.0-x.x.x.255;IP/mask中mask值限制为16-32。
|
||||
* 服务端端口:端口与端口掩码范围是0-65535。
|
||||
* 另:客户端IP与服务端IP不能相同。
|
||||
|
||||
#### [4.配置生效区域](#accordion1_5)
|
||||
|
||||
配置的生效区域,生效区域包括地区,以及ISP,地区和ISP可组合,即某个地区的某个运营商流量生效, 或者某个地区的所有流量生效,或者某个运营商的所有流量生效,也可全域生效。
|
||||
|
||||
#### [5.配置标签](#accordion1_6)
|
||||
|
||||
* 来函:必选项,官方或其他组织下达的配置流量管控依据
|
||||
* 分类:非必选项,配置分类,例如内容安全、网络攻击等。
|
||||
* 性质:非必选项,配置性质,例如政治、暴力、宗教等。
|
||||
* 标签:非必选项,自定义标签。
|
||||
|
||||
#### [6.预期效果](#accordion1_7)
|
||||
|
||||
* 监测预期效果:记录符合配置条件的IP监测流量日志。
|
||||
* 阻断预期效果:阻断承载于配置IP或IP组之上的TCP流量,即发送TCP的RST报文,并记录阻断日志。
|
||||
* 限速预期效果:限制承载于配置IP或IP组之上网络流量的传输速率。
|
||||
* 丢弃预期效果:丢弃承载于配置IP或IP组之上的网络流量报文,使得目的端无法收到报文。
|
||||
34
src/main/webapp/online-help/ntc/ip_white_list.md
Normal file
34
src/main/webapp/online-help/ntc/ip_white_list.md
Normal file
@@ -0,0 +1,34 @@
|
||||
#### [0.功能简介](#accordion1_0)
|
||||
|
||||
本页面完成针对网络流量的IP白名单配置,将特定IP或IP组设置为白名单。
|
||||
|
||||
#### [1.配置基础信息](#accordion1_1)
|
||||
|
||||
配置基础信息包括:规则名称,执行动作。
|
||||
|
||||
* 规则名称:用户自定义的该条配置的描述信息。
|
||||
* 执行动作:配置施加于网络传输单元时,对网络流量施加什么样的动作,此处为单一选项白名单。
|
||||
|
||||
#### [2.业务配置属性](#accordion1_2)
|
||||
|
||||
此处指流量的IP属性:即配置特定IP为白名单。
|
||||
|
||||
* IP Type:IP类型,可以选择IPv4或者IPv6。
|
||||
* IP Pattern:IP配置模式,可以选择特定IP、IP段或者IP掩码三种模式。
|
||||
* Client IP:具体的IP白名单配置。
|
||||
|
||||
#### [3.配置约束条件](#accordion1_3)
|
||||
|
||||
IP白名单配置的属性信息:
|
||||
|
||||
* 客户端IP:合法的单IP;IP段只能配置x.x.x.0-x.x.x.255;IP/mask中mask值限制为16-32。
|
||||
* 客户端端口:端口与端口掩码范围是0-65535。
|
||||
* 服务端IP:合法的单IP;IP段只能配置x.x.x.0-x.x.x.255;IP/mask中mask值限制为16-32。
|
||||
* 服务端端口:端口与端口掩码范围是0-65535。
|
||||
* 另:客户端IP与服务端IP不能相同。
|
||||
|
||||
#### [4.配置标签](#accordion1_6)
|
||||
|
||||
#### [5.预期效果](#accordion1_7)
|
||||
|
||||
设置为白名单的IP或IP组上的网络流量不受其他配置的控制与影响,其上所有网络行为皆可正常无虞。
|
||||
54
src/main/webapp/online-help/ntc/p2p.md
Normal file
54
src/main/webapp/online-help/ntc/p2p.md
Normal file
@@ -0,0 +1,54 @@
|
||||
#### [0.功能简介](#accordion1_0)
|
||||
|
||||
本页面完成针对P2P流量(包括EMULE协议与BT协议)的配置,从而对包含特定IP、EMULE搜索关键词与文件标识的P2P流量进行监测或阻断。
|
||||
|
||||
#### [1.配置基础信息](#accordion1_1)
|
||||
|
||||
配置基础信息包括:规则名称,执行动作,是否记录管控日志。
|
||||
|
||||
* 规则名称:用户自定义的该条配置的描述信息。
|
||||
* 执行动作:配置施加于网络传输单元时,对网络流量施加什么样的动作,此处为阻断、监测二选一。
|
||||
* 是否记录日志:对网络流量施加执行动作时,是否记录命中配置的P2P流量信息,包括发现时间、IP、文件标识等。
|
||||
|
||||
#### [2.业务配置属性](#accordion1_2)
|
||||
|
||||
P2P协议扩展管控的流量属性信息:
|
||||
|
||||
* EMULE 搜索关键词:关键字填写;匹配方式选择,例如子串匹配、前缀匹配、后缀匹配与精确匹配;是否二进制选择(此处是指关键字内容是否为二进制原始码流,选择是,则关键字处填写十六进制数);是否大小写敏感选择。
|
||||
* 文件标识:首先选择标识类型,BT INFO 或者EMULE fileid;关键字填写十六进制数标识;匹配方式选择,例如子串匹配、前缀匹配、后缀匹配与精确匹配;是二进制;大小写敏感。
|
||||
* IP:IP配置类型,EMULE SERVER、BT TRACKER分别为客户端与EMULE、BT服务器的通信,EMULE NODE、BT NODE分别为客户端与客户端之间的通信,IP配置类型四选一;选择IP类型、协议与客户端与服务端的IP模式、端口模式,并且填写对应的具体IP与端口值,选择匹配方向是单向还是双向匹配。
|
||||
* Subscribe ID:IP地址对应的用户信息关键字。关键字填写;子串匹配,非二进制,大小写不敏感。
|
||||
|
||||
#### [3.配置约束条件](#accordion1_3)
|
||||
|
||||
P2P协议管控配置的属性信息:
|
||||
|
||||
* BT INFO:长度不超过20Byte。
|
||||
* EMULE Fileid:长度不超过16Byte。
|
||||
* 客户端IP:合法的单IP;IP段只能配置x.x.x.0-x.x.x.255;IP/mask中mask值限制为16-32。
|
||||
* 客户端端口:端口与端口掩码范围是0-65535。
|
||||
* 服务端IP:合法的单IP;IP段只能配置x.x.x.0-x.x.x.255;IP/mask中mask值限制为16-32。
|
||||
* 服务端端口:端口与端口掩码范围是0-65535。
|
||||
* 另:客户端IP与服务端IP不能相同。
|
||||
|
||||
#### [4.配置生效区域](#accordion1_5)
|
||||
|
||||
配置的生效区域,生效区域包括地区,以及ISP,地区和ISP可组合,即某个地区的某个运营商流量生效, 或者某个地区的所有流量生效,或者某个运营商的所有流量生效,也可全域生效。
|
||||
|
||||
#### [5.配置标签](#accordion1_6)
|
||||
|
||||
* 来函:必选项,官方或其他组织下达的配置流量管控依据
|
||||
* 分类:非必选项,配置分类,例如内容安全、网络攻击等。
|
||||
* 性质:非必选项,配置性质,例如政治、暴力、宗教等。
|
||||
* 标签:非必选项,自定义标签。
|
||||
|
||||
#### [6.预期效果](#accordion1_7)
|
||||
|
||||
* IP封堵效果:BT客户端(关闭utp及DHT相关设置)新添加的种子文件速度为0;Emule客户端(关闭迷惑协议)新添加的下载文件速度为0,Emule客户端服务器(不包括KAD网络)连接失败,无法进行Servers搜索。
|
||||
* IP监测效果:BT返回该链接含有的infohash值,Emule返回该链接含有的fileid和keywordhash或搜素关键词等信息。
|
||||
* BT INFOHASH封堵:客户端中对应要封堵的INFOHASH无下载速度(需先下配置,再新建bt下载任务),如果选择记录日志,则返回相应的INFOHASH封堵日志。
|
||||
* BT INFOHASH监测:客户端中对应监测INFOHASH无影响(需先下配置,再新建bt下载任务),返回对应的INFOHASH监测日志。
|
||||
* EMULE FILEID封堵:客户端中对应要封堵的FILEID无下载速度(需先下配置,再新建文件下载任务),如果选择记录日志,则返回相应的EMULE封堵日志。
|
||||
* EMULE FILEID监测:客户端中对应监测FILEID无影响(需先下配置,再新建文件下载任务),返回对应的监测日志。
|
||||
* EMULE搜索关键词命中封堵配置时,显示搜索结果列表为空,返回相应的EMULE封堵日志。
|
||||
* EMULE搜索关键词命中监测配置时,对搜索结果没有影响,界面返回实际对应的搜索关键词信息。
|
||||
45
src/main/webapp/online-help/ntc/stream_media.md
Normal file
45
src/main/webapp/online-help/ntc/stream_media.md
Normal file
@@ -0,0 +1,45 @@
|
||||
#### [0.功能简介](#accordion1_0)
|
||||
|
||||
本页面完成针对流媒体流量(包括 RTSP协议与RTMP协议)的配置,从而对包含特定IP或URL特征的流媒体流量进行监测或阻断。
|
||||
|
||||
#### [1.配置基础信息](#accordion1_1)
|
||||
|
||||
配置基础信息包括:规则名称,执行动作,是否记录管控日志。
|
||||
|
||||
* 规则名称:用户自定义的该条配置的描述信息。
|
||||
* 执行动作:配置施加于网络传输单元时,对网络流量施加什么样的动作,此处为阻断、监测二选一。
|
||||
* 是否记录日志:对网络流量施加执行动作时,是否记录命中流媒体配置的流量信息,包括发现时间、IP、URL等。
|
||||
|
||||
#### [2.业务配置属性](#accordion1_2)
|
||||
|
||||
流媒体协议扩展管控的流量属性信息:
|
||||
|
||||
* URL:流媒体的URL。关键字填写;匹配方式选择,例如子串匹配、前缀匹配、后缀匹配与精确匹配;非二进制;大小写不敏感。
|
||||
* IP:选择IP类型、协议、IP模式、端口模式,并且填写对应的具体IP与端口值,选择匹配方向是单向还是双向匹配。
|
||||
* Subscribe ID:IP地址对应的用户信息关键字,子串匹配,非二进制,大小写不敏感。
|
||||
|
||||
#### [3.配置约束条件](#accordion1_3)
|
||||
|
||||
流媒体协议管控配置的属性信息:
|
||||
|
||||
* 客户端IP:合法的单IP;IP段只能配置x.x.x.0-x.x.x.255;IP/mask中mask值限制为16-32。
|
||||
* 客户端端口:端口与端口掩码范围是0-65535。
|
||||
* 服务端IP:合法的单IP;IP段只能配置x.x.x.0-x.x.x.255;IP/mask中mask值限制为16-32。
|
||||
* 服务端端口:端口与端口掩码范围是0-65535。
|
||||
* 另:客户端IP与服务端IP不能相同。
|
||||
|
||||
#### [4.生效区域](#accordion1_5)
|
||||
|
||||
配置的生效区域,生效区域包括地区,以及ISP,地区和ISP可组合,即某个地区的某个运营商流量生效, 或者某个地区的所有流量生效,或者某个运营商的所有流量生效,也可全域生效。
|
||||
|
||||
#### [5.配置标签](#accordion1_6)
|
||||
|
||||
* 来函:必选项,官方或其他组织下达的配置流量管控依据
|
||||
* 分类:非必选项,配置分类,例如内容安全、网络攻击等。
|
||||
* 性质:非必选项,配置性质,例如政治、暴力、宗教等。
|
||||
* 标签:非必选项,自定义标签。
|
||||
|
||||
#### [6.预期效果](#accordion1_7)
|
||||
|
||||
* 监测预期效果:记录符合配置条件的流媒体流量监测日志。
|
||||
* 阻断预期效果:阻断符合配置条件的流媒体流量,即客户端无法正常访问并播放该流媒体音视频内容,并记录阻断日志。
|
||||
46
src/main/webapp/online-help/ntc/voip.md
Normal file
46
src/main/webapp/online-help/ntc/voip.md
Normal file
@@ -0,0 +1,46 @@
|
||||
#### [0.功能简介](#accordion1_0)
|
||||
|
||||
本页面完成针对VoIP流量(包括SIP协议与RTP协议)的配置,从而对包含特定IP、VoIP账号特征的VoIP流量进行监测或阻断。
|
||||
|
||||
#### [1.配置基础信息](#accordion1_1)
|
||||
|
||||
配置基础信息包括:规则名称,执行动作,是否记录管控日志。
|
||||
|
||||
* 规则名称:用户自定义的该条配置的描述信息。
|
||||
* 执行动作:配置施加于网络传输单元时,对网络流量施加什么样的动作,此处为阻断、监测二选一。
|
||||
* 是否记录日志:对网络流量施加执行动作时,是否记录命中配置的VoIP流量信息,包括发现时间、IP、VoIP主被叫账号、通话语音等。
|
||||
|
||||
#### [2.业务配置属性](#accordion1_2)
|
||||
|
||||
VoIP协议扩展管控的流量属性信息:
|
||||
|
||||
* VoIP账号:关键字填写;匹配方式选择,例如子串匹配、前缀匹配、后缀匹配与精确匹配;是否二进制选择(此处是指关键字内容是否为二进制原始码流,选择是,则关键字处填写十六进制数);是否大小写敏感选择。
|
||||
* IP:选择IP类型、协议与客户端与服务端的IP模式、端口模式,并且填写对应的具体IP与端口值,选择匹配方向是单向还是双向匹配。
|
||||
* Subscribe ID:IP地址对应的用户信息关键字。关键字填写;子串匹配,非二进制,大小写不敏感。
|
||||
|
||||
#### [3.配置约束条件](#accordion1_3)
|
||||
|
||||
VoIP协议管控配置的属性信息:
|
||||
|
||||
* VoIP账号:长度不超过1500Byte。
|
||||
* 客户端IP:合法的单IP;IP段只能配置x.x.x.0-x.x.x.255;IP/mask中mask值限制为16-32。
|
||||
* 客户端端口:端口与端口掩码范围是0-65535。
|
||||
* 服务端IP:合法的单IP;IP段只能配置x.x.x.0-x.x.x.255;IP/mask中mask值限制为16-32。
|
||||
* 服务端端口:端口与端口掩码范围是0-65535。
|
||||
* 另:客户端IP与服务端IP不能相同。
|
||||
|
||||
#### [4.配置生效区域](#accordion1_5)
|
||||
|
||||
配置的生效区域,生效区域包括地区,以及ISP,地区和ISP可组合,即某个地区的某个运营商流量生效, 或者某个地区的所有流量生效,或者某个运营商的所有流量生效,也可全域生效。
|
||||
|
||||
#### [5.配置标签](#accordion1_6)
|
||||
|
||||
* 来函:必选项,官方或其他组织下达的配置流量管控依据
|
||||
* 分类:非必选项,配置分类,例如内容安全、网络攻击等。
|
||||
* 性质:非必选项,配置性质,例如政治、暴力、宗教等。
|
||||
* 标签:非必选项,自定义标签。
|
||||
|
||||
#### [6.预期效果](#accordion1_7)
|
||||
|
||||
* 监测预期效果:记录符合配置条件的VoIP流量监测日志。
|
||||
* 阻断预期效果:阻断符合配置条件的VoIP通话,即客户端无法拨通本次VoIP电话,客户端与服务端均收到挂断、通话超时、服务器异常的虚假报文,并记录阻断日志。
|
||||
32
src/main/webapp/online-help/proxy/cache_policy.md
Normal file
32
src/main/webapp/online-help/proxy/cache_policy.md
Normal file
@@ -0,0 +1,32 @@
|
||||
#### [1.Function Introduction](#accordion1_1)
|
||||
|
||||
On National Proxy System, Individual Cache policy rules determine whether to cache or not based on traffic attributes, such as URL and Cookies.
|
||||
|
||||
#### [2.Action](#accordion1_2)
|
||||
|
||||
For cache action, the optimization parameters are:
|
||||
|
||||
* A Cache key:is a unique string that lets the National Proxy System look for web content when requests hit them. It’s made up of a hostname, path, and cookie parts. By default, the Proxy use the entire URL as the cache key. Selecting the correct cache key will ensure maximum cache footprint and increase cache hits.
|
||||
* Ignore Query String in URL:in case the query strings doesn’t actually indicate that the object need to be different then you could EXCLUDE them from the cache key. For example, after ignoring “sqp” and “rs” of URL: “https://example.com/pic.jpg?sqp=UAAI&rs=AOn4”.
|
||||
* Include Cookie Values:in case the server send different content for the same URL based on the cookie value, you can include that cookie value as a part of cache key. For example, the server may set a cookie at the client called "prefLang=ru" to record user preferred language, you could add "prefLang" to distinguish different web content.
|
||||
* Disable Revalidate:is an ON-OFF switch. The pragma-no-cache header in a client’s request causes the proxy to re-fetch the entire object from the original server, even if the cached copy of the object is fresh. By default this option is switch OFF, which means a client’s non-conditional request results in a conditional GET request sent to the original server if the object is already in cache. The conditional request allows the original server to return the 304 Not Modified response, if the content in cache is still fresh. Thereby, the server-side bandwidth and latency consumed are lesser as the full content is not retrieved again from the original server.
|
||||
* Cache Dynamic Content:is an ON-OFF switch. A URL is considered dynamic if it ends in “.asp(x)” or contains a question mark (?), a semicolon (;), or “cgi”. Ignore Query String overrides this option (switch on).
|
||||
* Cache Cookied Content:is an ON-OFF switch. By default, the Proxy does NOT cache cookied content of any type. If this option is switch on, the system cache all Cookeid content except HTML.
|
||||
* Ignore Request no-cache Headers:is an ON-OFF switch. By default, the proxy strictly observes client Cache-Control: no-cache directives. As known as:
|
||||
* i. Authorization
|
||||
* ii. WWW-Authenticate
|
||||
* iii. Cache-Control: no-store
|
||||
* iv. Cache-Control: no-cache
|
||||
* If a requested object contains a no-cache header, then proxy forwards the request to the origin server even if it has a fresh copy in cache. You can configure proxy to ignore client no-cache directives such that it ignores no-cache headers from client requests and serves the object from its cache. Ignore Response no-cache Headers — is an ON-OFF switch. By default, a response from an origin server with a no-cache header is not stored in the cache. As known as:
|
||||
* i. Cache-Control: no-store
|
||||
* ii. Cache-Control: private
|
||||
* iii. Set-Cookie
|
||||
* iv. Cache-Control: no-cache
|
||||
* v. WWW-Authenticate
|
||||
* vi. Expires header with a value of 0 (zero) or a past date.If you configure proxy to ignore no-cache headers, then proxy also ignores no-store headers. The default behavior of observing no-cache directives is appropriate in most cases.
|
||||
* Forcing Object Caching: is an ON-OFF switch. You can force Proxy to cache specific URLs (including dynamic URLs) for a specified duration, regardless of Cache-Control response headers.
|
||||
* Minimum Use: sets the number of times an item must be requested by clients before Proxy caches it. This is useful if the cache is constantly filling up, as it ensures that only the most frequently accessed items are added to the cache. By default, Proxy cache object at its first appearance. The Counter resets in every 30 minutes. Note that the requests is counted in computing unit independently.
|
||||
* Max Cache Object Size: sets the upper limit of an object size, larger object will not be cached. By default, Proxy does not cache object larger than 1 GB.
|
||||
* Cache Pinning Time: configures Proxy to keep certain objects in the cache for a specified time. You can use this option to ensure that the most popular objects are in cache when needed and to prevent cache manager from deleting important objects. Proxy observes Cache-Control headers and pins an object in the cache only if it is indeed cacheable.
|
||||
* Max Cache Size: sets the upper limit of the size of storage for a policy. By default, Proxy uses all available disk space. When the cache size reaches the limit, the cache manager removes the files that were least recently used to bring the cache size back under the limit.
|
||||
* Inactive Time: specifies how long an item can remain in the cache without being accessed. A file that has not been requested for this time is automatically deleted from the cache by the cache manager, regardless of whether or not it has expired.
|
||||
24
src/main/webapp/online-help/proxy/control_policy.md
Normal file
24
src/main/webapp/online-help/proxy/control_policy.md
Normal file
@@ -0,0 +1,24 @@
|
||||
#### [1.Function Introduction](#accordion1_1)
|
||||
|
||||
On National Proxy System, Individual Control policy rules determine whether to allow, block, redirect or replace a session based on traffic attributes, such as URL, request header fields, request body keywords, response header fields, response body keywords, IP address, Subscribe ID and their combination. You could specify these attributes in the submenu of Control Policy.
|
||||
|
||||
#### [2.Action](#accordion1_2)
|
||||
|
||||
You could select one of the five actions for above attributes, as known as:
|
||||
|
||||
* Monitor:the Proxy produce a log to record matched HTTP session information.
|
||||
* Block:the Proxy terminate matched HTTP session with an error page and produce a log. You MUST specify a Response Code and a Response Content to generate an error page.
|
||||
* Redirect: the Proxy redirect matched HTTP session to a predefined URL. Since redirection need to be performed before delivering response to client, condition of response body is not applicable in this action. You MUST configure the redirect response via Response Code and Response URL. The Response URL MUST start with a scheme (http:// or https://). You SHOULD NOT select 301 as Response Code unless you exactly know what you are doing. This action produces a log.
|
||||
* Replace:the Proxy Searches in a given HTTP part to Find a given string, and Replace any matches with another given string. If no match was found, the session remained untouched. For performance concerns, condition of request body and response body is not available in this action. For example, you can configure the Proxy to search in the response body of URL “www.example.com/index.html”, find every “string1” and replace with “string2”. This action produces a log.
|
||||
* Whitelist:the Proxy pass-through the matched sessions and produce no log.
|
||||
* In case of HTTP session matches one more policies, the priority order is Whitelist > Reject > Redirect > Replace > Monitor, action with higher priority overrides others.
|
||||
|
||||
#### [3.Attibutes](#accordion1_3)
|
||||
|
||||
The attributes are detailed in following context:
|
||||
|
||||
* URL:From proxy’s perspective, a HTTP URL consists of a hierarchical sequence of three components: URL = hostname/path\[?query\] . The URL path name can also be specified by the user in the local writing system. If not already encoded, it is converted to UTF-8, and any characters not part of the basic URL character set are escaped as hexadecimal using percent-encoding; for example, search keywords “русский” in Google produces URL: https://www.google.com/search?q=%D1%80%D1%83%D1%81%D1%81%D0%BA%D0%B8%D0%B9 To perform policy action on above URL, you could input the whole URL in the input box. Or, you could input original keywords and let the Proxy do the decoding, e.g. “google.com/search” & “русский”. Note that the scheme string MUST be excluded from the URL, it’s “https://” in this case.
|
||||
* Request Header: is used to set conditions on request header fields. Header fields are colon-separated key-value pairs in clear-text string format, terminated by a carriage return (CR) and line feed (LF) character sequence. For example, “user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64)“ is a header filed in request header. The Matching District is used to configure the field’s key, if the key was presented, the Proxy will search in the value for Keywords.
|
||||
* Response Header: is used to set conditions on response header fields. Its configuration is similar to Request Header.
|
||||
* Request Body:is used to set conditions on request’s body message. The Proxy searches the pre-configured Keywords in it. You can configure non-ASCII or non-utf8 keywords by turn on HEX.
|
||||
* Response Body:is used to set conditions on response’s body message. Its configuration is similar to Request Body.
|
||||
34
src/main/webapp/online-help/proxy/domain_intercept_policy.md
Normal file
34
src/main/webapp/online-help/proxy/domain_intercept_policy.md
Normal file
@@ -0,0 +1,34 @@
|
||||
#### [1.功能简介](#accordion1_1)
|
||||
|
||||
域名拦截主要是根据域名对网站进行拦截,主要分为域名监测,域名白名单和域名限速功能,匹配的方式为子串匹配。当检测到请求的url中包含有配置的域名,根据上述三个功能,进行相应的替换替换,证书不替换和,限速功能。
|
||||
|
||||
#### [2\. 基础配置信息](#accordion1_2)
|
||||
|
||||
* 域名:监测网站的域名,或是域名的子串
|
||||
|
||||
#### [3\. 业务配置属性](#accordion1_2)
|
||||
|
||||
* 域名:请求URL中的域名,或是URL中域名的子串
|
||||
* 限速:对被测机器限制网速,根据配置的数值比列丢包
|
||||
|
||||
#### [4.配置约束条件](#accordion1_4)
|
||||
|
||||
* 域名:配置的监测域名,合法的域名表示
|
||||
* 丢包率:在0.001-0.009之间
|
||||
|
||||
#### [5.预期效果](#accordion1_5)
|
||||
|
||||
* 黑名单:浏览器证书替换
|
||||
* 白名单:浏览器证书不替换
|
||||
* 限速:测试有等比例接近的丢包
|
||||
|
||||
#### [6.配置生效区域](#accordion1_6)
|
||||
|
||||
配置的生效区域,生效区域包括地区,以及ISP,地区和ISP可组合,即某个地区的某个运营商流量生效, 或者某个地区的所有流量生效,或者某个运营商的所有流量生效,也可全域生效
|
||||
|
||||
#### [7.配置标签](#accordion1_7)
|
||||
|
||||
* 来函:必选项,官方或其他组织下达的配置流量管控依据。
|
||||
* 分类:非必选项,配置分类,例如内容安全、网络攻击等。
|
||||
* 性质:非必选项,配置性质,例如政治、暴力、宗教等。
|
||||
* 标签:非必选项,自定义标签。
|
||||
71
src/main/webapp/online-help/proxy/https_block_log.md
Normal file
71
src/main/webapp/online-help/proxy/https_block_log.md
Normal file
@@ -0,0 +1,71 @@
|
||||
#### [1.基础信息](#accordion1_1)
|
||||
|
||||
Proxy日志按照控制策略类型进行分类,分为HTTP(S)监测、HTTP(S)管控、HTTP(S)重定向配置、HTTP(S)替换。每类日志页面下有两个基础搜索选项:开始时间、结束时间。和三个功能按钮搜:搜索、重置、筛选和右侧的设置按钮。
|
||||
|
||||
* 选项名称:开始时间-
|
||||
* 执行动作:点击“开始时间”可以选择搜索日志的时间范围。时间选项中有当前时间的日历和时间表,以确定具体的筛选时间,下方三个选项“clear”表示清空当前选择、“Today”表示将选择时间定为当前时间,“OK”表示确认。确认时间范围后,搜索结果将返回时间范围内的满足搜索条件的HTTP(S)管控日志
|
||||
|
||||
* 选项名称:结束时间-
|
||||
* 执行动作:点击“结束时间”可以选择搜索日志的时间范围。时间选项中有当前时间的日历和时间表,以确定具体的筛选时间,下方三个选项“clear”表示清空当前选择、“Today”表示将选择时间定为当前时间,“OK”表示确认。确认时间范围后,搜索结果将返回时间范围内的满足搜索条件的HTTP(S)管控日志
|
||||
|
||||
* 选项名称:搜索-
|
||||
* 执行动作:点击“搜索”,将返回满足时间范围和筛选条件内的HTTP(S)重定向日志
|
||||
|
||||
* 选项名称:重置-
|
||||
* 执行动作:点击“重置”,将筛选条件和开始时间结束时间清空
|
||||
|
||||
* 选项名称:筛选-
|
||||
* 执行动作:点击“筛选”,扩展日志筛选条件。eg.传输层协议、传输方向等
|
||||
|
||||
* 选项名称:筛选-
|
||||
* 执行动作:点击“筛选”,选择查询结果输出的日志信息项
|
||||
|
||||
#### [2.拓展筛选项](#accordion1_3)
|
||||
|
||||
点开筛选按钮后,会出现扩展搜索选项:传输层协议、传输方向、出入口、处理机IP、源IP、目的IP和配置ID。
|
||||
|
||||
* 选项名称:传输层协议-
|
||||
* 执行动作:点击“筛选”——>选择“传输层协议”,可以选择:L2TP、IPv4\_UDP、IPv6、IPv6\_UDP、OpenVPN、MAC、MPLS、IPv4\_TCP、IPv4、IPv6\_TCP、PPTP、VLAN、GRE。确认筛选的传输层协议后,搜索结果将返回选定时间范围内的对应协议的HTTP(S)管控日志,不做选择时默认所有协议
|
||||
|
||||
* 选项名称:传输方向-
|
||||
* 执行动作:点击“筛选”——>选择“传输方向”,可以选择:境内、境外。境内表示触发规则的源IP为内部IP,境外表示触发规则的源IP为外部IP。确认筛选的传输方向后,搜索结果将返回选定时间范围内的对应传输方向的HTTP(S)重定向日志,不做选择时默认境内外
|
||||
|
||||
* 选项名称:出入口-
|
||||
* 执行动作:点击“筛选”——>选择“出入口”。暂时不支持该功能
|
||||
|
||||
* 选项名称:处理机IP-
|
||||
* 执行动作:点击“筛选”——>选择“处理机IP”,输入筛选的处理机IP地址,支持IPv4和IPv6,IPv4输入“IPv4 xxx”,IPv输入“IPv6 xxx”(xxx为对应IP地址),eg."IPv4 192.168.17.3"、"IPv6 fc00::1:1f"。确认筛选的处理机IP后,搜索结果将返回选定时间范围内的对应处理机IP的HTTP(S)管控日志,不做选择时默认所有IP
|
||||
|
||||
* 选项名称:源IP-
|
||||
* 执行动作:点击“筛选”——>选择“源IP”,输入筛选的源IP地址,支持IPv4和IPv6,IPv4输入“IPv4 xxx”,IPv输入“IPv6 xxx”(xxx为对应IP地址),eg."IPv4 192.168.17.3"、"IPv6 fc00::1:1f"。确认筛选的源IP后,搜索结果将返回选定时间范围内的对应源IP的HTTP(S)管控日志,不做选择时默认所有IP
|
||||
|
||||
* 选项名称:目的IP-
|
||||
* 执行动作:点击“筛选”——>选择“目的IP”,输入筛选的目的IP地址,支持IPv4和IPv6,IPv4输入“IPv4 xxx”,IPv输入“IPv6 xxx”(xxx为对应IP地址),eg."IPv4 192.168.17.3"、"IPv6 fc00::1:1f"。确认筛选的目的IP后,搜索结果将返回选定时间范围内的对应目的IP的HTTP(S)管控日志,不做选择时默认所有IP
|
||||
|
||||
* 选项名称:配置ID-
|
||||
* 执行动作:点击“筛选”——>选择“配置ID”,输入筛选的配置ID。确认筛选的目的IP后,搜索结果将返回选定时间范围内的对应配置ID的HTTP(S)重定向日志,不做选择时默认所有配置
|
||||
|
||||
#### [3.日志信息标签:配置ID、发现时间、出入口、URL、处理机IP、传输层协议、源目的IP端口等](#accordion1_2)
|
||||
|
||||
此处对日志信息每项标签做解析,帮助使用人员理解日志具体信息: Proxy在命中记录日志的控制策略时将会产生相应的日志信息,命中配置的消息日志信息包括:配置ID、发现时间、出入口、URL、处理机IP、传输层协议、目的IP、源IP、目的端口、源端口、串联设备、方向、流类型、服务端地址、客户端地址、客户端ASN、服务端ASN、客户端用户名、服务端用户名、现场日志文件地址。
|
||||
|
||||
* 配置ID:命中配置的配置ID
|
||||
* 发现时间:命中规则的时间
|
||||
* 出入口:暂不支持
|
||||
* URL:命中配置的URL
|
||||
* 处理机IP:处理这条命中规则的服务器IP
|
||||
* 传输层协议:这条消息的传输层协议
|
||||
* 目的IP:命中配置的连接的目的IP
|
||||
* 源IP:命中配置的连接的源IP
|
||||
* 目的端口:命中配置的连接的目的端口
|
||||
* 源端口:命中配置的连接的源端口
|
||||
* 串联设备:暂不支持
|
||||
* 方向:该日志是传输方向--境内/境外
|
||||
* 流类型:该流是单向或双向流
|
||||
* 服务端地址:该流服务端所在的地理区域,eg.Hong Kong、United States
|
||||
* 客户端地址:该流客户端所在的地理区域,eg.Hong Kong、United States
|
||||
* 客户端ASN:客户端的ASN号(自治系统号)
|
||||
* 服务端ASN:服务端的ASN号(自治系统号)
|
||||
* 客户端用户名:客户端账户的用户名
|
||||
* 服务端用户名:服务端账户的用户名
|
||||
* 现场日志文件地址:该日志保存的地址
|
||||
49
src/main/webapp/online-help/proxy/https_block_policy.md
Normal file
49
src/main/webapp/online-help/proxy/https_block_policy.md
Normal file
@@ -0,0 +1,49 @@
|
||||
#### [1.功能简介](#accordion1_1)
|
||||
|
||||
HTTP(s)阻断主要的功能是实现浏览器无法访问网站。当配置的测试机的IP地址等信息后,被测机器无法访问网站,阻断上网的功能,主要包括IP阻断,URL阻断,请求头域阻断,应答头域阻断,请求内容阻断,应答内容阻断,账号阻断
|
||||
|
||||
#### [2.基础配置信息](#accordion1_2)
|
||||
|
||||
* IP:同“IP拦截”
|
||||
* HTTP URL:“同域名拦截”
|
||||
* HTTP 请求头域:同“HTTP(s)监测”
|
||||
* HTTP 应答头域:同“HTTP(s)监测”
|
||||
* HTTP 请求内容:同“HTTP(s)监测”
|
||||
* HTTP 应答内容:同“HTTP(s)监测”
|
||||
* 账号:同“HTTP(s)监测”
|
||||
|
||||
#### [2.业务配置属性](#accordion1_3)
|
||||
|
||||
* IP:同“HTTP(s)监测”
|
||||
* HTTP URL:同“HTTP(s)监测”
|
||||
* HTTP 请求头域:同“HTTP(s)监测”
|
||||
* HTTP 应答头域:同“HTTP(s)监测”
|
||||
* HTTP 请求内容:同“HTTP(s)监测”
|
||||
* HTTP 应答内容:同“HTTP(s)监测”
|
||||
* 账号:同“HTTP(s)监测”
|
||||
|
||||
#### [4.配置约束条件](#accordion1_4)
|
||||
|
||||
* IP:同“IP拦截”
|
||||
* URL:同“域名拦截”
|
||||
* HTTP 请求头:同“HTTP(s)监测”
|
||||
* HTTP 应答头:同“HTTP(s)监测”
|
||||
* HTTP 请求内容:同“HTTP(s)监测”
|
||||
* HTTP 应答内容:同“HTTP(s)监测”
|
||||
* 账号:同“HTTP(s)监测”
|
||||
|
||||
#### [5.预期效果](#accordion1_5)
|
||||
|
||||
* 阻断效果:浏览器无法访问页面
|
||||
* 日志检查:生成日志
|
||||
|
||||
#### [6.配置生效区域](#accordion1_6)
|
||||
|
||||
配置的生效区域,生效区域包括地区,以及ISP,地区和ISP可组合,即某个地区的某个运营商流量生效, 或者某个地区的所有流量生效,或者某个运营商的所有流量生效,也可全域生效
|
||||
|
||||
#### [7.配置标签](#accordion1_7)
|
||||
|
||||
* 来函:必选项,官方或其他组织下达的配置流量管控依据。
|
||||
* 分类:非必选项,配置分类,例如内容安全、网络攻击等。
|
||||
* 性质:非必选项,配置性质,例如政治、暴力、宗教等。
|
||||
* 标签:非必选项,自定义标签。
|
||||
71
src/main/webapp/online-help/proxy/https_monitor_log.md
Normal file
71
src/main/webapp/online-help/proxy/https_monitor_log.md
Normal file
@@ -0,0 +1,71 @@
|
||||
#### [1.基础信息](#accordion1_1)
|
||||
|
||||
Proxy日志按照控制策略类型进行分类,分为HTTP(S)监测、HTTP(S)管控、HTTP(S)重定向配置、HTTP(S)替换。每类日志页面下有两个基础搜索选项:开始时间、结束时间。和三个功能按钮搜:搜索、重置、筛选和右侧的设置按钮。
|
||||
|
||||
* 选项名称:开始时间-
|
||||
* 执行动作:点击“开始时间”可以选择搜索日志的时间范围。时间选项中有当前时间的日历和时间表,以确定具体的筛选时间,下方三个选项“clear”表示清空当前选择、“Today”表示将选择时间定为当前时间,“OK”表示确认。确认时间范围后,搜索结果将返回时间范围内的满足搜索条件的HTTP(S)监测日志
|
||||
|
||||
* 选项名称:结束时间-
|
||||
* 执行动作:点击“结束时间”可以选择搜索日志的时间范围。时间选项中有当前时间的日历和时间表,以确定具体的筛选时间,下方三个选项“clear”表示清空当前选择、“Today”表示将选择时间定为当前时间,“OK”表示确认。确认时间范围后,搜索结果将返回时间范围内的满足搜索条件的HTTP(S)监测日志
|
||||
|
||||
* 选项名称:搜索-
|
||||
* 执行动作:点击“搜索”,将返回满足时间范围和筛选条件内的HTTP(S)监测日志
|
||||
|
||||
* 选项名称:重置-
|
||||
* 执行动作:点击“重置”,将筛选条件和开始时间结束时间清空
|
||||
|
||||
* 选项名称:筛选-
|
||||
* 执行动作:点击“筛选”,扩展日志筛选条件。eg.传输层协议、传输方向等
|
||||
|
||||
* 选项名称:筛选-
|
||||
* 执行动作:点击“筛选”,选择查询结果输出的日志信息项
|
||||
|
||||
#### [2.拓展筛选项](#accordion1_3)
|
||||
|
||||
点开筛选按钮后,会出现扩展搜索选项:传输层协议、传输方向、出入口、处理机IP、源IP、目的IP和配置ID。
|
||||
|
||||
* 选项名称:传输层协议-
|
||||
* 执行动作:点击“筛选”——>选择“传输层协议”,可以选择:L2TP、IPv4\_UDP、IPv6、IPv6\_UDP、OpenVPN、MAC、MPLS、IPv4\_TCP、IPv4、IPv6\_TCP、PPTP、VLAN、GRE。确认筛选的传输层协议后,搜索结果将返回选定时间范围内的对应协议的HTTP(S)监测日志,不做选择时默认所有协议
|
||||
|
||||
* 选项名称:传输方向-
|
||||
* 执行动作:点击“筛选”——>选择“传输方向”,可以选择:境内、境外。境内表示触发规则的源IP为内部IP,境外表示触发规则的源IP为外部IP。确认筛选的传输方向后,搜索结果将返回选定时间范围内的对应传输方向的HTTP(S)监测日志,不做选择时默认境内外
|
||||
|
||||
* 选项名称:出入口-
|
||||
* 执行动作:点击“筛选”——>选择“出入口”。暂时不支持该功能
|
||||
|
||||
* 选项名称:处理机IP-
|
||||
* 执行动作:点击“筛选”——>选择“处理机IP”,输入筛选的处理机IP地址,支持IPv4和IPv6,IPv4输入“IPv4 xxx”,IPv输入“IPv6 xxx”(xxx为对应IP地址),eg."IPv4 192.168.17.3"、"IPv6 fc00::1:1f"。确认筛选的处理机IP后,搜索结果将返回选定时间范围内的对应处理机IP的HTTP(S)监测日志,不做选择时默认所有IP
|
||||
|
||||
* 选项名称:源IP-
|
||||
* 执行动作:点击“筛选”——>选择“源IP”,输入筛选的源IP地址,支持IPv4和IPv6,IPv4输入“IPv4 xxx”,IPv输入“IPv6 xxx”(xxx为对应IP地址),eg."IPv4 192.168.17.3"、"IPv6 fc00::1:1f"。确认筛选的源IP后,搜索结果将返回选定时间范围内的对应源IP的HTTP(S)监测日志,不做选择时默认所有IP
|
||||
|
||||
* 选项名称:目的IP-
|
||||
* 执行动作:点击“筛选”——>选择“目的IP”,输入筛选的目的IP地址,支持IPv4和IPv6,IPv4输入“IPv4 xxx”,IPv输入“IPv6 xxx”(xxx为对应IP地址),eg."IPv4 192.168.17.3"、"IPv6 fc00::1:1f"。确认筛选的目的IP后,搜索结果将返回选定时间范围内的对应目的IP的HTTP(S)监测日志,不做选择时默认所有IP
|
||||
|
||||
* 选项名称:配置ID-
|
||||
* 执行动作:点击“筛选”——>选择“配置ID”,输入筛选的配置ID。确认筛选的目的IP后,搜索结果将返回选定时间范围内的对应配置ID的HTTP(S)监测日志,不做选择时默认所有配置
|
||||
|
||||
#### [3.日志信息标签:配置ID、发现时间、出入口、URL、处理机IP、传输层协议、源目的IP端口等](#accordion1_2)
|
||||
|
||||
此处对日志信息每项标签做解析,帮助使用人员理解日志具体信息: Proxy在命中记录日志的控制策略时将会产生相应的日志信息,命中配置的消息日志信息包括:配置ID、发现时间、出入口、URL、处理机IP、传输层协议、目的IP、源IP、目的端口、源端口、串联设备、方向、流类型、服务端地址、客户端地址、客户端ASN、服务端ASN、客户端用户名、服务端用户名、现场日志文件地址。
|
||||
|
||||
* 配置ID:命中配置的配置ID
|
||||
* 发现时间:命中规则的时间
|
||||
* 出入口:暂不支持
|
||||
* URL:命中配置的URL
|
||||
* 处理机IP:处理这条命中规则的服务器IP
|
||||
* 传输层协议:这条消息的传输层协议
|
||||
* 目的IP:命中配置的连接的目的IP
|
||||
* 源IP:命中配置的连接的源IP
|
||||
* 目的端口:命中配置的连接的目的端口
|
||||
* 源端口:命中配置的连接的源端口
|
||||
* 串联设备:暂不支持
|
||||
* 方向:该日志是传输方向--境内/境外
|
||||
* 流类型:该流是单向或双向流
|
||||
* 服务端地址:该流服务端所在的地理区域,eg.Hong Kong、United States
|
||||
* 客户端地址:该流客户端所在的地理区域,eg.Hong Kong、United States
|
||||
* 客户端ASN:客户端的ASN号(自治系统号)
|
||||
* 服务端ASN:服务端的ASN号(自治系统号)
|
||||
* 客户端用户名:客户端账户的用户名
|
||||
* 服务端用户名:服务端账户的用户名
|
||||
* 现场日志文件地址:该日志保存的地址
|
||||
52
src/main/webapp/online-help/proxy/https_monitor_policy.md
Normal file
52
src/main/webapp/online-help/proxy/https_monitor_policy.md
Normal file
@@ -0,0 +1,52 @@
|
||||
#### [1.功能简介](#accordion1_1)
|
||||
|
||||
HTTP(s)监测与IP监测的功能类似,额外增加了其他的监测,主要包括URL监测,请求头域监测,应答头域监测,请求内容监测,应答内容监测,账号监测。
|
||||
|
||||
#### [2.基础配置信息](#accordion1_2)
|
||||
|
||||
* IP:同“IP拦截”
|
||||
* HTTP URL:同“域名拦截”
|
||||
* HTTP 请求头域:HTTP发送请求的头域信息
|
||||
* HTTP 应答头域:HTTP应答的头域信息
|
||||
* HTTP 请求内容:HTTP请求体中的内容
|
||||
* HTTP 应答内容:HTTP 响应体的内容
|
||||
* 账号:上网登陆账号
|
||||
|
||||
#### [3.业务配置属性](#accordion1_3)
|
||||
|
||||
* IP:同“IP拦截”
|
||||
* 端口:同“IP拦截”
|
||||
* HTTP URL:同“域名拦截”
|
||||
* URL:同“域名拦截”
|
||||
* HTTP 请求头域:浏览器发送头信息的请求头,其中包括请求方法
|
||||
* HTTP 应答头域:HTTP响应的头信息
|
||||
* HTTP 请求内容:HTTP请求体
|
||||
* HTTP 应答内容:HTTP响应体
|
||||
* 账号:拨号上网账号
|
||||
|
||||
#### [4.配置约束条件](#accordion1_4)
|
||||
|
||||
* IP:同“IP拦截”
|
||||
* 端口:同“IP拦截”
|
||||
* URL:配置的URL必须是可访问的
|
||||
* HTTP 请求头域:合法的请求头域
|
||||
* HTTP 应答头域:合法的应答头域
|
||||
* HTTP 请求内容:合法HTTP请求体
|
||||
* HTTP 应答内容:合法HTTP响应体
|
||||
* 账号:拨号上网的账号
|
||||
|
||||
#### [5.预期效果](#accordion1_5)
|
||||
|
||||
* 证书替换:浏览器的证书替换,有日志
|
||||
* 账号监测:检测到配置的账号,有日志
|
||||
|
||||
#### [6.配置生效区域](#accordion1_6)
|
||||
|
||||
配置的生效区域,生效区域包括地区,以及ISP,地区和ISP可组合,即某个地区的某个运营商流量生效, 或者某个地区的所有流量生效,或者某个运营商的所有流量生效,也可全域生效
|
||||
|
||||
#### [7.配置标签](#accordion1_7)
|
||||
|
||||
* 来函:必选项,官方或其他组织下达的配置流量管控依据。
|
||||
* 分类:非必选项,配置分类,例如内容安全、网络攻击等。
|
||||
* 性质:非必选项,配置性质,例如政治、暴力、宗教等。
|
||||
* 标签:非必选项,自定义标签。
|
||||
71
src/main/webapp/online-help/proxy/https_redirect_log.md
Normal file
71
src/main/webapp/online-help/proxy/https_redirect_log.md
Normal file
@@ -0,0 +1,71 @@
|
||||
#### [1.基础信息](#accordion1_1)
|
||||
|
||||
Proxy日志按照控制策略类型进行分类,分为HTTP(S)监测、HTTP(S)管控、HTTP(S)重定向配置、HTTP(S)替换。每类日志页面下有两个基础搜索选项:开始时间、结束时间。和三个功能按钮搜:搜索、重置、筛选和右侧的设置按钮。
|
||||
|
||||
* 选项名称:开始时间-
|
||||
* 执行动作:点击“开始时间”可以选择搜索日志的时间范围。时间选项中有当前时间的日历和时间表,以确定具体的筛选时间,下方三个选项“clear”表示清空当前选择、“Today”表示将选择时间定为当前时间,“OK”表示确认。确认时间范围后,搜索结果将返回时间范围内的满足搜索条件的HTTP(S)重定向配置日志
|
||||
|
||||
* 选项名称:结束时间-
|
||||
* 执行动作:点击“结束时间”可以选择搜索日志的时间范围。时间选项中有当前时间的日历和时间表,以确定具体的筛选时间,下方三个选项“clear”表示清空当前选择、“Today”表示将选择时间定为当前时间,“OK”表示确认。确认时间范围后,搜索结果将返回时间范围内的满足搜索条件的HTTP(S)重定向配置日志
|
||||
|
||||
* 选项名称:搜索-
|
||||
* 执行动作:点击“搜索”,将返回满足时间范围和筛选条件内的HTTP(S)重定向日志
|
||||
|
||||
* 选项名称:重置-
|
||||
* 执行动作:点击“重置”,将筛选条件和开始时间结束时间清空
|
||||
|
||||
* 选项名称:筛选-
|
||||
* 执行动作:点击“筛选”,扩展日志筛选条件。eg.传输层协议、传输方向等
|
||||
|
||||
* 选项名称:筛选-
|
||||
* 执行动作:点击“筛选”,选择查询结果输出的日志信息项
|
||||
|
||||
#### [2.拓展筛选项](#accordion1_3)
|
||||
|
||||
点开筛选按钮后,会出现扩展搜索选项:传输层协议、传输方向、出入口、处理机IP、源IP、目的IP和配置ID。
|
||||
|
||||
* 选项名称:传输层协议-
|
||||
* 执行动作:点击“筛选”——>选择“传输层协议”,可以选择:L2TP、IPv4\_UDP、IPv6、IPv6\_UDP、OpenVPN、MAC、MPLS、IPv4\_TCP、IPv4、IPv6\_TCP、PPTP、VLAN、GRE。确认筛选的传输层协议后,搜索结果将返回选定时间范围内的对应协议的HTTP(S)重定向配置日志,不做选择时默认所有协议
|
||||
|
||||
* 选项名称:传输方向-
|
||||
* 执行动作:点击“筛选”——>选择“传输方向”,可以选择:境内、境外。境内表示触发规则的源IP为内部IP,境外表示触发规则的源IP为外部IP。确认筛选的传输方向后,搜索结果将返回选定时间范围内的对应传输方向的HTTP(S)重定向日志,不做选择时默认境内外
|
||||
|
||||
* 选项名称:出入口-
|
||||
* 执行动作:点击“筛选”——>选择“出入口”。暂时不支持该功能
|
||||
|
||||
* 选项名称:处理机IP-
|
||||
* 执行动作:点击“筛选”——>选择“处理机IP”,输入筛选的处理机IP地址,支持IPv4和IPv6,IPv4输入“IPv4 xxx”,IPv输入“IPv6 xxx”(xxx为对应IP地址),eg."IPv4 192.168.17.3"、"IPv6 fc00::1:1f"。确认筛选的处理机IP后,搜索结果将返回选定时间范围内的对应处理机IP的HTTP(S)重定向配置日志,不做选择时默认所有IP
|
||||
|
||||
* 选项名称:源IP-
|
||||
* 执行动作:点击“筛选”——>选择“源IP”,输入筛选的源IP地址,支持IPv4和IPv6,IPv4输入“IPv4 xxx”,IPv输入“IPv6 xxx”(xxx为对应IP地址),eg."IPv4 192.168.17.3"、"IPv6 fc00::1:1f"。确认筛选的源IP后,搜索结果将返回选定时间范围内的对应源IP的HTTP(S)重定向配置日志,不做选择时默认所有IP
|
||||
|
||||
* 选项名称:目的IP-
|
||||
* 执行动作:点击“筛选”——>选择“目的IP”,输入筛选的目的IP地址,支持IPv4和IPv6,IPv4输入“IPv4 xxx”,IPv输入“IPv6 xxx”(xxx为对应IP地址),eg."IPv4 192.168.17.3"、"IPv6 fc00::1:1f"。确认筛选的目的IP后,搜索结果将返回选定时间范围内的对应目的IP的HTTP(S)重定向配置日志,不做选择时默认所有IP
|
||||
|
||||
* 选项名称:配置ID-
|
||||
* 执行动作:点击“筛选”——>选择“配置ID”,输入筛选的配置ID。确认筛选的目的IP后,搜索结果将返回选定时间范围内的对应配置ID的HTTP(S)重定向日志,不做选择时默认所有配置
|
||||
|
||||
#### [3.日志信息标签:配置ID、发现时间、出入口、URL、处理机IP、传输层协议、源目的IP端口等](#accordion1_2)
|
||||
|
||||
此处对日志信息每项标签做解析,帮助使用人员理解日志具体信息: Proxy在命中记录日志的控制策略时将会产生相应的日志信息,命中配置的消息日志信息包括:配置ID、发现时间、出入口、URL、处理机IP、传输层协议、目的IP、源IP、目的端口、源端口、串联设备、方向、流类型、服务端地址、客户端地址、客户端ASN、服务端ASN、客户端用户名、服务端用户名、现场日志文件地址。
|
||||
|
||||
* 配置ID:命中配置的配置ID
|
||||
* 发现时间:命中规则的时间
|
||||
* 出入口:暂不支持
|
||||
* URL:命中配置的URL
|
||||
* 处理机IP:处理这条命中规则的服务器IP
|
||||
* 传输层协议:这条消息的传输层协议
|
||||
* 目的IP:命中配置的连接的目的IP
|
||||
* 源IP:命中配置的连接的源IP
|
||||
* 目的端口:命中配置的连接的目的端口
|
||||
* 源端口:命中配置的连接的源端口
|
||||
* 串联设备:暂不支持
|
||||
* 方向:该日志是传输方向--境内/境外
|
||||
* 流类型:该流是单向或双向流
|
||||
* 服务端地址:该流服务端所在的地理区域,eg.Hong Kong、United States
|
||||
* 客户端地址:该流客户端所在的地理区域,eg.Hong Kong、United States
|
||||
* 客户端ASN:客户端的ASN号(自治系统号)
|
||||
* 服务端ASN:服务端的ASN号(自治系统号)
|
||||
* 客户端用户名:客户端账户的用户名
|
||||
* 服务端用户名:服务端账户的用户名
|
||||
* 现场日志文件地址:该日志保存的地址
|
||||
49
src/main/webapp/online-help/proxy/https_redirect_policy.md
Normal file
49
src/main/webapp/online-help/proxy/https_redirect_policy.md
Normal file
@@ -0,0 +1,49 @@
|
||||
#### [1.功能简介](#accordion1_1)
|
||||
|
||||
HTTP(s)重定向主要对将请求的页面根据配置的信息重定向到指定的网页,主要包括应答重定向,IP重定向,URL重定向,请求头域重定向和应答头域重定向,请求内容重定向,应答内容重定向,账号重定向。
|
||||
|
||||
#### [2.基础配置信息](#accordion1_2)
|
||||
|
||||
* IP:同“IP拦截”
|
||||
* HTTP URL:同“域名拦截”
|
||||
* HTTP 请求头域:同“HTTP(s)监测”
|
||||
* HTTP 应答头域:同“HTTP(s)监测”
|
||||
* HTTP 请求内容:同“HTTP(s)监测”
|
||||
* HTTP 应答内容:同“HTTP(s)监测”
|
||||
* 账号:同“HTTP(s)监测”
|
||||
|
||||
#### [3.业务配置属性](#accordion1_3)
|
||||
|
||||
* IP:同“IP拦截”
|
||||
* HTTP URL:同“域名拦截”
|
||||
* HTTP 请求头域:同“HTTP(s)监测”
|
||||
* HTTP 应答头域:同“HTTP(s)监测”
|
||||
* HTTP 请求内容:同“HTTP(s)监测”
|
||||
* HTTP 应答内容:同“HTTP(s)监测”
|
||||
* 账号:同“HTTP(s)监测”
|
||||
|
||||
#### [4.配置约束条件](#accordion1_4)
|
||||
|
||||
* IP:同“IP拦截”
|
||||
* HTTP URL:同“域名拦截”
|
||||
* HTTP 请求头域:同“HTTP(s)监测”
|
||||
* HTTP 应答头域:同“HTTP(s)监测”
|
||||
* HTTP 请求内容:同“HTTP(s)监测”
|
||||
* HTTP 应答内容:同“HTTP(s)监测”
|
||||
* 账号:同“HTTP(s)监测”
|
||||
|
||||
#### [5.预期效果](#accordion1_5)
|
||||
|
||||
* 页面重定向:浏览器重定向到指定的页面
|
||||
* 日志:生成日志
|
||||
|
||||
#### [6.配置生效区域](#accordion1_6)
|
||||
|
||||
配置的生效区域,生效区域包括地区,以及ISP,地区和ISP可组合,即某个地区的某个运营商流量生效, 或者某个地区的所有流量生效,或者某个运营商的所有流量生效,也可全域生效
|
||||
|
||||
#### [7.配置标签](#accordion1_7)
|
||||
|
||||
* 来函:必选项,官方或其他组织下达的配置流量管控依据。
|
||||
* 分类:非必选项,配置分类,例如内容安全、网络攻击等。
|
||||
* 性质:非必选项,配置性质,例如政治、暴力、宗教等。
|
||||
* 标签:非必选项,自定义标签。
|
||||
71
src/main/webapp/online-help/proxy/https_replace_log.md
Normal file
71
src/main/webapp/online-help/proxy/https_replace_log.md
Normal file
@@ -0,0 +1,71 @@
|
||||
#### [1.基础信息](#accordion1_1)
|
||||
|
||||
Proxy日志按照控制策略类型进行分类,分为HTTP(S)监测、HTTP(S)管控、HTTP(S)重定向配置、HTTP(S)替换。每类日志页面下有两个基础搜索选项:开始时间、结束时间。和三个功能按钮搜:搜索、重置、筛选和右侧的设置按钮。
|
||||
|
||||
* 选项名称:开始时间-
|
||||
* 执行动作:点击“开始时间”可以选择搜索日志的时间范围。时间选项中有当前时间的日历和时间表,以确定具体的筛选时间,下方三个选项“clear”表示清空当前选择、“Today”表示将选择时间定为当前时间,“OK”表示确认。确认时间范围后,搜索结果将返回时间范围内的满足搜索条件的HTTP(S)替换日志
|
||||
|
||||
* 选项名称:结束时间-
|
||||
* 执行动作:点击“结束时间”可以选择搜索日志的时间范围。时间选项中有当前时间的日历和时间表,以确定具体的筛选时间,下方三个选项“clear”表示清空当前选择、“Today”表示将选择时间定为当前时间,“OK”表示确认。确认时间范围后,搜索结果将返回时间范围内的满足搜索条件的HTTP(S)替换日志
|
||||
|
||||
* 选项名称:搜索-
|
||||
* 执行动作:点击“搜索”,将返回满足时间范围和筛选条件内的HTTP(S)重定向日志
|
||||
|
||||
* 选项名称:重置-
|
||||
* 执行动作:点击“重置”,将筛选条件和开始时间结束时间清空
|
||||
|
||||
* 选项名称:筛选-
|
||||
* 执行动作:点击“筛选”,扩展日志筛选条件。eg.传输层协议、传输方向等
|
||||
|
||||
* 选项名称:筛选-
|
||||
* 执行动作:点击“筛选”,选择查询结果输出的日志信息项
|
||||
|
||||
#### [2.拓展筛选项](#accordion1_3)
|
||||
|
||||
点开筛选按钮后,会出现扩展搜索选项:传输层协议、传输方向、出入口、处理机IP、源IP、目的IP和配置ID。
|
||||
|
||||
* 选项名称:传输层协议-
|
||||
* 执行动作:点击“筛选”——>选择“传输层协议”,可以选择:L2TP、IPv4\_UDP、IPv6、IPv6\_UDP、OpenVPN、MAC、MPLS、IPv4\_TCP、IPv4、IPv6\_TCP、PPTP、VLAN、GRE。确认筛选的传输层协议后,搜索结果将返回选定时间范围内的对应协议的HTTP(S)替换日志,不做选择时默认所有协议
|
||||
|
||||
* 选项名称:传输方向-
|
||||
* 执行动作:点击“筛选”——>选择“传输方向”,可以选择:境内、境外。境内表示触发规则的源IP为内部IP,境外表示触发规则的源IP为外部IP。确认筛选的传输方向后,搜索结果将返回选定时间范围内的对应传输方向的HTTP(S)重定向日志,不做选择时默认境内外
|
||||
|
||||
* 选项名称:出入口-
|
||||
* 执行动作:点击“筛选”——>选择“出入口”。暂时不支持该功能
|
||||
|
||||
* 选项名称:处理机IP-
|
||||
* 执行动作:点击“筛选”——>选择“处理机IP”,输入筛选的处理机IP地址,支持IPv4和IPv6,IPv4输入“IPv4 xxx”,IPv输入“IPv6 xxx”(xxx为对应IP地址),eg."IPv4 192.168.17.3"、"IPv6 fc00::1:1f"。确认筛选的处理机IP后,搜索结果将返回选定时间范围内的对应处理机IP的HTTP(S)替换日志,不做选择时默认所有IP
|
||||
|
||||
* 选项名称:源IP-
|
||||
* 执行动作:点击“筛选”——>选择“源IP”,输入筛选的源IP地址,支持IPv4和IPv6,IPv4输入“IPv4 xxx”,IPv输入“IPv6 xxx”(xxx为对应IP地址),eg."IPv4 192.168.17.3"、"IPv6 fc00::1:1f"。确认筛选的源IP后,搜索结果将返回选定时间范围内的对应源IP的HTTP(S)替换日志,不做选择时默认所有IP
|
||||
|
||||
* 选项名称:目的IP-
|
||||
* 执行动作:点击“筛选”——>选择“目的IP”,输入筛选的目的IP地址,支持IPv4和IPv6,IPv4输入“IPv4 xxx”,IPv输入“IPv6 xxx”(xxx为对应IP地址),eg."IPv4 192.168.17.3"、"IPv6 fc00::1:1f"。确认筛选的目的IP后,搜索结果将返回选定时间范围内的对应目的IP的HTTP(S)替换日志,不做选择时默认所有IP
|
||||
|
||||
* 选项名称:配置ID-
|
||||
* 执行动作:点击“筛选”——>选择“配置ID”,输入筛选的配置ID。确认筛选的目的IP后,搜索结果将返回选定时间范围内的对应配置ID的HTTP(S)重定向日志,不做选择时默认所有配置
|
||||
|
||||
#### [3.日志信息标签:配置ID、发现时间、出入口、URL、处理机IP、传输层协议、源目的IP端口等](#accordion1_2)
|
||||
|
||||
此处对日志信息每项标签做解析,帮助使用人员理解日志具体信息: Proxy在命中记录日志的控制策略时将会产生相应的日志信息,命中配置的消息日志信息包括:配置ID、发现时间、出入口、URL、处理机IP、传输层协议、目的IP、源IP、目的端口、源端口、串联设备、方向、流类型、服务端地址、客户端地址、客户端ASN、服务端ASN、客户端用户名、服务端用户名、现场日志文件地址。
|
||||
|
||||
* 配置ID:命中配置的配置ID
|
||||
* 发现时间:命中规则的时间
|
||||
* 出入口:暂不支持
|
||||
* URL:命中配置的URL
|
||||
* 处理机IP:处理这条命中规则的服务器IP
|
||||
* 传输层协议:这条消息的传输层协议
|
||||
* 目的IP:命中配置的连接的目的IP
|
||||
* 源IP:命中配置的连接的源IP
|
||||
* 目的端口:命中配置的连接的目的端口
|
||||
* 源端口:命中配置的连接的源端口
|
||||
* 串联设备:暂不支持
|
||||
* 方向:该日志是传输方向--境内/境外
|
||||
* 流类型:该流是单向或双向流
|
||||
* 服务端地址:该流服务端所在的地理区域,eg.Hong Kong、United States
|
||||
* 客户端地址:该流客户端所在的地理区域,eg.Hong Kong、United States
|
||||
* 客户端ASN:客户端的ASN号(自治系统号)
|
||||
* 服务端ASN:服务端的ASN号(自治系统号)
|
||||
* 客户端用户名:客户端账户的用户名
|
||||
* 服务端用户名:服务端账户的用户名
|
||||
* 现场日志文件地址:该日志保存的地址
|
||||
43
src/main/webapp/online-help/proxy/https_replace_policy.md
Normal file
43
src/main/webapp/online-help/proxy/https_replace_policy.md
Normal file
@@ -0,0 +1,43 @@
|
||||
#### [1.功能简介](#accordion1_1)
|
||||
|
||||
HTTP(s)替换的主要功能是将访问网站的应答内容替换为配置的内容,主要包括IP替换,URL替换,请求头域替换和应答头域替换,账号替换
|
||||
|
||||
#### [2.基础配置信息](#accordion1_2)
|
||||
|
||||
* IP:同“IP拦截”
|
||||
* HTTP URL:同“域名拦截”
|
||||
* HTTP 请求头域:同“HTTP(s)监测”
|
||||
* HTTP 应答头域:同“HTTP(s)监测”
|
||||
* 账号:同“HTTP(s)监测”
|
||||
|
||||
#### [3.业务配置属性](#accordion1_2)
|
||||
|
||||
* IP:同“IP拦截”
|
||||
* HTTP URL:同“域名拦截”
|
||||
* HTTP 请求头域:同“HTTP(s)监测”
|
||||
* HTTP 应答头域:同“HTTP(s)监测”
|
||||
* 账号:同“HTTP(s)监测”
|
||||
|
||||
#### [4.配置约束条件](#accordion1_3)
|
||||
|
||||
* IP:同“IP拦截”
|
||||
* HTTP URL:同“域名拦截”
|
||||
* HTTP 请求头域:同“HTTP(s)监测”
|
||||
* HTTP 应答头域:同“HTTP(s)监测”
|
||||
* 账号:同“HTTP(s)监测”
|
||||
|
||||
#### [5.预期效果](#accordion1_4)
|
||||
|
||||
* 证书检查:浏览器的证书被替换
|
||||
* 日志检查:产生日志信息
|
||||
|
||||
#### [6.配置生效区域](#accordion1_5)
|
||||
|
||||
配置的生效区域,生效区域包括地区,以及ISP,地区和ISP可组合,即某个地区的某个运营商流量生效, 或者某个地区的所有流量生效,或者某个运营商的所有流量生效,也可全域生效
|
||||
|
||||
#### [7.配置标签](#accordion1_6)
|
||||
|
||||
* 来函:必选项,官方或其他组织下达的配置流量管控依据。
|
||||
* 分类:非必选项,配置分类,例如内容安全、网络攻击等。
|
||||
* 性质:非必选项,配置性质,例如政治、暴力、宗教等。
|
||||
* 标签:非必选项,自定义标签。
|
||||
39
src/main/webapp/online-help/proxy/https_whiteList_policy.md
Normal file
39
src/main/webapp/online-help/proxy/https_whiteList_policy.md
Normal file
@@ -0,0 +1,39 @@
|
||||
#### [1.功能简介](#accordion1_1)
|
||||
|
||||
HTTP(s)白名单主要是对访问的网站进行拦截,但是不替换证书,从而不解析网站的加密流量,主要包括IP拦截白名单,URL白名单,请求头域白名单,账号白名单
|
||||
|
||||
#### [2.基础配置信息](#accordion1_2)
|
||||
|
||||
* IP:同“IP拦截”
|
||||
* HTTP URL:同“域名拦截”
|
||||
* HTTP 请求头域:同“HTTP(s)监测”
|
||||
* 账号:同“HTTP(s)监测”
|
||||
|
||||
#### [3.业务配置属性](#accordion1_2)
|
||||
|
||||
* IP:同“IP拦截”
|
||||
* HTTP URL:同“域名拦截”
|
||||
* HTTP 请求头域:同“HTTP(s)监测”
|
||||
* 账号:同“HTTP(s)监测”
|
||||
|
||||
#### [4.配置约束条件](#accordion1_3)
|
||||
|
||||
* IP:同“IP拦截”
|
||||
* HTTP URL:同“域名拦截”
|
||||
* HTTP 请求头域:同“HTTP(s)监测”
|
||||
* 账号:同“HTTP(s)监测”
|
||||
|
||||
#### [5.预期效果](#accordion1_4)
|
||||
|
||||
* 证书检查:证书未替换
|
||||
|
||||
#### [6.配置生效区域](#accordion1_5)
|
||||
|
||||
配置的生效区域,生效区域包括地区,以及ISP,地区和ISP可组合,即某个地区的某个运营商流量生效, 或者某个地区的所有流量生效,或者某个运营商的所有流量生效,也可全域生效
|
||||
|
||||
#### [7.配置标签](#accordion1_6)
|
||||
|
||||
* 来函:官方或其他组织下达的配置流量管控依据
|
||||
* 分类:配置所属的类别
|
||||
* 性质:配置所属的性质
|
||||
* 标签:配置所属的标签
|
||||
19
src/main/webapp/online-help/proxy/intercept_policy.md
Normal file
19
src/main/webapp/online-help/proxy/intercept_policy.md
Normal file
@@ -0,0 +1,19 @@
|
||||
#### [1.Function Introduction](#accordion1_1)
|
||||
|
||||
On National Proxy System, Individual Intercept policy rules determines whether to intercept/optimize a connection based on traffic attributes, such as IP address, domain name and Subscribe ID. You could specify these attributes in IP Intercept and Domain Intercept.
|
||||
|
||||
#### [2.Action](#accordion1_2)
|
||||
|
||||
Both IP intercept and Domain Intercept are subject two actions:
|
||||
|
||||
* Bypass: the Proxy passes through the network connection without apply an optimization or policy checking. It’s could be used to bypass SSL pinning applications, such as Apple Store and WhatsApp, or a of a VIP’s IP address. In case of traffic matches one more policies, bypass overrides intercept.
|
||||
* Intercept: the National Proxy System intercepts network traffic for further control policy and cache policy checking. When a connection is set to intercept, the proxy terminates the connection and initiates a new connection between client and server. If the connection is SSL encrypted, the original certificate is replaced with a substitute one.
|
||||
|
||||
When Intercept Related Domains is enabled, domains that share one certificates with the specified domain are considered as the same. For example, if the intercept facebook.com with Intercept Related Domain option, then *.xx.fbcdn.net, fb.com, .messenger.com and etc. are also intercepted. There may be side effects that intercept many different websites when they were hosted in a same CDN provider (Content Delivery Network).
|
||||
|
||||
Key ring determines which certificate will be used to generate substitute certificate. You could configure key ring through Proxy Policy Object page. If no key ring is specified, proxy will use the default one.
|
||||
|
||||
Intercept policy produces no log. You can find out if the interception is successful by checking if the certificate is issued by your pre-configured Root CA. You need a PC which traffic has already directed to the Proxy, and a web browser to test the policy. For Chrome and Microsoft Internet Explorer, you could click the lock icon on the address bar to view certificate. For Firefox, after you clicking the lock icon, click “>” button to show connection details, click “more information”, and then click “view certificate”. If the browser warning that the connection is not secure, one possible reason is you haven’t install/trust the root certificate yet.
|
||||
|
||||
|
||||
### Note: You should exercise caution because web applications may not cooperate with SSL interception, such as SSL pinning, mutual authentication or non-standard SSL implementation.
|
||||
45
src/main/webapp/online-help/proxy/ip_intercept_policy.md
Normal file
45
src/main/webapp/online-help/proxy/ip_intercept_policy.md
Normal file
@@ -0,0 +1,45 @@
|
||||
#### [1.功能简介](#accordion1_1)
|
||||
|
||||
IP拦截主要用于配置拦截的IP地址和端口号,测试拦截的效果,其中包括拦截黑名单和拦截白名单,当选择黑名单,这配置了IP地址的被测机器的浏览器证书替换,当选择白名单,则浏览器的证书不会替换。拦截的端口一般配置为服务的端口。
|
||||
|
||||
#### [2.配置基础属性](#accordion1_2)
|
||||
|
||||
* 源IP:用户的IP地址
|
||||
* 目的IP:网络服务器的IP
|
||||
* 源端口:用户的端口
|
||||
* 目的端口:服务使用的端口
|
||||
* 端口掩码:使用掩码表示的端口
|
||||
* IP范围:表示一段范围内的IP地址
|
||||
* IP掩码:使用掩码方式表示的IP段地址
|
||||
|
||||
#### [3.业务配置属性](#accordion1_3)
|
||||
|
||||
* 源IP:报文中的源IP
|
||||
* 目的IP:报文中目的IP
|
||||
* 源端口:报文中的源端口
|
||||
* 目的端口:报文中的目的端口
|
||||
|
||||
#### [4.配置约束条件](#accordion1_4)
|
||||
|
||||
* 源IP:与目的IP不同,且合法
|
||||
* 源端口:在0——65535范围以内
|
||||
* 目的IP:与源IP不同,且合法
|
||||
* 目的端口:在0——65535范围以为
|
||||
* IP范围:x.x.x.0——x.x.x.255
|
||||
* IP掩码:x.x.x.x/mask,mask属于16—32
|
||||
|
||||
#### [5.预期效果](#accordion1_5)
|
||||
|
||||
* 黑名单:浏览器证书替换
|
||||
* 白名单:证书未替换
|
||||
|
||||
#### [6.配置生效区域](#accordion1_6)
|
||||
|
||||
配置的生效区域,生效区域包括地区,以及ISP,地区和ISP可组合,即某个地区的某个运营商流量生效, 或者某个地区的所有流量生效,或者某个运营商的所有流量生效,也可全域生效
|
||||
|
||||
#### [7.配置标签](#accordion1_7)
|
||||
|
||||
* 来函:必选项,官方或其他组织下达的配置流量管控依据。
|
||||
* 分类:非必选项,配置分类,例如内容安全、网络攻击等。
|
||||
* 性质:非必选项,配置性质,例如政治、暴力、宗教等。
|
||||
* 标签:非必选项,自定义标签。
|
||||
154
src/main/webapp/online-help/proxy/proxy_policy_object.md
Normal file
154
src/main/webapp/online-help/proxy/proxy_policy_object.md
Normal file
@@ -0,0 +1,154 @@
|
||||
#### [1.Function Introduction](#accordion1_1)
|
||||
|
||||
A policy object is a single object or a collective unit that groups discrete identities such as IP addresses, URLs, applications, or users. With policy objects that are a collective unit, you can reference the object in policy instead of manually selecting multiple objects one at a time. Typically, when creating a policy object, you group objects that require similar permissions in policy.
|
||||
|
||||
#### [2.Key Ring](#accordion1_2)
|
||||
|
||||
On National Proxy System, Key Ring is a pair of private key and public certificate. You can also import a certificate chain containing multiple certificates. Key Ring is a policy object, you can reference it in Intercept Policy. There are three Certificate Type:
|
||||
|
||||
* End-entity Certificate: is used for web servers to identify themselves. The Public Key File MUST be .p12 format that contains entire certificate chain. The Private Key File could be .pem, .key or .p12 format. This certificate type is not applicable to Domain Intercept for it cannot be used to sign other certificates. Expire After parameter is also not applicable to end-entity certificate for the same reason.
|
||||
* Intermedia Certificate: is used to sign other certificates. An intermediate certificate must be signed by another intermediate certificate, or a root certificate. The Public Key File MUST be .p12 format that contains entire certificate chain. The Expire After parameter indicates the expiration of the substitute certificate that was issued by this intermedia certificate.
|
||||
* Root Certificate: is used to sign other certificates. The Public Key File could be .der, .cer, .crt or .pem format. The Expire After parameter has the same meaning as Intermedia Certificate. Specification of certificate formats:
|
||||
* .pem- (Privacy-enhanced Electronic Mail) Base64 encoded DER certificate, enclosed between "-----BEGIN CERTIFICATE-----" and "-----END CERTIFICATE-----"
|
||||
* .cer, .crt, .der – usually in binary DER form, but Base64-encoded certificates are common too (see .pem above)
|
||||
* .p12 – PKCS#12, may contain certificate(s) (public) and private keys (without password protected)
|
||||
|
||||
#### [3.Trusted Certificate](#accordion1_3)
|
||||
|
||||
National Proxy System has a build-in trusted certificate authorities list. When the original certificate is issued by a certificate authority that not in the list, the proxy will issued the substitute certificate with an untrusted root certificate, and so consequently, the browser could identify unsecure connections.
|
||||
|
||||
You can add a custom certificate authority to the trusted certificate authorities of the system.
|
||||
|
||||
The certificate MUST be PEM format.
|
||||
|
||||
Following are the National Proxy System’s default trusted certificate authorities:
|
||||
|
||||
* ACCVRAIZ1
|
||||
* Actalis Authentication Root CA
|
||||
* AddTrust External CA Root
|
||||
* AffirmTrust Commercial
|
||||
* AffirmTrust Networking
|
||||
* AffirmTrust Premium
|
||||
* AffirmTrust Premium ECC
|
||||
* Amazon Root CA 1
|
||||
* Amazon Root CA 2
|
||||
* Amazon Root CA 3
|
||||
* Amazon Root CA 4
|
||||
* Atos TrustedRoot 2011
|
||||
* Autoridad de Certificacion Firmaprofesional CIF A62634068
|
||||
* Baltimore CyberTrust Root
|
||||
* Buypass Class 2 Root CA
|
||||
* Buypass Class 3 Root CA
|
||||
* CA Disig Root R2
|
||||
* CFCA EV ROOT
|
||||
* COMODO Certification Authority
|
||||
* COMODO ECC Certification Authority
|
||||
* COMODO RSA Certification Authority
|
||||
* Certigna
|
||||
* Certinomis - Root CA
|
||||
* Class 2 Primary CA
|
||||
* Certplus Root CA G1
|
||||
* Certplus Root CA G2
|
||||
* Certum Trusted Network CA
|
||||
* Certum Trusted Network CA 2
|
||||
* Chambers of Commerce Root - 2008
|
||||
* AAA Certificate Services
|
||||
* Cybertrust Global Root
|
||||
* D-TRUST Root Class 3 CA 2 2009
|
||||
* D-TRUST Root Class 3 CA 2 EV 2009
|
||||
* DST Root CA X3
|
||||
* Deutsche Telekom Root CA 2
|
||||
* DigiCert Assured ID Root CA
|
||||
* DigiCert Assured ID Root G2
|
||||
* DigiCert Assured ID Root G3
|
||||
* DigiCert Global Root CA
|
||||
* DigiCert Global Root G2
|
||||
* DigiCert Global Root G3
|
||||
* DigiCert High Assurance EV Root CA
|
||||
* DigiCert Trusted Root G4
|
||||
* E-Tugra Certification Authority
|
||||
* EC-ACC
|
||||
* EE Certification Centre Root CA
|
||||
* Entrust.net Certification Authority (2048)
|
||||
* Entrust Root Certification Authority
|
||||
* Entrust Root Certification Authority - EC1
|
||||
* Entrust Root Certification Authority - G2
|
||||
* GDCA TrustAUTH R5 ROOT
|
||||
* GeoTrust Global CA
|
||||
* GeoTrust Primary Certification Authority
|
||||
* GeoTrust Primary Certification Authority - G2
|
||||
* GeoTrust Primary Certification Authority - G3
|
||||
* GeoTrust Universal CA
|
||||
* GeoTrust Universal CA 2
|
||||
* GlobalSign
|
||||
* GlobalSign
|
||||
* GlobalSign Root CA
|
||||
* GlobalSign
|
||||
* GlobalSign
|
||||
* Global Chambersign Root - 2008
|
||||
* Go Daddy Root Certificate Authority - G2
|
||||
* Hellenic Academic and Research Institutions ECC RootCA 2015
|
||||
* Hellenic Academic and Research Institutions RootCA 2011
|
||||
* Hellenic Academic and Research Institutions RootCA 2015
|
||||
* Hongkong Post Root CA 1
|
||||
* ISRG Root X1
|
||||
* IdenTrust Commercial Root CA 1
|
||||
* IdenTrust Public Sector Root CA 1
|
||||
* Izenpe.com
|
||||
* LuxTrust Global Root 2
|
||||
* Microsec e-Szigno Root CA 2009
|
||||
* NetLock Arany (Class Gold) Főtanúsítvány
|
||||
* Network Solutions Certificate Authority
|
||||
* OISTE WISeKey Global Root GA CA
|
||||
* OISTE WISeKey Global Root GB CA
|
||||
* OpenTrust Root CA G1
|
||||
* OpenTrust Root CA G2
|
||||
* OpenTrust Root CA G3
|
||||
* QuoVadis Root Certification Authority
|
||||
* QuoVadis Root CA 1 G3
|
||||
* QuoVadis Root CA 2
|
||||
* QuoVadis Root CA 2 G3
|
||||
* QuoVadis Root CA 3
|
||||
* QuoVadis Root CA 3 G3
|
||||
* SSL.com EV Root Certification Authority ECC
|
||||
* SSL.com EV Root Certification Authority RSA R2
|
||||
* SSL.com Root Certification Authority ECC
|
||||
* SSL.com Root Certification Authority RSA
|
||||
* SZAFIR ROOT CA2
|
||||
* SecureSign RootCA11
|
||||
* SecureTrust CA
|
||||
* Secure Global CA
|
||||
* Sonera Class2 CA
|
||||
* Staat der Nederlanden EV Root CA
|
||||
* Staat der Nederlanden Root CA - G2
|
||||
* Staat der Nederlanden Root CA - G3
|
||||
* Starfield Root Certificate Authority - G2
|
||||
* Starfield Services Root Certificate Authority - G2
|
||||
* SwissSign Gold CA - G2
|
||||
* SwissSign Silver CA - G2
|
||||
* T-TeleSec GlobalRoot Class 2
|
||||
* T-TeleSec GlobalRoot Class 3
|
||||
* TUBITAK Kamu SM SSL Kok Sertifikasi - Surum 1
|
||||
* TWCA Global Root CA
|
||||
* TWCA Root Certification Authority
|
||||
* TeliaSonera Root CA v1
|
||||
* TrustCor ECA-1
|
||||
* TrustCor RootCert CA-1
|
||||
* TrustCor RootCert CA-2
|
||||
* TÜRKTRUST Elektronik Sertifika Hizmet Sağlayıcısı H5
|
||||
* USERTrust ECC Certification Authority
|
||||
* USERTrust RSA Certification Authority
|
||||
* VeriSign Class 3 Public Primary Certification Authority - G4
|
||||
* VeriSign Class 3 Public Primary Certification Authority - G5
|
||||
* VeriSign Universal Root Certification Authority
|
||||
* VeriSign Class 3 Public Primary Certification Authority - G3
|
||||
* Visa eCommerce Root
|
||||
* XRamp Global Certification Authority
|
||||
* thawte Primary Root CA
|
||||
* thawte Primary Root CA - G2
|
||||
* thawte Primary Root CA - G3
|
||||
* Microsoft Root Authority
|
||||
* Microsoft Root Certificate Authority
|
||||
* Microsoft Root Certificate Authority 2010
|
||||
* Microsoft Root Certificate Authority 2011
|
||||
* Baltimore CyberTrust Root
|
||||
37
src/main/webapp/online-help/ysp/audio_sample.md
Normal file
37
src/main/webapp/online-help/ysp/audio_sample.md
Normal file
@@ -0,0 +1,37 @@
|
||||
#### [1.功能简介](#accordion1_1)
|
||||
|
||||
音频样例匹配功能,可对网络流量中的音频内容进行分析,找出与用户配置的音频样例相匹配的音视频流量,并执行阻断与监测动作,产生日志
|
||||
|
||||
#### [2.配置基础信息](#accordion1_2)
|
||||
|
||||
* 规则名称:统一填写
|
||||
* 执行动作:(阻断与监测)统一填写
|
||||
|
||||
#### [3.业务配置属性](#accordion1_3)
|
||||
|
||||
* 源文件:上传本地音频文件,将以该文件中包含的音频信息与流量中传输的音频进行匹配,命中后执行配置动作,产生日志
|
||||
* 置信度:当执行动作为监测时,用户可指定匹配命中的最小置信度,置信度可选值为70、80、90、100
|
||||
|
||||
#### [4.配置约束条件](#accordion1_4)
|
||||
|
||||
* 上传的本地音频文件大小应不大于20MB
|
||||
* 上传的本地音频文件时长应不大于2分钟
|
||||
* 支持的本地音频文件格式为:mp4,flv,asf,wmv,avi,mpeg,mov,dat,m4v,m4p,m4b,webm,ogv,wav,mp3
|
||||
|
||||
#### [5.配置生效区域](#accordion1_5)
|
||||
|
||||
统一填写
|
||||
|
||||
#### [6.配置标签](#accordion1_6)
|
||||
|
||||
* 统一填写
|
||||
|
||||
#### [7.预期效果](#accordion1_7)
|
||||
|
||||
* 首次分析阻断效果:命中样例配置后,客户端收到NTC系统发送的虚假RST报文,如此时该音视频未缓存或下载完成,则中断当前音视频的播放或下载
|
||||
* 后续访问阻断效果:首次分析命中后,会生成该音视频的传输特征,后续访问直接依据传输特征进行阻断
|
||||
|
||||
#### [8.免责声明](#accordion1_8)
|
||||
|
||||
* 对于音视频编码的索引信息在音视频文件尾部的情况,本系统不予支持
|
||||
* 由于音视频内容分析滞后于网络传输,本系统不保证首次观看音视频时的阻断效果
|
||||
35
src/main/webapp/online-help/ysp/file_digest.md
Normal file
35
src/main/webapp/online-help/ysp/file_digest.md
Normal file
@@ -0,0 +1,35 @@
|
||||
#### [1.功能简介](#accordion1_1)
|
||||
|
||||
文件摘要检测功能,可提取网络流量中传输文件的摘要信息,并找出与用户配置的文件具有相似摘要的流量,命中配置后,执行阻断与监测动作,产生日志
|
||||
|
||||
#### [2.配置基础信息](#accordion1_2)
|
||||
|
||||
* 规则名称:统一填写
|
||||
* 执行动作:(阻断与监测)统一填写
|
||||
|
||||
#### [3.业务配置属性](#accordion1_3)
|
||||
|
||||
* 文件:上传本地文件,该文件将与流量中包含的文件进行匹配,命中后执行配置动作,产生日志
|
||||
* 置信度:当执行动作为监测时,用户可指定匹配命中的最小置信度,置信度可选值为70、80、90、100
|
||||
|
||||
#### [4.配置约束条件](#accordion1_4)
|
||||
|
||||
* 上传的本地文件大小应不大于20MB
|
||||
* 支持的本地文件格式为:txt,doc,img,docx,pptx,xlsx,xls,ppt
|
||||
|
||||
#### [5.配置生效区域](#accordion1_5)
|
||||
|
||||
统一填写
|
||||
|
||||
#### [6.配置标签](#accordion1_6)
|
||||
|
||||
* 统一填写
|
||||
|
||||
#### [7.预期效果](#accordion1_7)
|
||||
|
||||
* 首次分析阻断效果:当客户端下载某文件,并命中文件摘要配置后,客户端将收到NTC系统发送的虚假RST报文,如此时该文件未下载完成,则中断当前文件的下载
|
||||
* 后续访问阻断效果:首次分析命中后,会生成该文件的传输特征,后续下载请求直接依据传输特征进行阻断
|
||||
|
||||
#### [8.免责声明](#accordion1_8)
|
||||
|
||||
* 由于文件摘要的分析滞后于网络传输,本系统不保证首次文件下载时的阻断效果
|
||||
33
src/main/webapp/online-help/ysp/picture_sample.md
Normal file
33
src/main/webapp/online-help/ysp/picture_sample.md
Normal file
@@ -0,0 +1,33 @@
|
||||
#### [1.功能简介](#accordion1_1)
|
||||
|
||||
图片样例匹配功能,可对网络流量中的图片内容进行分析,找出与用户配置的图片样例相匹配的图片流量,并执行阻断与监测动作,产生日志
|
||||
|
||||
#### [2.配置基础信息](#accordion1_2)
|
||||
|
||||
* 规则名称:统一填写
|
||||
* 执行动作:阻断与监测(统一填写)
|
||||
|
||||
#### [3.业务配置属性](#accordion1_3)
|
||||
|
||||
* 源文件:上传本地图片文件,将以该文件中包含的图片画面信息与流量中传输的图片进行匹配,命中后执行配置动作,产生日志
|
||||
* 置信度:当执行动作为监测时,用户可指定匹配命中的最小置信度,置信度可选值为70、80、90、100
|
||||
|
||||
#### [4\. 配置约束条件](#accordion1_4)
|
||||
|
||||
* 支持的上传图片格式为:bmp,jpg,tiff,raw,gif
|
||||
|
||||
#### [5.配置生效区域](#accordion1_5)
|
||||
|
||||
统一填写
|
||||
|
||||
#### [6.配置标签](#accordion1_6)
|
||||
|
||||
* 统一填写
|
||||
|
||||
#### [7.预期效果](#accordion1_7)
|
||||
|
||||
* 阻断效果:客户端访问某图片命中图片样例配置后,会生成该图片的传输特征,后续对该图片的访问直接依据传输特征进行阻断
|
||||
|
||||
#### [8.免责声明](#accordion1_8)
|
||||
|
||||
* 对于图片文件大于4MB的图片,本系统不予支持
|
||||
38
src/main/webapp/online-help/ysp/video_sample.md
Normal file
38
src/main/webapp/online-help/ysp/video_sample.md
Normal file
@@ -0,0 +1,38 @@
|
||||
#### [1.功能简介](#accordion1_1)
|
||||
|
||||
视频样例匹配功能,可对网络流量中的视频内容进行分析,找出与用户配置的视频样例相匹配的视频流量,并执行阻断与监测动作,产生日志
|
||||
|
||||
#### [2.配置基础信息](#accordion1_2)
|
||||
|
||||
* 规则名称:统一填写
|
||||
* 执行动作:(阻断与监测)统一填写
|
||||
|
||||
#### [3.业务配置属性](#accordion1_3)
|
||||
|
||||
* 源文件:上传本地视频文件,将以该文件中包含的视频画面信息与流量中传输的视频进行匹配,命中后执行配置动作,产生日志
|
||||
* 置信度:当执行动作为监测时,用户可指定匹配命中的最小置信度,置信度可选值为70、80、90、100
|
||||
|
||||
#### [4.配置约束条件](#accordion1_4)
|
||||
|
||||
* 上传的本地视频文件大小应不大于20MB
|
||||
* 上传的本地视频文件时长应不大于2分钟
|
||||
* 支持的本地视频文件格式为:mp4,flv,asf,wmv,avi,mpeg,mov,dat,m4v,m4p,m4b,webm
|
||||
|
||||
#### [5.配置生效区域](#accordion1_5)
|
||||
|
||||
统一填写
|
||||
|
||||
#### [6.配置标签](#accordion1_6)
|
||||
|
||||
* 统一填写
|
||||
|
||||
#### [7.预期效果](#accordion1_7)
|
||||
|
||||
* 首次分析阻断效果:命中样例配置后,客户端收到NTC系统发送的虚假RST报文,如此时该视频未缓存或下载完成,则中断当前视频的播放或下载
|
||||
* 后续访问阻断效果:首次分析命中后,会生成该视频的传输特征,后续访问直接依据传输特征进行阻断
|
||||
|
||||
#### [8.免责声明](#accordion1_8)
|
||||
|
||||
* 对于音视频编码的索引信息在音视频文件尾部的情况,本系统不予支持
|
||||
* 对于分辨率大于4兆的视频,本系统不予支持
|
||||
* 由于音视频内容分析滞后于网络传输,本系统不保证首次观看音视频时的阻断效果
|
||||
34
src/main/webapp/online-help/ysp/video_scene.md
Normal file
34
src/main/webapp/online-help/ysp/video_scene.md
Normal file
@@ -0,0 +1,34 @@
|
||||
#### [1.功能简介](#accordion1_1)
|
||||
|
||||
视频场景检测功能,可检测出网络中传输的包含视频色情场景的流量,并根据用户配置,进行阻断或监测,产生日志
|
||||
|
||||
#### [2.配置基础信息](#accordion1_2)
|
||||
|
||||
* 执行动作:(阻断与监测)统一填写
|
||||
|
||||
#### [3.业务配置属性](#accordion1_3)
|
||||
|
||||
* 置信度:当执行动作为监测时,用户可指定匹配命中的最小置信度,置信度可选值为70、80、90、100
|
||||
|
||||
#### [4.配置约束条件](#accordion1_4)
|
||||
|
||||
* 无
|
||||
|
||||
#### [5.配置生效区域](#accordion1_5)
|
||||
|
||||
统一填写
|
||||
|
||||
#### [6.配置标签](#accordion1_6)
|
||||
|
||||
* 统一填写
|
||||
|
||||
#### [7.预期效果](#accordion1_7)
|
||||
|
||||
* 首次分析阻断效果:检测到色情场景后,客户端收到NTC系统发送的虚假RST报文,如此时该视频未缓存或下载完成,则中断当前视频的播放或下载
|
||||
* 后续访问阻断效果:首次分析命中后,会生成该视频的传输特征,后续访问直接通过传输特征进行阻断
|
||||
|
||||
#### [8.免责声明](#accordion1_8)
|
||||
|
||||
* 对于音视频编码的索引信息在音视频文件尾部的情况,本系统不予支持
|
||||
* 对于分辨率大于4兆的视频,本系统不予支持
|
||||
* 由于音视频内容分析滞后于网络传输,本系统不保证首次观看音视频时的阻断效果
|
||||
35
src/main/webapp/online-help/ysp/voip_sample.md
Normal file
35
src/main/webapp/online-help/ysp/voip_sample.md
Normal file
@@ -0,0 +1,35 @@
|
||||
#### [1.功能简介](#accordion1_1)
|
||||
|
||||
VOIP样例匹配功能,可对VOIP流量中的语音内容进行分析,找出与用户配置的音频样例相匹配的VOIP流量,并执行阻断与监测动作,产生日志
|
||||
|
||||
#### [2.配置基础信息](#accordion1_2)
|
||||
|
||||
* 规则名称:统一填写
|
||||
* 执行动作:(阻断与监测)统一填写
|
||||
|
||||
#### [3.业务配置属性](#accordion1_3)
|
||||
|
||||
* 源文件:上传本地音频文件,将以该文件中包含的音频信息与流量中传输的VOIP音频内容进行匹配,命中后执行配置动作,产生日志
|
||||
* 置信度:当执行动作为监测时,用户可指定匹配命中的最小置信度,置信度可选值为70、80、90、100
|
||||
|
||||
#### [4.配置约束条件](#accordion1_4)
|
||||
|
||||
* 上传的本地音频文件大小应不大于20MB
|
||||
* 上传的本地音频文件时长应不大于2分钟
|
||||
* 支持的本地音频文件格式为:mp4,flv,asf,wmv,avi,mpeg,mov,dat,m4v,m4p,m4b,webm,ogv,wav,mp3
|
||||
|
||||
#### [5.配置生效区域](#accordion1_5)
|
||||
|
||||
统一填写
|
||||
|
||||
#### [6.配置标签](#accordion1_6)
|
||||
|
||||
* 统一填写
|
||||
|
||||
#### [7.预期效果](#accordion1_7)
|
||||
|
||||
* 阻断效果:命中配置后,通过串联设备临时规则,丢弃后续传输报文,已接通的VOIP电话不中断,但无后继语音内容
|
||||
|
||||
#### [8.免责声明](#accordion1_8)
|
||||
|
||||
无
|
||||
@@ -0,0 +1,767 @@
|
||||
|
||||
# [1.9.0](https://github.com/showdownjs/showdown/compare/1.8.7...1.9.0) (2018-11-10)
|
||||
|
||||
Version 1.9.0 introduces a new feature, the Markdown to HTML converter. This feature is still experimental and is a partial backport of the new Reverse Converter planned for version 2.0.
|
||||
### Bug Fixes
|
||||
|
||||
* **italicsAndBold:** fix issue with consecutive spans ([#608](https://github.com/showdownjs/showdown/issues/608)) ([5c0d67e](https://github.com/showdownjs/showdown/commit/5c0d67e)), closes [#544](https://github.com/showdownjs/showdown/issues/544)
|
||||
* **underline:** fix issue with consecutive spans ([81edc70](https://github.com/showdownjs/showdown/commit/81edc70))
|
||||
|
||||
### Features
|
||||
|
||||
* **converter.makeMarkdown:** [EXPERIMENTAL] add an HTML to MD converter ([e4b0e69](https://github.com/showdownjs/showdown/commit/e4b0e69)), closes [#388](https://github.com/showdownjs/showdown/issues/388) [#233](https://github.com/showdownjs/showdown/issues/233)
|
||||
|
||||
<a name="1.8.7"></a>
|
||||
# [1.8.7](https://github.com/showdownjs/showdown/compare/1.8.6...1.8.7) (2018-10-16)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **emojis:** fix emoji excessive size ([4aca41c](https://github.com/showdownjs/showdown/commit/4aca41c))
|
||||
* **gfm-codeblocks:** add support for spaces before language declaration ([24bf7b1](https://github.com/showdownjs/showdown/commit/24bf7b1)), closes [#569](https://github.com/showdownjs/showdown/issues/569)
|
||||
leading space no longer breaks gfm codeblocks ([828c32f](https://github.com/showdownjs/showdown/commit/828c32f)), closes [#523](https://github.com/showdownjs/showdown/issues/523)
|
||||
|
||||
* **images:** fix js error when using image references ([980e702](https://github.com/showdownjs/showdown/commit/980e702)), closes [#585](https://github.com/showdownjs/showdown/issues/585)
|
||||
* **literalMidWordAsterisks:** now parses single characters enclosed by * correctly ([fe70e45](https://github.com/showdownjs/showdown/commit/fe70e45)), closes [#478](https://github.com/showdownjs/showdown/issues/478)
|
||||
* **mentions:** allow for usernames with dot, underscore and dash ([dfeb1e2](https://github.com/showdownjs/showdown/commit/dfeb1e2)), closes [#574](https://github.com/showdownjs/showdown/issues/574)
|
||||
* **nbsp:** fix replacing of nbsp with regular spaces ([8bc1f42](https://github.com/showdownjs/showdown/commit/8bc1f42))
|
||||
|
||||
<a name="1.8.6"></a>
|
||||
# [1.8.6](https://github.com/showdownjs/showdown/compare/1.8.5...1.8.6) (2017-12-22)
|
||||
|
||||
### Features
|
||||
|
||||
* **splitAdjacentBlockquotes:** add option to split adjacent blockquote blocks ([da328f2](https://github.com/showdownjs/showdown/commit/da328f2)), closes [#477](https://github.com/showdownjs/showdown/issues/477)
|
||||
|
||||
|
||||
|
||||
<a name="1.8.5"></a>
|
||||
# [1.8.5](https://github.com/showdownjs/showdown/compare/1.8.4...1.8.5) (2017-12-10)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **completeHTMLDocument:** add option to output a complete HTML document ([a8427c9](https://github.com/showdownjs/showdown/commit/a8427c9))
|
||||
* **metadata:** add support for embedded metadata ([63d949f](https://github.com/showdownjs/showdown/commit/63d949f)), closes [#260](https://github.com/showdownjs/showdown/issues/260)
|
||||
|
||||
|
||||
|
||||
<a name="1.8.4"></a>
|
||||
## [1.8.4](https://github.com/showdownjs/showdown/compare/1.8.3...1.8.4) (2017-12-05)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **tables:** raw html inside code tags in tables no longer breaks tables ([4ef4c5e](https://github.com/showdownjs/showdown/commit/4ef4c5e)), closes [#471](https://github.com/showdownjs/showdown/issues/471)
|
||||
|
||||
|
||||
|
||||
<a name="1.8.3"></a>
|
||||
## [1.8.3](https://github.com/showdownjs/showdown/compare/1.8.2...1.8.3) (2017-11-28)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **literalMidWordAsterisks:** no longer treats colon as alphanumeric char ([21194c8](https://github.com/showdownjs/showdown/commit/21194c8)), closes [#461](https://github.com/showdownjs/showdown/issues/461)
|
||||
* **spanGamut:** code spans are hashed after parsing ([f4f63c5](https://github.com/showdownjs/showdown/commit/f4f63c5)), closes [#464](https://github.com/showdownjs/showdown/issues/464)
|
||||
* **tables:** pipe character in code spans no longer breaks table ([0c933a0](https://github.com/showdownjs/showdown/commit/0c933a0)), closes [#465](https://github.com/showdownjs/showdown/issues/465)
|
||||
|
||||
|
||||
|
||||
<a name="1.8.2"></a>
|
||||
## [1.8.2](https://github.com/showdownjs/showdown/compare/1.8.1...1.8.2) (2017-11-11)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **fenced codeblocks:** add tilde as fenced code block delimiter ([c956ede](https://github.com/showdownjs/showdown/commit/c956ede)), closes [#456](https://github.com/showdownjs/showdown/issues/456)
|
||||
* **openLinksInNewWindow:** hash links are not affected by the option ([11936ec](https://github.com/showdownjs/showdown/commit/11936ec)), closes [#457](https://github.com/showdownjs/showdown/issues/457)
|
||||
|
||||
|
||||
|
||||
<a name="1.8.1"></a>
|
||||
## [1.8.1](https://github.com/showdownjs/showdown/compare/1.8.0...1.8.1) (2017-11-01)
|
||||
|
||||
|
||||
### Dependencies update
|
||||
|
||||
* **package:** update yargs to version 10.0.3 ([#447](https://github.com/showdownjs/showdown/issues/447)) ([906b26d](https://github.com/showdownjs/showdown/commit/906b26d))
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **CDNjs:** bump version to fix version mismatch with CDNjs ([#452](https://github.com/showdownjs/showdown/issues/452))
|
||||
|
||||
|
||||
<a name="1.8.0"></a>
|
||||
# [1.8.0](https://github.com/showdownjs/showdown/compare/1.7.6...1.8.0) (2017-10-24)
|
||||
|
||||
### NOTICE
|
||||
|
||||
Don't use the CDNjs version of this release. See issue [#452](https://github.com/showdownjs/showdown/issues/452) for more details.
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **autolinks:** prevent _ and * to be parsed in links ([61929bb](https://github.com/showdownjs/showdown/commit/61929bb)), closes [#444](https://github.com/showdownjs/showdown/issues/444)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **ellipsis:** add auto-ellipsis support ([25f1978](https://github.com/showdownjs/showdown/commit/25f1978))
|
||||
|
||||
- *Example:*
|
||||
|
||||
input
|
||||
|
||||
```md
|
||||
this is an ellipsis...
|
||||
```
|
||||
|
||||
output
|
||||
|
||||
```html
|
||||
<p>this is an ellipsis…</p>
|
||||
```
|
||||
|
||||
* **emoji:** add emoji support through option `emoji`([5b8f1d3](https://github.com/showdownjs/showdown/commit/5b8f1d3)), closes [#448](https://github.com/showdownjs/showdown/issues/448)
|
||||
|
||||
- *Usage:*
|
||||
|
||||
```js
|
||||
var conv = new showdown.Converter({emoji: true});
|
||||
```
|
||||
|
||||
- *Example:*
|
||||
|
||||
input
|
||||
|
||||
```md
|
||||
this is a smile :smile: emoji
|
||||
```
|
||||
|
||||
output
|
||||
|
||||
```html
|
||||
<p>this is a smile 😄 emoji</p>
|
||||
```
|
||||
|
||||
* **start ordered lists at an arbitrary number:** add support for defining the first item number of ordered lists ([9cdc35e](https://github.com/showdownjs/showdown/commit/9cdc35e)), closes [#377](https://github.com/showdownjs/showdown/issues/377)
|
||||
|
||||
- *Example:*
|
||||
|
||||
input
|
||||
|
||||
```md
|
||||
3. foo
|
||||
4. bar
|
||||
5. baz
|
||||
```
|
||||
|
||||
output
|
||||
|
||||
```html
|
||||
<ol start="3">
|
||||
<li>foo</li>
|
||||
<li>bar</li>
|
||||
<li>baz</li>
|
||||
</ol>
|
||||
```
|
||||
|
||||
* **underline:** add EXPERIMENTAL support for underline ([084b819](https://github.com/showdownjs/showdown/commit/084b819)), closes [#450](https://github.com/showdownjs/showdown/issues/450)
|
||||
|
||||
- *Usage:*
|
||||
|
||||
```js
|
||||
var conv = new showdown.Converter({underline: true});
|
||||
```
|
||||
|
||||
- *Example:*
|
||||
|
||||
input
|
||||
|
||||
```md
|
||||
this is __underlined__ and this is ___also underlined___
|
||||
```
|
||||
|
||||
output
|
||||
|
||||
```html
|
||||
<p>this is <u>underlined</u> and this is <u>also underlined</u></p>
|
||||
```
|
||||
|
||||
- *Note:* With this option enabled, underscore no longer parses as `<em>` or `<strong>`
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* start ordered lists at an arbitrary number: Since showdown now supports starting ordered lists at an arbitrary number,
|
||||
list output may differ.
|
||||
|
||||
|
||||
|
||||
<a name="1.7.6"></a>
|
||||
## [1.7.6](https://github.com/showdownjs/showdown/compare/1.7.5...1.7.6) (2017-10-06)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **tables:** tables are properly rendered when followed by a single linebreak and a list ([d88b095](https://github.com/showdownjs/showdown/commit/d88b095)), closes [#443](https://github.com/showdownjs/showdown/issues/443)
|
||||
* **tables:** trailing spaces no longer prevent table parsing ([66bdd21](https://github.com/showdownjs/showdown/commit/66bdd21)), closes [#442](https://github.com/showdownjs/showdown/issues/442)
|
||||
|
||||
|
||||
|
||||
<a name="1.7.5"></a>
|
||||
## [1.7.5](https://github.com/showdownjs/showdown/compare/1.7.4...1.7.5) (2017-10-02)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **html-comments:** changed regex to prevent malformed long comment to freeze showdown ([3efcd10](https://github.com/showdownjs/showdown/commit/3efcd10)), closes [#439](https://github.com/showdownjs/showdown/issues/439)
|
||||
|
||||
|
||||
|
||||
<a name="1.7.4"></a>
|
||||
## [1.7.4](https://github.com/showdownjs/showdown/compare/1.7.3...1.7.4) (2017-09-08)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **helper.isArray:** replace a.constructor === Array with Array.isArray ([466a2eb](https://github.com/showdownjs/showdown/commit/466a2eb)), closes [#425](https://github.com/showdownjs/showdown/issues/425)
|
||||
* **loader:** allow AMD loader to be used within Node env ([ff24bdb](https://github.com/showdownjs/showdown/commit/ff24bdb))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **base64-wrapping:** support for wrapping base64 strings ([8c593a4](https://github.com/showdownjs/showdown/commit/8c593a4)), closes [#429](https://github.com/showdownjs/showdown/issues/429)
|
||||
|
||||
|
||||
|
||||
<a name="1.7.3"></a>
|
||||
## [1.7.3](https://github.com/showdownjs/showdown/compare/1.7.2...1.7.3) (2017-08-23)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **github flavor:** add backslashEscapesHTMLTags to GFM flavor ([5284439](https://github.com/showdownjs/showdown/commit/5284439))
|
||||
* **literalMidWordAsterisks:** option no longer treats punctuation as word character ([8f05be7](https://github.com/showdownjs/showdown/commit/8f05be7)), closes [#398](https://github.com/showdownjs/showdown/issues/398)
|
||||
* **tables:** allow for one column table ([fef110c](https://github.com/showdownjs/showdown/commit/fef110cccb2d02b218183398d9baa0ae256a7283)), closes [#406](https://github.com/showdownjs/showdown/issues/406)
|
||||
|
||||
### Features
|
||||
|
||||
* **rawHeaderId:** Remove only spaces, ' and " from generated header ids ([1791cf0](https://github.com/showdownjs/showdown/commit/1791cf0)), closes [#409](https://github.com/showdownjs/showdown/issues/409)
|
||||
* **rawPrefixHeaderId:** add option to prevent showdown from modifying the prefix ([ff26c08](https://github.com/showdownjs/showdown/commit/ff26c08)), closes [#409](https://github.com/showdownjs/showdown/issues/409)
|
||||
|
||||
|
||||
|
||||
<a name="1.7.2"></a>
|
||||
## [1.7.2](https://github.com/showdownjs/showdown/compare/1.7.1...1.7.2) (2017-08-05)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **githubMentions:** githubMentions now works with openLinksInNewWindow options ([1194d88](https://github.com/showdownjs/showdown/commit/1194d88)), closes [#403](https://github.com/showdownjs/showdown/issues/403)
|
||||
* **lists:** fix multi paragraph lists with sublists ([a2259c0](https://github.com/showdownjs/showdown/commit/a2259c0)), closes [#397](https://github.com/showdownjs/showdown/issues/397)
|
||||
* **tablesHeaderId:** fix mismatch of option name ([51e4693](https://github.com/showdownjs/showdown/commit/51e4693)), closes [#412](https://github.com/showdownjs/showdown/issues/412)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **backslashEscapesHTMLTags:** backslash escapes HTML tags ([5a5aff6](https://github.com/showdownjs/showdown/commit/5a5aff6)), closes [#374](https://github.com/showdownjs/showdown/issues/374)
|
||||
|
||||
|
||||
|
||||
<a name="1.7.1"></a>
|
||||
## [1.7.1](https://github.com/showdownjs/showdown/compare/1.7.0...1.7.1) (2017-06-02)
|
||||
|
||||
Important HOTFIX
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **HTML Parser:** fix nasty bug where malformed HTML would hang showdown ([6566c72](https://github.com/showdownjs/showdown/commit/6566c72)), closes [#393](https://github.com/showdownjs/showdown/issues/393)
|
||||
|
||||
|
||||
|
||||
<a name="1.7.0"></a>
|
||||
## [1.7.0](https://github.com/showdownjs/showdown/compare/1.6.4...1.7.0) (2017-06-01)
|
||||
|
||||
(DEPRECATED)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **anchors:** fix issue with brackets in link URL ([7ba18dd](https://github.com/showdownjs/showdown/commit/7ba18dd)), closes [#390](https://github.com/showdownjs/showdown/issues/390)
|
||||
* **excludeTrailingPunctuationFromURL:** add comma to punctuation list ([fa35fd5](https://github.com/showdownjs/showdown/commit/fa35fd5)), closes [#354](https://github.com/showdownjs/showdown/issues/354)
|
||||
* **excludeTrailingPunctuationFromURLs:** fix weird character when this option with simplifiedAutoLinks ([71acff5](https://github.com/showdownjs/showdown/commit/71acff5)), closes [#378](https://github.com/showdownjs/showdown/issues/378)
|
||||
* **HTML parsing:** fix HTML parsing issues with nested tags ([6fbc072](https://github.com/showdownjs/showdown/commit/6fbc072)), closes [#357](https://github.com/showdownjs/showdown/issues/357) [#387](https://github.com/showdownjs/showdown/issues/387)
|
||||
* **openLinksInNewWindow:** encode _ to prevent clash with em ([813f832](https://github.com/showdownjs/showdown/commit/813f832)), closes [#379](https://github.com/showdownjs/showdown/issues/379)
|
||||
* **package:** update yargs to version 7.0.1 ([#349](https://github.com/showdownjs/showdown/issues/349)) ([9308d7b](https://github.com/showdownjs/showdown/commit/9308d7b))
|
||||
* **package:** update yargs to version 8.0.1 ([#385](https://github.com/showdownjs/showdown/issues/385)) ([5fd847b](https://github.com/showdownjs/showdown/commit/5fd847b))
|
||||
* **simpleAutoLinks:** URLs with emphasis/strikethrough are parsed ([5c50675](https://github.com/showdownjs/showdown/commit/5c50675)), closes [#347](https://github.com/showdownjs/showdown/issues/347)
|
||||
* **tables:** pipe char can now be escaped ([1ebc195](https://github.com/showdownjs/showdown/commit/1ebc195)), closes [#345](https://github.com/showdownjs/showdown/issues/345)
|
||||
* **url parsing:** fix url edge case parsing in images and links ([30aa18c](https://github.com/showdownjs/showdown/commit/30aa18c))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **customizeHeaderId:** add option for customizing header ids ([94c570a](https://github.com/showdownjs/showdown/commit/94c570a)), closes [#383](https://github.com/showdownjs/showdown/issues/383)
|
||||
* **images:** add support for image's implicit reference syntax ([0c6c07b](https://github.com/showdownjs/showdown/commit/0c6c07b)), closes [#366](https://github.com/showdownjs/showdown/issues/366)
|
||||
* **literalMidWordAsterisks:** add option for mid word asterisks ([5bec8f9](https://github.com/showdownjs/showdown/commit/5bec8f9))
|
||||
* **openLinksInNewWindow:** add option to open all links in a new window ([50235d6](https://github.com/showdownjs/showdown/commit/50235d6)), closes [#362](https://github.com/showdownjs/showdown/issues/362) [#337](https://github.com/showdownjs/showdown/issues/337) [#249](https://github.com/showdownjs/showdown/issues/249) [#247](https://github.com/showdownjs/showdown/issues/247) [#222](https://github.com/showdownjs/showdown/issues/222)
|
||||
|
||||
|
||||
|
||||
<a name="1.6.4"></a>
|
||||
## [1.6.4](https://github.com/showdownjs/showdown/compare/1.6.3...1.6.4) (2017-02-06)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **encodeAmpsAndAngles:** fix > and < encoding ([7f43b79](https://github.com/showdownjs/showdown/commit/7f43b79)), closes [#236](https://github.com/showdownjs/showdown/issues/236)
|
||||
* **encodeEmail:** now produces valid emails ([605d8b7](https://github.com/showdownjs/showdown/commit/605d8b7)), closes [#340](https://github.com/showdownjs/showdown/issues/340)
|
||||
* **flavor: github:** new version of github does not use prefix 'user-content' in headers ([368f0b6](https://github.com/showdownjs/showdown/commit/368f0b6))
|
||||
* **hashCodeTags:** escape code tags ([41cb3f6](https://github.com/showdownjs/showdown/commit/41cb3f6)), closes [#339](https://github.com/showdownjs/showdown/issues/339)
|
||||
* **italicsAndBold:** fix double emphasis edge case ([1832b7f](https://github.com/showdownjs/showdown/commit/1832b7f))
|
||||
* **paragraph:** workaround QML bug ([f7a429e](https://github.com/showdownjs/showdown/commit/f7a429e)), closes [#246](https://github.com/showdownjs/showdown/issues/246) [#338](https://github.com/showdownjs/showdown/issues/338)
|
||||
* **prefixHeaderId:** make `prefixHeaderId` string be parsed along the generated id ([f641a7d](https://github.com/showdownjs/showdown/commit/f641a7d))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **flavor: ghost:** add Ghost flavor ([6374b5b](https://github.com/showdownjs/showdown/commit/6374b5b))
|
||||
* **flavor: original:** add John Gruber's markdown flavor ([6374b5b](https://github.com/showdownjs/showdown/commit/6374b5b))
|
||||
|
||||
|
||||
|
||||
<a name="1.6.3"></a>
|
||||
## [1.6.3](https://github.com/showdownjs/showdown/compare/1.6.2...1.6.3) (2017-01-30)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **codeSpans:** add - and = to escaped chars inside code spans ([4243a31](https://github.com/showdownjs/showdown/commit/4243a31))
|
||||
* **italicsAndBold:** fix inconsistency in italicsAndBold parsing ([a4f05d4](https://github.com/showdownjs/showdown/commit/a4f05d4)), closes [#332](https://github.com/showdownjs/showdown/issues/332)
|
||||
* **literalMidWordUnderscores:** fix inconsistent behavior of emphasis and strong with literalMidWordUndescores ([0292ae0](https://github.com/showdownjs/showdown/commit/0292ae0)), closes [#333](https://github.com/showdownjs/showdown/issues/333)
|
||||
* **paragraphs:** fix empty lines generating empty paragraphs ([54bf744](https://github.com/showdownjs/showdown/commit/54bf744)), closes [#334](https://github.com/showdownjs/showdown/issues/334)
|
||||
* **strikethrough:** fix strikethrough being wrongly parsed inside codeSpans ([169cbe8](https://github.com/showdownjs/showdown/commit/169cbe8))
|
||||
|
||||
### Features
|
||||
|
||||
* **events:** add events to all subparsers ([7d63a3e](https://github.com/showdownjs/showdown/commit/7d63a3e))
|
||||
|
||||
|
||||
|
||||
<a name="1.6.2"></a>
|
||||
## [1.6.2](https://github.com/showdownjs/showdown/compare/1.6.1...1.6.2) (2017-01-29)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **escapeSpecialCharsWithinTagAttributes:** add ~ and = to escaped chars ([bfcc0e4](https://github.com/showdownjs/showdown/commit/bfcc0e4))
|
||||
* **strikethrough:** allow escaping tilde char ([24d47d7](https://github.com/showdownjs/showdown/commit/24d47d7)), closes [#331](https://github.com/showdownjs/showdown/issues/331)
|
||||
|
||||
### Features
|
||||
|
||||
* **ghMentionsLink:** add ability to define the generated url in @mentions ([a4c24c9](https://github.com/showdownjs/showdown/commit/a4c24c9))
|
||||
|
||||
|
||||
|
||||
<a name="1.6.1"></a>
|
||||
## [1.6.1](https://github.com/showdownjs/showdown/compare/1.6.0...1.6.1) (2017-01-28)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **simplifiedAutoLink:** fix missing spaces before and after email addresses ([5190b6a](https://github.com/showdownjs/showdown/commit/5190b6a)), closes [#330](https://github.com/showdownjs/showdown/issues/330)
|
||||
|
||||
### Features
|
||||
|
||||
* **encodeEmail:** add option to enable/disable mail obfuscation ([90c52b8](https://github.com/showdownjs/showdown/commit/90c52b8))
|
||||
|
||||
### Notes
|
||||
|
||||
This release also improves performance a bit (around 8%)
|
||||
|
||||
|
||||
|
||||
<a name="1.6.0"></a>
|
||||
## [1.6.0](https://github.com/showdownjs/showdown/compare/1.5.5...1.6.0) (2017-01-09)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **ghCompatibleHeaderId:** improve the number of removed chars ([d499feb](https://github.com/showdownjs/showdown/commit/d499feb))
|
||||
* **IE8:** fix for IE8 error on using isUndefined function ([561dc5f](https://github.com/showdownjs/showdown/commit/561dc5f)), closes [#280](https://github.com/showdownjs/showdown/issues/280)
|
||||
* **options:** fix ghCompatibleHeaderId that was set as string instead of boolean ([de7c37e](https://github.com/showdownjs/showdown/commit/de7c37e))
|
||||
* **simpleLineBreaks:** fix simpleLineBreaks option not working with non-ASCII chars and markdown delimiters ([b1c458a](https://github.com/showdownjs/showdown/commit/b1c458a)), closes [#318](https://github.com/showdownjs/showdown/issues/318) [#323](https://github.com/showdownjs/showdown/issues/323)
|
||||
|
||||
### Features
|
||||
|
||||
* **CLI:** add -q (quiet) and -m (mute) mode to CLI ([f3b86f0](https://github.com/showdownjs/showdown/commit/f3b86f0))
|
||||
* **CLI:flavor:** add flavor option to CLI ([2d6cd1e](https://github.com/showdownjs/showdown/commit/2d6cd1e))
|
||||
* **getFlavor:** add getFlavor method to showdown and Converter ([0eaf105](https://github.com/showdownjs/showdown/commit/0eaf105))
|
||||
* **ghMentions:** add support for github's @mentions ([f2671c0](https://github.com/showdownjs/showdown/commit/f2671c0)), closes [#51](https://github.com/showdownjs/showdown/issues/51)
|
||||
|
||||
### BREAKING CHANGES:
|
||||
|
||||
* CLI tool now uses the same option defaults as showdown main library. This mean
|
||||
the default flavor is vanilla and ghCodeBlocks options is enabled by default.
|
||||
|
||||
To update, add `--ghCodeBlocks="false"` to the command.
|
||||
|
||||
|
||||
<a name="1.5.5"></a>
|
||||
## [1.5.5](https://github.com/showdownjs/showdown/compare/1.5.4...1.5.5) (2016-12-30)
|
||||
|
||||
### Features
|
||||
|
||||
* **ghCompatibleHeaderId:** generate header ids compatible with github ([db97a90](https://github.com/showdownjs/showdown/commit/db97a90)), closes [#320](https://github.com/showdownjs/showdown/issues/320) [#321](https://github.com/showdownjs/showdown/issues/321)
|
||||
|
||||
|
||||
|
||||
<a name="1.5.4"></a>
|
||||
## [1.5.4](https://github.com/showdownjs/showdown/compare/1.5.3...1.5.4) (2016-12-21)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **horizontal rule:** revert backwards incompatibility change ([113f5f6](https://github.com/showdownjs/showdown/commit/113f5f6)), closes [#317](https://github.com/showdownjs/showdown/issues/317)
|
||||
* **simpleLineBreaks:** fix simpleLineBreak option breaking lists html ([ed4c33f](https://github.com/showdownjs/showdown/commit/ed4c33f)), closes [#316](https://github.com/showdownjs/showdown/issues/316)
|
||||
|
||||
|
||||
|
||||
<a name="1.5.3"></a>
|
||||
## [1.5.3](https://github.com/showdownjs/showdown/compare/1.5.2...1.5.3) (2016-12-19)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* parser slowness with certain inputs ([da8fb53](https://github.com/showdownjs/showdown/commit/da8fb53)), closes [#315](https://github.com/showdownjs/showdown/issues/315)
|
||||
|
||||
### Features
|
||||
|
||||
* **requireSpaceBeforeHeadingText:** option to make space between `#` and header text mandatory ([5d19877](https://github.com/showdownjs/showdown/commit/5d19877)), closes [#277](https://github.com/showdownjs/showdown/issues/277)
|
||||
|
||||
|
||||
|
||||
<a name="1.5.2"></a>
|
||||
## [1.5.2](https://github.com/showdownjs/showdown/compare/1.5.1...1.5.2) (2016-12-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **listeners:** fix listeners typo ([f0d25b7](https://github.com/showdownjs/showdown/commit/f0d25b7)), closes [#290](https://github.com/showdownjs/showdown/issues/290)
|
||||
* **lists:** lines with multiple dashes being parsed as multilists ([10b3410](https://github.com/showdownjs/showdown/commit/10b3410)), closes [#312](https://github.com/showdownjs/showdown/issues/312)
|
||||
* **nbsp:** nbsp are replaced with simple spaces ([6e90f7c](https://github.com/showdownjs/showdown/commit/6e90f7c))
|
||||
|
||||
|
||||
|
||||
<a name="1.5.1"></a>
|
||||
## [1.5.1](https://github.com/showdownjs/showdown/compare/1.5.0...1.5.1) (2016-12-01)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **simpleLineBreaks:** option that parses linebreaks as <br />. This option enables linebreaks to always be treated as `<br />` tags
|
||||
without needing to add spaces in front of the line, the same way GitHub does. ([0942b5e](https://github.com/showdownjs/showdown/commit/0942b5e)), closes [#206](https://github.com/showdownjs/showdown/issues/206)
|
||||
* **excludeTrailingPunctuationFromURLs:** option that excludes trailing punctuation from auto linked URLs. ([d2fc2a0](https://github.com/showdownjs/showdown/commit/d2fc2a0)), closes [#266](https://github.com/showdownjs/showdown/issues/266) [#308](https://github.com/showdownjs/showdown/issues/308)
|
||||
|
||||
|
||||
|
||||
<a name="1.5.0"></a>
|
||||
## [1.5.0](https://github.com/showdownjs/showdown/compare/1.4.4...1.5.0) (2016-11-11)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **lists:** enforce 4 space indentation in sublists ([d51be6e](https://github.com/showdownjs/showdown/commit/d51be6e))
|
||||
* **lists:** fix sublists inconsistent behavior ([9cfe8b1](https://github.com/showdownjs/showdown/commit/9cfe8b1)), closes [#299](https://github.com/showdownjs/showdown/issues/299)
|
||||
|
||||
### Features
|
||||
|
||||
* **disableForced4SpacesIndentedSublists:** option that disables the requirement of indenting nested sublists by 4 spaces. The option is disabled by default ([0be39bc](https://github.com/showdownjs/showdown/commit/0be39bc))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* syntax for sublists is now more restrictive. Before, sublists SHOULD be indented by 4 spaces, but indenting at least 2 spaces would work.
|
||||
Now, sublists MUST be indented 4 spaces or they won't work.
|
||||
|
||||
With this input:
|
||||
```md
|
||||
* one
|
||||
* two
|
||||
* three
|
||||
```
|
||||
|
||||
Before (output):
|
||||
```html
|
||||
<ul>
|
||||
<li>one
|
||||
<ul>
|
||||
<li>two
|
||||
<ul><li>three</li></ul>
|
||||
<li>
|
||||
</ul>
|
||||
</li>
|
||||
<ul>
|
||||
```
|
||||
|
||||
After (output):
|
||||
```html
|
||||
<ul>
|
||||
<li>one</li>
|
||||
<li>two
|
||||
<ul><li>three</li></ul>
|
||||
</li>
|
||||
</ul>
|
||||
```
|
||||
|
||||
To migrate either fix source md files or activate the option `disableForced4SpacesIndentedSublists`:
|
||||
```md
|
||||
showdown.setOption('disableForced4SpacesIndentedSublists', true);
|
||||
```
|
||||
|
||||
|
||||
<a name="1.4.4"></a>
|
||||
## [1.4.4](https://github.com/showdownjs/showdown/compare/1.4.3...1.4.4) (2016-11-02)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* make some regexes a bit faster and make tab char equivalent to 4 spaces ([b7e7560](https://github.com/showdownjs/showdown/commit/b7e7560))
|
||||
* **double linebreaks:** fix double linebreaks in html output ([f97e072](https://github.com/showdownjs/showdown/commit/f97e072)), closes [#291](https://github.com/showdownjs/showdown/issues/291)
|
||||
* **lists linebreaks:** fix lists linebreaks in html output ([2b813cd](https://github.com/showdownjs/showdown/commit/2b813cd)), closes [#291](https://github.com/showdownjs/showdown/issues/291)
|
||||
* **parser:** fix issue with comments inside nested code blocks ([799abea](https://github.com/showdownjs/showdown/commit/799abea)), closes [#288](https://github.com/showdownjs/showdown/issues/288)
|
||||
|
||||
|
||||
|
||||
<a name="1.4.3"></a>
|
||||
## [1.4.3](https://github.com/showdownjs/showdown/compare/1.4.2...1.4.3) (2016-08-19)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **bower:** fix sourceMappingURL errors in bower by including source ([9b5a233](https://github.com/showdownjs/showdown/commit/9b5a233)), closes [#200](https://github.com/showdownjs/showdown/issues/200)
|
||||
* **comments:** Fix html comment parser ([238726c](https://github.com/showdownjs/showdown/commit/238726c)), closes [#276](https://github.com/showdownjs/showdown/issues/276)
|
||||
* **ie8 compatibility:** Improve ie8 compatibility ([984942e](https://github.com/showdownjs/showdown/commit/984942e)), closes [#275](https://github.com/showdownjs/showdown/issues/275) [#271](https://github.com/showdownjs/showdown/issues/271)
|
||||
* **simplifiedAutoLink:** fix simplified autolink to match GFM behavior ([0cc55b0](https://github.com/showdownjs/showdown/commit/0cc55b0)), closes [#284](https://github.com/showdownjs/showdown/issues/284) [#285](https://github.com/showdownjs/showdown/issues/285)
|
||||
|
||||
|
||||
|
||||
<a name="1.4.2"></a>
|
||||
## [1.4.2](https://github.com/showdownjs/showdown/compare/1.4.1...1.4.2) (2016-06-21)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **image-parser:** fix ref style imgs after inline style imgs not parsing correctly ([73206b0](https://github.com/showdownjs/showdown/commit/73206b0)), closes [#261](https://github.com/showdownjs/showdown/issues/261)
|
||||
* **tables:** add check for undefined on text due to failing to parse tables ([6e30a48](https://github.com/showdownjs/showdown/commit/6e30a48)), author [stewartmckee](https://github.com/stewartmckee), closes [#257](https://github.com/showdownjs/showdown/pull/247)
|
||||
|
||||
### Features
|
||||
|
||||
* **smart-indent-fix:** fix for es6 indentation problems ([261f127](https://github.com/showdownjs/showdown/commit/261f127)), closes [#259](https://github.com/showdownjs/showdown/issues/259)
|
||||
|
||||
|
||||
|
||||
<a name="1.4.1"></a>
|
||||
## [1.4.1](https://github.com/showdownjs/showdown/compare/1.4.0...1.4.1) (2016-05-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **tables:** fix table heading separators requiring 3 dashes instead of 2 ([ddaacfc](https://github.com/showdownjs/showdown/commit/ddaacfc)), closes [#256](https://github.com/showdownjs/showdown/issues/256)
|
||||
|
||||
|
||||
|
||||
<a name="1.4.0"></a>
|
||||
## [1.4.0](https://github.com/showdownjs/showdown/compare/1.3.0...1.4.0) (2016-05-13)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **hashHTMLBlock:** fix issue with html breaking markdown parsing ([2746949](https://github.com/showdownjs/showdown/commit/2746949)), closes [#220](https://github.com/showdownjs/showdown/issues/220)
|
||||
* **HTMLParser:** fix code tags parsing ([71a5873](https://github.com/showdownjs/showdown/commit/71a5873)), closes [#231](https://github.com/showdownjs/showdown/issues/231)
|
||||
* **HTMLParser:** fix ghCodeBlocks being parsed inside code tags ([7d0436d](https://github.com/showdownjs/showdown/commit/7d0436d)), closes [#229](https://github.com/showdownjs/showdown/issues/229)
|
||||
* **strikethrough:** Fix strikethrough issue with escaped chars ([5669317](https://github.com/showdownjs/showdown/commit/5669317)), closes [#214](https://github.com/showdownjs/showdown/issues/214)
|
||||
* **tables:** fix tables to match github's md spec ([f58f014](https://github.com/showdownjs/showdown/commit/f58f014)), closes [#230](https://github.com/showdownjs/showdown/issues/230)
|
||||
|
||||
### Features
|
||||
|
||||
* **markdown="1":** enable parsing markdown inside HTML blocks ([c97f1dc](https://github.com/showdownjs/showdown/commit/c97f1dc)), closes [#178](https://github.com/showdownjs/showdown/issues/178)
|
||||
|
||||
|
||||
|
||||
<a name="1.3.0"></a>
|
||||
## [1.3.0](https://github.com/showdownjs/showdown/compare/1.2.3...1.3.0) (2015-10-19)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **literalMidWordUnderscores:** fix different behavior with asterisks ([e86aea8](https://github.com/showdownjs/showdown/commit/e86aea8)), closes [#198](https://github.com/showdownjs/showdown/issues/198)
|
||||
* **simpleautolink:** fix mail simpleAutoLink to ignore urls with @ symbol ([8ebb25e](https://github.com/showdownjs/showdown/commit/8ebb25e)), closes [#204](https://github.com/showdownjs/showdown/issues/204)
|
||||
|
||||
### Features
|
||||
|
||||
* **eventDispatcher:** add an event dispatcher to converter ([2734326](https://github.com/showdownjs/showdown/commit/2734326))
|
||||
* **hashHTMLSpans:** add support for hashing span elements ([3097bd4](https://github.com/showdownjs/showdown/commit/3097bd4)), closes [#196](https://github.com/showdownjs/showdown/issues/196) [#175](https://github.com/showdownjs/showdown/issues/175)
|
||||
|
||||
|
||||
<a name"1.2.3"></a>
|
||||
## [1.2.3](https://github.com/showdownjs/showdown/compare/1.2.2...1.2.3) (2015-08-27)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **blockGamut:** fix for headings inside blockquotes ([3df70624](http://github.com/showdownjs/showdown/commit/3df70624), closes [#191](http://github.com/showdownjs/showdown/issues/191))
|
||||
* **blockQuote:** fix 'github style codeblocks' not being parsed inside 'blockquote' ([ed2cf595](http://github.com/showdownjs/showdown/commit/ed2cf595), closes [#192](http://github.com/showdownjs/showdown/issues/192))
|
||||
* **simpleAutoLinks:** fix emails being treated as simple urls ([7dc3fb1d](http://github.com/showdownjs/showdown/commit/7dc3fb1d), closes [#187](http://github.com/showdownjs/showdown/issues/187))
|
||||
* **tables:** fix md tables being parsed inside indented code blocks. ([50256233](http://github.com/showdownjs/showdown/commit/50256233), closes [#193](http://github.com/showdownjs/showdown/issues/193))
|
||||
|
||||
|
||||
<a name"1.2.2"></a>
|
||||
## [1.2.2](https://github.com/showdownjs/showdown/compare/1.2.1...1.2.2) (2015-08-02)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **lists:** fix github code blocks not being parsed inside lists ([7720c88b](http://github.com/showdownjs/showdown/commit/7720c88b), closes [#142](http://github.com/showdownjs/showdown/issues/142), [#183](http://github.com/showdownjs/showdown/issues/183), [#184](http://github.com/showdownjs/showdown/issues/184))
|
||||
|
||||
|
||||
<a name"1.2.1"></a>
|
||||
## [1.2.1](https://github.com/showdownjs/showdown/compare/1.2.0...1.2.1) (2015-07-22)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **smoothLivePreview:** fix weird effects due to parsing incomplete input ([62ba3733](http://github.com/showdownjs/showdown/commit/62ba3733))
|
||||
* **subParsers/githubCodeBlock:** add extra language class to conform to html5 spec ([b7f5e32](http://github.com/showdownjs/showdown/commit/b7f5e32))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **tables:**
|
||||
|
||||
* fix undefined error in malformed tables ([6176977](http://github.com/showdownjs/showdown/commit/6176977))
|
||||
* add support for md span elements in table headers ([789dc18](http://github.com/showdownjs/showdown/commit/789dc18)), closes [#179](http://github.com/showdownjs/showdown/issues/179)
|
||||
|
||||
* **italicsAndBold:**
|
||||
|
||||
* fix broken em/strong tags when used with literalMidWordUnderscores ([7ee2017](http://github.com/showdownjs/showdown/commit/7ee2017)), closes [#179](http://github.com/showdownjs/showdown/issues/179)
|
||||
* fix underscores not being correctly parsed when used in conjunction with literalMidWordsUnderscores option ([c9e85f1](http://github.com/showdownjs/showdown/commit/c9e85f1))
|
||||
|
||||
* **codeSpans:** Fix issue with code html tags not being correctly escaped ([5f043ca](http://github.com/showdownjs/showdown/commit/5f043ca))
|
||||
|
||||
* **images:** fix alt attribute not being escaped correctly ([542194e](http://github.com/showdownjs/showdown/commit/542194e))
|
||||
|
||||
|
||||
<a name"1.2.0"></a>
|
||||
## [1.2.0](https://github.com/showdownjs/showdown/compare/1.1.0...1.2.0) (2015-07-13)
|
||||
|
||||
This release moves some of the most popular extensions (such as table-extension and github-extension) to core.
|
||||
Also introduces a simple cli tool that you can use to quickly convert markdown files into html.
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **headerLevelStart:** fix for NaN error when specifying a non number as headerLevelStart param ([be72b487](http://github.com/showdownjs/showdown/commit/be72b487))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **CLI:** simple cli tool (ALPHA) ([f6a33e40](http://github.com/showdownjs/showdown/commit/f6a33e40))
|
||||
* **flavours:** add markdown presets/flavors ([7e55bceb](http://github.com/showdownjs/showdown/commit/7e55bceb), closes [#164](http://github.com/showdownjs/showdown/issues/164))
|
||||
* **ghCodeBlocks:** add option to disable GH codeblocks ([c33f9888](http://github.com/showdownjs/showdown/commit/c33f9888))
|
||||
* **literalMidWordUnderscores:** add support for GFM literal midword underscores ([0c0cd7db](http://github.com/showdownjs/showdown/commit/0c0cd7db))
|
||||
* **simplifiedAutoLink:** add support for GFM autolinks ([cff02372](http://github.com/showdownjs/showdown/commit/cff02372))
|
||||
* **strikethrough:** add support for GFM strikethrough ([43e9448d](http://github.com/showdownjs/showdown/commit/43e9448d))
|
||||
* **tables:** add support for GFM tables ([3a924e3c](http://github.com/showdownjs/showdown/commit/3a924e3c))
|
||||
* **tasklists:** add support for GFM tasklists ([dc72403a](http://github.com/showdownjs/showdown/commit/dc72403a))
|
||||
|
||||
|
||||
<a name"1.1.0"></a>
|
||||
## [1.1.0](https://github.com/showdownjs/showdown/compare/1.0.2...1.1.0) (2015-06-18)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **converter.js:** add error if the passed constructor argument is not an object ([d86ed450](http://github.com/showdownjs/showdown/commit/d86ed450))
|
||||
* **output modifiers:** fix for output modifiers running twice ([dcbdc61e](http://github.com/showdownjs/showdown/commit/dcbdc61e))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **headerLevelStart:** add support for setting the header starting level ([b84ac67d](http://github.com/showdownjs/showdown/commit/b84ac67d), closes [#69](http://github.com/showdownjs/showdown/issues/69))
|
||||
* **image dimensions:** add support for setting image dimensions within markdown syntax ([af82c2b6](http://github.com/showdownjs/showdown/commit/af82c2b6), closes [#143](http://github.com/showdownjs/showdown/issues/143))
|
||||
* **noHeaderId:** add option to suppress automatic generation of ids in headers ([7ac893e9](http://github.com/showdownjs/showdown/commit/7ac893e9))
|
||||
* **showdown.getDefaultOptions:** add method to retrieve default global options keypairs ([2de53a7d](http://github.com/showdownjs/showdown/commit/2de53a7d))
|
||||
|
||||
|
||||
### Breaking Changes
|
||||
|
||||
* Deprecates `showdown.extensions` property. To migrate, extensions should use the new method `showdown.extension(<ext name>, <extension>)` to register.
|
||||
For more information on the new extension loading mechanism, please check the wiki pages.
|
||||
([4ebd0caa](http://github.com/showdownjs/showdown/commit/4ebd0caa))
|
||||
|
||||
|
||||
<a name"1.0.2"></a>
|
||||
## [1.0.2](https://github.com/showdownjs/showdown/compare/1.0.1...1.0.2) (2015-05-28)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **Gruntfile.js** add missing comma in footer. This bug prevented concatenating other js scripts and libraries
|
||||
with showdown([5315508](http://github.com/showdownjs/showdown/commit/5315508). Credits to Alexandre Courtiol.
|
||||
|
||||
|
||||
<a name"1.0.1"></a>
|
||||
## [1.0.1](https://github.com/showdownjs/showdown/compare/1.0.0...1.0.1) (2015-05-27)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **bower.json:** update bower.json main attribute to point to dist directory ([bc3a092f](http://github.com/showdownjs/showdown/commit/bc3a092f))
|
||||
|
||||
|
||||
<a name"1.0.0"></a>
|
||||
## [1.0.0](https://github.com/showdownjs/showdown/compare/0.3.4...1.0.0) (2015-05-27)
|
||||
|
||||
### Release Information
|
||||
This is a major code refactor with some big changes such as:
|
||||
- showdown.js file was split in several files, called sub-parsers. This should improve code maintainability.
|
||||
- angular integration was removed from core and move to its own repository, similar to what was done with extensions
|
||||
- A new extension registering system is on the "cooks" that should reduce errors when using extensions. The old mechanism
|
||||
is kept so old extensions should be compatible.
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **extensions:** support for old extension loading mechanism ([95ed7c68](http://github.com/showdownjs/showdown/commit/95ed7c68))
|
||||
* **helpers:** fix wrong function call 'escapeCharacters' due to old strayed code ([18ba4e75](http://github.com/showdownjs/showdown/commit/18ba4e75))
|
||||
* **showdown.js:**
|
||||
- fix showdown extension loader ([a38c76d2](http://github.com/showdownjs/showdown/commit/a38c76d2)),
|
||||
closes [#50](http://github.com/showdownjs/showdown/issues/50),[#56](http://github.com/showdownjs/showdown/issues/56),
|
||||
[#104](http://github.com/showdownjs/showdown/issues/104), [#108](http://github.com/showdownjs/showdown/issues/108),
|
||||
[#109](http://github.com/showdownjs/showdown/issues/109), [#111](http://github.com/showdownjs/showdown/issues/111),
|
||||
[#118](http://github.com/showdownjs/showdown/issues/118), [#122](http://github.com/showdownjs/showdown/issues/122)
|
||||
- add unique id prefix and suffix to headers ([c367a4b9](http://github.com/showdownjs/showdown/commit/c367a4b9), closes [#81](http://github.com/showdownjs/showdown/issues/81), [#82](http://github.com/showdownjs/showdown/issues/82))
|
||||
* **options.omitExtraWLInCodeBlocks:** fix for options.omitExtraWLInCodeBlocks only applying in gitHub flavoured code b ([e6f40e19](http://github.com/showdownjs/showdown/commit/e6f40e19))
|
||||
* **showdown:** fix for options merging into globalOptions ([ddd6011d](http://github.com/showdownjs/showdown/commit/ddd6011d), closes [#153](http://github.com/showdownjs/showdown/issues/153))
|
||||
|
||||
### Features
|
||||
|
||||
* **registerExtension():** new extension loading mechanism. Now extensions can be registered using this function.
|
||||
The system, however, is not final and will probably be changed until the final version([0fd10cb] (http://github.com/showdownjs/showdown/commit/0fd10cb))
|
||||
* **allowBlockIndents:** indented inline block elements can now be parsed as markdown ([f6326b84](http://github.com/showdownjs/showdown/commit/f6326b84))
|
||||
* **omitExtraWLInCodeBlocks:** add option to omit extra newline at the end of codeblocks ([141e3f5](http://github.com/showdownjs/showdown/commit/141e3f5))
|
||||
* **prefixHeaderId:** add options to prefix header ids to prevent id clash ([141e3f5](http://github.com/showdownjs/showdown/commit/141e3f5))
|
||||
* **Converter.options:** add getOption(), setOption() and getOptions() to Converter object ([db6f79b0](http://github.com/showdownjs/showdown/commit/db6f79b0))
|
||||
|
||||
### Breaking Changes
|
||||
* **NAMESPACE:** showdown's namespace changed.
|
||||
|
||||
To migrate your code you should update all references to `Showdown` with `showdown`.
|
||||
|
||||
* **Converter:** converter reference changed from `converter` to `Converter`.
|
||||
|
||||
To migrate you should update all references to `Showdown.converter` with `showdown.Converter`
|
||||
|
||||
* **angular:** angular integration was removed from core and now lives in it's own [repository](http://github.com/showdownjs/angular/).
|
||||
|
||||
If you're using angular integration, you should install ng-showdown. Ex: `bower install ng-showdown`
|
||||
|
||||
* **extensions:** showdown extensions were removed from core package and now live in their own repository. See the [project's github page](https://github.com/showdownjs) for available extensions
|
||||
@@ -0,0 +1,74 @@
|
||||
Contributing
|
||||
============
|
||||
|
||||
If you wish to contribute please read the following quick guide.
|
||||
|
||||
# Issues (bug reporting)
|
||||
Generally, bug reports should be in the following format:
|
||||
|
||||
1. Description (Brief description of the problem)
|
||||
2. Input (input that is causing problems)
|
||||
3. Expected Output (Output that is expected)
|
||||
4. Actual Output (Actual showdown output)
|
||||
|
||||
ex:
|
||||
|
||||
**Description:**
|
||||
Double asterisks do not parse as bold
|
||||
|
||||
**Input:**
|
||||
|
||||
hello **world**!
|
||||
|
||||
**Expected output:**
|
||||
|
||||
<p>hello <b>world</b>!
|
||||
|
||||
**Actual Output:**
|
||||
|
||||
<p>hello **world**!</p>
|
||||
|
||||
|
||||
|
||||
# Want a Feature?
|
||||
You can request a new feature by submitting an issue. If you would like to implement a new feature feel free to issue a
|
||||
Pull Request.
|
||||
|
||||
|
||||
# Pull requests (PRs)
|
||||
PRs are awesome. However, before you submit your pull request consider the following guidelines:
|
||||
|
||||
- Search GitHub for an open or closed Pull Request that relates to your submission. You don't want to duplicate effort.
|
||||
- When issuing PRs that change code, make your changes in a new git branch based on develop:
|
||||
|
||||
```bash
|
||||
git checkout -b my-fix-branch develop
|
||||
```
|
||||
|
||||
- Run the full test suite before submitting and make sure all tests pass (obviously =P).
|
||||
- Try to follow our [**coding style rules**](https://github.com/showdownjs/code-style/blob/master/README.md).
|
||||
Breaking them prevents the PR to pass the tests.
|
||||
- Refrain from fixing multiple issues in the same pull request. It's preferable to open multiple small PRs instead of one
|
||||
hard to review big one. Also, don't reuse old forks (or PRs) to fix new issues.
|
||||
- If the PR introduces a new feature or fixes an issue, please add the appropriate test case.
|
||||
- We use commit notes to generate the changelog. It's extremely helpful if your commit messages adhere to the
|
||||
[**AngularJS Git Commit Guidelines**](https://github.com/showdownjs/code-style/blob/master/README.md#commit-message-convention).
|
||||
- If we suggest changes then:
|
||||
- Make the required updates.
|
||||
- Re-run the Angular test suite to ensure tests are still passing.
|
||||
- Rebase your branch and force push to your GitHub repository (this will update your Pull Request):
|
||||
|
||||
```bash
|
||||
git rebase develop -i
|
||||
git push origin my-fix-branch -f
|
||||
```
|
||||
- After your pull request is merged, you can safely delete your branch.
|
||||
|
||||
If you have time to contribute to this project, we feel obliged that you get credit for it.
|
||||
These rules enable us to review your PR faster and will give you appropriate credit in your GitHub profile.
|
||||
We thank you in advance for your contribution!
|
||||
|
||||
|
||||
# Joining the team
|
||||
We're looking for members to help maintaining Showdown.
|
||||
Please see [this issue](https://github.com/showdownjs/showdown/issues/114) to express interest or comment on this note.
|
||||
@@ -0,0 +1,52 @@
|
||||
Credits
|
||||
=======
|
||||
|
||||
- Showdown v2
|
||||
* [Estevão Santos](https://github.com/tivie)
|
||||
|
||||
- Showdown v1
|
||||
* [Estevão Santos](https://github.com/tivie)
|
||||
* [Pascal Deschênes](https://github.com/pdeschen)
|
||||
|
||||
- Showdown v0
|
||||
* [Corey Innis](http://github.com/coreyti):<br/>
|
||||
Original GitHub project maintainer
|
||||
* [Remy Sharp](https://github.com/remy/):<br/>
|
||||
CommonJS-compatibility and more
|
||||
* [Konstantin Käfer](https://github.com/kkaefer/):<br/>
|
||||
CommonJS packaging
|
||||
* [Roger Braun](https://github.com/rogerbraun):<br/>
|
||||
Github-style code blocks
|
||||
* [Dominic Tarr](https://github.com/dominictarr):<br/>
|
||||
Documentation
|
||||
* [Cat Chen](https://github.com/CatChen):<br/>
|
||||
Export fix
|
||||
* [Titus Stone](https://github.com/tstone):<br/>
|
||||
Mocha tests, extension mechanism, and bug fixes
|
||||
* [Rob Sutherland](https://github.com/roberocity):<br/>
|
||||
The idea that lead to extensions
|
||||
* [Pavel Lang](https://github.com/langpavel):<br/>
|
||||
Code cleanup
|
||||
* [Ben Combee](https://github.com/unwiredben):<br/>
|
||||
Regex optimization
|
||||
* [Adam Backstrom](https://github.com/abackstrom):<br/>
|
||||
WebKit bugfix
|
||||
* [Pascal Deschênes](https://github.com/pdeschen):<br/>
|
||||
Grunt support, extension fixes + additions, packaging improvements, documentation
|
||||
* [Estevão Santos](https://github.com/tivie)<br/>
|
||||
Bug fixing and late maintainer
|
||||
* [Hannah Wolfe](https://github.com/ErisDS)<br/>
|
||||
Bug fixes
|
||||
* [Alexandre Courtiol](https://github.com/acourtiol)<br/>
|
||||
Bug fixes and build optimization
|
||||
* [Karthik Balakrishnan](https://github.com/torcellite)<br/>
|
||||
Support for table alignment
|
||||
* [rheber](https://github.com/rheber)<br/>
|
||||
Cli
|
||||
|
||||
|
||||
- Original Project
|
||||
* [John Gruber](http://daringfireball.net/projects/markdown/)<br/>
|
||||
Author of Markdown
|
||||
* [John Fraser](http://attacklab.net/)<br/>
|
||||
Author of Showdown
|
||||
@@ -0,0 +1,57 @@
|
||||
We would like to thank everyone that contributed to this library. If you find our library useful and wish to donate as well, you can do so [through patreon](https://www.patreon.com/showdownjs) or directly [through paypal](https://www.paypal.me/tiviesantos)!! Your contribution will be greatly appreciated.
|
||||
|
||||
# Sponsors
|
||||
|
||||
## Platinum Supporters
|
||||
|
||||
## Gold Supporters
|
||||
|
||||
## Silver Supporters
|
||||
|
||||
|
||||
# Patron Supporters
|
||||
|
||||
## Awesome Supporter
|
||||
|
||||
## Cool Supporter
|
||||
|
||||
## Supporter
|
||||
|
||||
- Ricardo Jordão
|
||||
|
||||
- Tiago Silva
|
||||
|
||||
|
||||
---
|
||||
|
||||
# One Time Donors
|
||||
|
||||
- [**Learn on demand Systems**](http://www.learnondemandsystems.com/) (1000$)
|
||||
|
||||
- **Nothing AG** (25€)
|
||||
|
||||
> Thank you for developing Showdown :)
|
||||
|
||||
- **Sam Huffman** (15$)
|
||||
|
||||
> Thanks for the great work on showdown.js! I've been looking for a good solution to serve wiki-like text to a browser and render as
|
||||
HTML but nearly gave up after mixed success with wikitext. Your library gets me very close to where I want to be.
|
||||
|
||||
- **Maya Lekova** (10$)
|
||||
|
||||
> Great work with the showdown library! I just used it and it worked exactly the way I expected
|
||||
(given a complex inline HTML inside the Markdown, which renders fine with other viewers).
|
||||
The other libraries I've tried (markdown-it and marked) produced a lot of bogus output. Y
|
||||
our library saved me at least half a day, thanks! Good luck :)
|
||||
|
||||
- **Lin Wang** (10$)
|
||||
|
||||
- **Walter Schnell** (10$)
|
||||
|
||||
- **ivanhjc** (5$)
|
||||
|
||||
- **Asbjørn Ulsberg** (5$)
|
||||
|
||||
> Thanks for the ShowdownJS support!
|
||||
|
||||
- **Juan Marcelo Russo** (1$)
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018 ShowdownJS
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
521
src/main/webapp/static/global/plugins/showdown-master/README.md
Normal file
521
src/main/webapp/static/global/plugins/showdown-master/README.md
Normal file
@@ -0,0 +1,521 @@
|
||||
![Showdown][sd-logo]
|
||||
|
||||
[](https://travis-ci.org/showdownjs/showdown)
|
||||
[](https://ci.appveyor.com/project/tivie/showdown/branch/master)
|
||||
[](http://badge.fury.io/js/showdown)
|
||||
[](http://badge.fury.io/bo/showdown)
|
||||
[](https://gitter.im/showdownjs/showdown?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
[](https://greenkeeper.io/)
|
||||
[](https://www.paypal.me/tiviesantos)
|
||||
|
||||
------
|
||||
|
||||
Showdown is a Javascript Markdown to HTML converter, based on the original works by John Gruber.
|
||||
Showdown can be used client side (in the browser) or server side (with NodeJs).
|
||||
|
||||
## Live DEMO
|
||||
|
||||
Check a live Demo here http://demo.showdownjs.com/
|
||||
|
||||
## [](https://www.patreon.com/bePatron?u=11141581)
|
||||
|
||||
As you know, ShowdownJS is a free library and it will remain free forever. However, maintaining and improving the library costs time and money.
|
||||
|
||||
If you like our work and find our library useful, please donate through [patreon](https://www.patreon.com/showdownjs) or directly through [paypal](https://www.paypal.me/tiviesantos)!! Your contribution will be greatly appreciated and help me continue to develop this awesome library.
|
||||
|
||||
## License
|
||||
|
||||
ShowdownJS v 2.0 is release under the MIT version.
|
||||
Previous versions are release under GPL 2.0
|
||||
|
||||
## Who uses Showdown (or a fork)
|
||||
|
||||
- [GoogleCloudPlatform](https://github.com/GoogleCloudPlatform)
|
||||
- [Meteor](https://www.meteor.com/)
|
||||
- [Stackexchange](http://stackexchange.com/) - forked as [PageDown](https://code.google.com/p/pagedown/)
|
||||
- [docular](https://github.com/Vertafore/docular)
|
||||
- [md-page](https://github.com/oscarmorrison/md-page)
|
||||
- [and some others...](https://www.npmjs.com/browse/depended/showdown)
|
||||
|
||||
## Installation
|
||||
|
||||
### Download tarball
|
||||
|
||||
You can download the latest release tarball directly from [releases][releases]
|
||||
|
||||
### Bower
|
||||
|
||||
bower install showdown
|
||||
|
||||
### npm (server-side)
|
||||
|
||||
npm install showdown
|
||||
|
||||
### NuGet package
|
||||
|
||||
PM> Install-Package showdownjs
|
||||
|
||||
The NuGet Packages can be [found here](https://www.nuget.org/packages/showdownjs/).
|
||||
|
||||
### CDN
|
||||
|
||||
You can also use one of several CDNs available:
|
||||
|
||||
* github CDN
|
||||
|
||||
https://cdn.rawgit.com/showdownjs/showdown/<version tag>/dist/showdown.min.js
|
||||
|
||||
* cdnjs
|
||||
|
||||
https://cdnjs.cloudflare.com/ajax/libs/showdown/<version tag>/showdown.min.js
|
||||
|
||||
|
||||
## Browser Compatibility
|
||||
|
||||
Showdown has been tested successfully with:
|
||||
|
||||
* Firefox 1.5 and 2.0
|
||||
* Chrome 12.0
|
||||
* Internet Explorer 6 and 7
|
||||
* Safari 2.0.4
|
||||
* Opera 8.54 and 9.10
|
||||
* Netscape 8.1.2
|
||||
* Konqueror 3.5.4
|
||||
|
||||
In theory, Showdown will work in any browser that supports ECMA 262 3rd Edition (JavaScript 1.5).
|
||||
The converter itself might even work in things that aren't web browsers, like Acrobat. No promises.
|
||||
|
||||
|
||||
## Node compatibility
|
||||
|
||||
Showdown has been tested with node 0.8 and 0.10. However, it should work with previous versions, such as node 0.6.
|
||||
|
||||
|
||||
## Legacy version
|
||||
|
||||
If you're looking for showdown v<1.0.0, you can find it in the [**legacy branch**][legacy-branch].
|
||||
|
||||
## Changelog
|
||||
|
||||
You can check the full [changelog][changelog]
|
||||
|
||||
## Extended documentation
|
||||
Check our [wiki pages][wiki] for examples and a more in-depth documentation.
|
||||
|
||||
|
||||
## Quick Example
|
||||
|
||||
### Node
|
||||
|
||||
```js
|
||||
var showdown = require('showdown'),
|
||||
converter = new showdown.Converter(),
|
||||
text = '# hello, markdown!',
|
||||
html = converter.makeHtml(text);
|
||||
```
|
||||
|
||||
### Browser
|
||||
|
||||
```js
|
||||
var converter = new showdown.Converter(),
|
||||
text = '# hello, markdown!',
|
||||
html = converter.makeHtml(text);
|
||||
```
|
||||
|
||||
### Output
|
||||
|
||||
Both examples should output...
|
||||
|
||||
```html
|
||||
<h1 id="hellomarkdown">hello, markdown!</h1>
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
You can change some of showdown's default behavior through options.
|
||||
|
||||
### Setting options
|
||||
|
||||
Options can be set:
|
||||
|
||||
#### Globally
|
||||
|
||||
Setting a "global" option affects all instances of showdown
|
||||
|
||||
```js
|
||||
showdown.setOption('optionKey', 'value');
|
||||
```
|
||||
|
||||
#### Locally
|
||||
Setting a "local" option only affects the specified Converter object.
|
||||
Local options can be set:
|
||||
|
||||
* **through the constructor**
|
||||
```js
|
||||
var converter = new showdown.Converter({optionKey: 'value'});
|
||||
```
|
||||
|
||||
* **through the setOption() method**
|
||||
```js
|
||||
var converter = new showdown.Converter();
|
||||
converter.setOption('optionKey', 'value');
|
||||
```
|
||||
|
||||
### Getting an option
|
||||
|
||||
Showdown provides 2 methods (both local and global) to retrieve previous set options.
|
||||
|
||||
#### getOption()
|
||||
|
||||
```js
|
||||
// Global
|
||||
var myOption = showdown.getOption('optionKey');
|
||||
|
||||
//Local
|
||||
var myOption = converter.getOption('optionKey');
|
||||
```
|
||||
|
||||
#### getOptions()
|
||||
|
||||
```js
|
||||
// Global
|
||||
var showdownGlobalOptions = showdown.getOptions();
|
||||
|
||||
//Local
|
||||
var thisConverterSpecificOptions = converter.getOptions();
|
||||
```
|
||||
|
||||
### Retrieve the default options
|
||||
|
||||
You can get showdown's default options with:
|
||||
```js
|
||||
var defaultOptions = showdown.getDefaultOptions();
|
||||
```
|
||||
|
||||
### Valid Options
|
||||
|
||||
* **omitExtraWLInCodeBlocks**: (boolean) [default false] Omit the trailing newline in a code block. Ex:
|
||||
|
||||
This:
|
||||
```html
|
||||
<code><pre>var foo = 'bar';
|
||||
</pre></code>
|
||||
```
|
||||
Becomes this:
|
||||
```html
|
||||
<code><pre>var foo = 'bar';</pre></code>
|
||||
```
|
||||
|
||||
* **noHeaderId**: (boolean) [default false] Disable the automatic generation of header ids.
|
||||
Setting to true overrides **prefixHeaderId**
|
||||
|
||||
* **customizedHeaderId**: (boolean) [default false] Use text in curly braces as header id. **(since v1.7.0)**
|
||||
Example:
|
||||
```
|
||||
## Sample header {real-id} will use real-id as id
|
||||
```
|
||||
|
||||
* **ghCompatibleHeaderId**: (boolean) [default false] Generate header ids compatible with github style
|
||||
(spaces are replaced with dashes and a bunch of non alphanumeric chars are removed) **(since v1.5.5)**
|
||||
|
||||
* **prefixHeaderId**: (string/boolean) [default false] Add a prefix to the generated header ids.
|
||||
Passing a string will prefix that string to the header id. Setting to `true` will add a generic 'section' prefix.
|
||||
|
||||
* **rawPrefixHeaderId**: (boolean) [default false] Setting this option to true will prevent showdown from modifying the prefix.
|
||||
This might result in malformed IDs (if, for instance, the " char is used in the prefix).
|
||||
Has no effect if prefixHeaderId is set to false. **(since v 1.7.3)**
|
||||
|
||||
* **rawHeaderId**: (boolean) [default false] Remove only spaces, ' and " from generated header ids (including prefixes),
|
||||
replacing them with dashes (-). WARNING: This might result in malformed ids **(since v1.7.3)**
|
||||
|
||||
* **headerLevelStart**: (integer) [default 1] Set the header starting level. For instance, setting this to 3 means that
|
||||
|
||||
```md
|
||||
# foo
|
||||
```
|
||||
will be parsed as
|
||||
|
||||
```html
|
||||
<h3>foo</h3>
|
||||
```
|
||||
|
||||
* **parseImgDimensions**: (boolean) [default false] Enable support for setting image dimensions from within markdown syntax.
|
||||
Examples:
|
||||
```
|
||||
 simple, assumes units are in px
|
||||
 sets the height to "auto"
|
||||
 Image with width of 80% and height of 5em
|
||||
```
|
||||
|
||||
* **simplifiedAutoLink**: (boolean) [default false] Turning this option on will enable automatic linking to urls.
|
||||
This means that:
|
||||
|
||||
```md
|
||||
some text www.google.com
|
||||
```
|
||||
will be parsed as
|
||||
```html
|
||||
<p>some text <a href="www.google.com">www.google.com</a>
|
||||
```
|
||||
|
||||
* ~~**excludeTrailingPunctuationFromURLs**: (boolean) [default false] This option excludes trailing punctuation from autolinking urls.
|
||||
Punctuation excluded: `. ! ? ( )`. Only applies if **simplifiedAutoLink** option is set to `true`.~~
|
||||
|
||||
* **literalMidWordUnderscores**: (boolean) [default false] Turning this on will stop showdown from interpreting
|
||||
underscores in the middle of words as `<em>` and `<strong>` and instead treat them as literal underscores.
|
||||
|
||||
Example:
|
||||
|
||||
```md
|
||||
some text with__underscores__in middle
|
||||
```
|
||||
will be parsed as
|
||||
```html
|
||||
<p>some text with__underscores__in middle</p>
|
||||
```
|
||||
|
||||
* ~~**literalMidWordAsterisks**: (boolean) [default false] Turning this on will stop showdown from interpreting asterisks
|
||||
in the middle of words as `<em>` and `<strong>` and instead treat them as literal asterisks.~~
|
||||
|
||||
* **strikethrough**: (boolean) [default false] Enable support for strikethrough syntax.
|
||||
`~~strikethrough~~` as `<del>strikethrough</del>`
|
||||
|
||||
* **tables**: (boolean) [default false] Enable support for tables syntax. Example:
|
||||
|
||||
```md
|
||||
| h1 | h2 | h3 |
|
||||
|:------|:-------:|--------:|
|
||||
| 100 | [a][1] | ![b][2] |
|
||||
| *foo* | **bar** | ~~baz~~ |
|
||||
```
|
||||
|
||||
See the wiki for more info
|
||||
|
||||
* **tablesHeaderId**: (boolean) [default false] If enabled adds an id property to table headers tags.
|
||||
|
||||
* **ghCodeBlocks**: (boolean) [default true] Enable support for GFM code block style.
|
||||
|
||||
* **tasklists**: (boolean) [default false] Enable support for GFM tasklists. Example:
|
||||
|
||||
```md
|
||||
- [x] This task is done
|
||||
- [ ] This is still pending
|
||||
```
|
||||
* **smoothLivePreview**: (boolean) [default false] Prevents weird effects in live previews due to incomplete input
|
||||
|
||||
* **smartIndentationFix**: (boolean) [default false] Tries to smartly fix indentation problems related to es6 template
|
||||
strings in the midst of indented code.
|
||||
|
||||
* **disableForced4SpacesIndentedSublists**: (boolean) [default false] Disables the requirement of indenting sublists
|
||||
by 4 spaces for them to be nested, effectively reverting to the old behavior where 2 or 3 spaces were enough.
|
||||
**(since v1.5.0)**
|
||||
|
||||
* **simpleLineBreaks**: (boolean) [default false] Parses line breaks as <br>, without
|
||||
needing 2 spaces at the end of the line **(since v1.5.1)**
|
||||
|
||||
```md
|
||||
a line
|
||||
wrapped in two
|
||||
```
|
||||
|
||||
turns into:
|
||||
|
||||
```html
|
||||
<p>a line<br>
|
||||
wrapped in two</p>
|
||||
```
|
||||
|
||||
* **requireSpaceBeforeHeadingText**: (boolean) [default false] Makes adding a space between `#` and the header text mandatory **(since v1.5.3)**
|
||||
|
||||
* **ghMentions**: (boolean) [default false] Enables github @mentions, which link to the username mentioned **(since v1.6.0)**
|
||||
|
||||
* **ghMentionsLink**: (string) [default `https://github.com/{u}`] Changes the link generated by @mentions.
|
||||
Showdown will replace `{u}` with the username. Only applies if ghMentions option is enabled.
|
||||
Example: `@tivie` with ghMentionsOption set to `//mysite.com/{u}/profile` will result in `<a href="//mysite.com/tivie/profile">@tivie</a>`
|
||||
|
||||
* **encodeEmails**: (boolean) [default true] Enable e-mail addresses encoding through the use of Character Entities, transforming ASCII e-mail addresses into its equivalent decimal entities. (since v1.6.1)
|
||||
|
||||
NOTE: Prior to version 1.6.1, emails would always be obfuscated through dec and hex encoding.
|
||||
|
||||
* **openLinksInNewWindow**: (boolean) [default false] Open all links in new windows
|
||||
(by adding the attribute `target="_blank"` to `<a>` tags) **(since v1.7.0)**
|
||||
|
||||
* **backslashEscapesHTMLTags**: (boolean) [default false] Support for HTML Tag escaping. ex: `\<div>foo\</div>` **(since v1.7.2)**
|
||||
|
||||
* **emoji**: (boolean) [default false] Enable emoji support. Ex: `this is a :smile: emoji`
|
||||
For more info on available emojis, see https://github.com/showdownjs/showdown/wiki/Emojis **(since v.1.8.0)**
|
||||
|
||||
* **underline**: (boolean) [default false] ***EXPERIMENTAL FEATURE*** Enable support for underline.
|
||||
Syntax is **double** or **triple** **underscores** ex: `__underlined word__`. With this option enabled, underscores are no longer parses into `<em>` and `<strong>`.
|
||||
|
||||
* **completeHTMLDocument**: (boolean) [default false] Outputs a complete html document,
|
||||
including `<html>`, `<head>` and `<body>` tags' instead of an HTML fragment. (since v.1.8.5)
|
||||
|
||||
* **metadata**: (boolean) [default false] Enable support for document metadata (defined at the top of the document
|
||||
between `«««` and `»»»` or between `---` and `---`). (since v.1.8.5)
|
||||
|
||||
```js
|
||||
var conv = new showdown.Converter({metadata: true});
|
||||
var html = conv.makeHtml(someMd);
|
||||
var metadata = conv.getMetadata(); // returns an object with the document metadata
|
||||
```
|
||||
|
||||
* **splitAdjacentBlockquotes**: (boolean) [default false] Split adjacent blockquote blocks.(since v.1.8.6)
|
||||
|
||||
**NOTE**: Please note that until **version 1.6.0**, all of these options are ***DISABLED*** by default in the cli tool.
|
||||
|
||||
|
||||
## Flavors
|
||||
|
||||
You can also use flavors or presets to set the correct options automatically, so that showdown behaves like popular markdown flavors.
|
||||
|
||||
Currently, the following flavors are available:
|
||||
|
||||
* original - original markdown flavor as in [John Gruber's spec](https://daringfireball.net/projects/markdown/)
|
||||
* vanilla - showdown base flavor (as from v1.3.1)
|
||||
* github - GFM (GitHub Flavored Markdown)
|
||||
|
||||
|
||||
### Global
|
||||
```javascript
|
||||
showdown.setFlavor('github');
|
||||
```
|
||||
|
||||
### Instance
|
||||
```javascript
|
||||
converter.setFlavor('github');
|
||||
```
|
||||
|
||||
|
||||
## CLI Tool
|
||||
|
||||
Showdown also comes bundled with a Command Line Interface tool. You can check the [CLI wiki page][cli-wiki] for more info
|
||||
|
||||
## Integration with AngularJS
|
||||
|
||||
ShowdownJS project also provides seamlessly integration with AngularJS via a "plugin".
|
||||
Please visit https://github.com/showdownjs/ngShowdown for more information.
|
||||
|
||||
## Integration with TypeScript
|
||||
|
||||
If you're using TypeScript you maybe want to use the types from [DefinitelyTyped][definitely-typed]
|
||||
|
||||
## Integration with SystemJS/JSPM
|
||||
|
||||
Integration with SystemJS can be obtained via the third party ["system-md" plugin](https://github.com/guybedford/system-md).
|
||||
|
||||
## Integration with VueJS
|
||||
|
||||
To use ShowdownJS as a Vue component quickly, you can check [vue-showdown](https://vue-showdown.js.org/).
|
||||
|
||||
## XSS vulnerability
|
||||
|
||||
Showdown doesn't sanitize the input. This is by design since markdown relies on it to allow certain features to be correctly parsed into HTML.
|
||||
This, however, means XSS injection is quite possible.
|
||||
|
||||
Please refer to the wiki article [Markdown's XSS Vulnerability (and how to mitigate it)][xss-wiki]
|
||||
for more information.
|
||||
|
||||
## Extensions
|
||||
|
||||
Showdown allows additional functionality to be loaded via extensions. (you can find a list of known showdown extensions [here][ext-wiki])
|
||||
You can also find a boilerplate, to create your own extensions in [this repository][boilerplate-repo]
|
||||
|
||||
### Client-side Extension Usage
|
||||
|
||||
```js
|
||||
<script src="showdown.js" />
|
||||
<script src="twitter-extension.js" />
|
||||
|
||||
var converter = new showdown.Converter({ extensions: ['twitter'] });
|
||||
```
|
||||
|
||||
### Server-side Extension Usage
|
||||
|
||||
```js
|
||||
var showdown = require('showdown'),
|
||||
myExtension = require('myExtension'),
|
||||
converter = new showdown.Converter({ extensions: ['myExtension'] });
|
||||
```
|
||||
|
||||
## Tests
|
||||
|
||||
A suite of tests is available which require node.js. Once node is installed, run the following command from
|
||||
the project root to install the dependencies:
|
||||
|
||||
npm install
|
||||
|
||||
Once installed the tests can be run from the project root using:
|
||||
|
||||
npm test
|
||||
|
||||
New test cases can easily be added. Create a markdown file (ending in `.md`) which contains the markdown to test.
|
||||
Create a `.html` file of the exact same name. It will automatically be tested when the tests are executed with `mocha`.
|
||||
|
||||
## Contributing
|
||||
|
||||
If you wish to contribute please read the following quick guide.
|
||||
|
||||
### Want a Feature?
|
||||
You can request a new feature by submitting an issue. If you would like to implement a new feature feel free to issue a
|
||||
Pull Request.
|
||||
|
||||
|
||||
### Pull requests (PRs)
|
||||
PRs are awesome. However, before you submit your pull request consider the following guidelines:
|
||||
|
||||
- Search GitHub for an open or closed Pull Request that relates to your submission. You don't want to duplicate effort.
|
||||
- When issuing PRs that change code, make your changes in a new git branch based on master:
|
||||
|
||||
```bash
|
||||
git checkout -b my-fix-branch master
|
||||
```
|
||||
|
||||
- Documentation (i.e: README.md) changes can be made directly against master.
|
||||
- Run the full test suite before submitting and make sure all tests pass (obviously =P).
|
||||
- Try to follow our [**coding style rules**][coding-rules].
|
||||
Breaking them prevents the PR to pass the tests.
|
||||
- Refrain from fixing multiple issues in the same pull request. It's preferable to open multiple small PRs instead of one
|
||||
hard to review big one.
|
||||
- If the PR introduces a new feature or fixes an issue, please add the appropriate test case.
|
||||
- We use commit notes to generate the changelog. It's extremely helpful if your commit messages adhere to the
|
||||
[**AngularJS Git Commit Guidelines**][ng-commit-guide].
|
||||
- If we suggest changes then:
|
||||
- Make the required updates.
|
||||
- Re-run the Angular test suite to ensure tests are still passing.
|
||||
- Rebase your branch and force push to your GitHub repository (this will update your Pull Request):
|
||||
|
||||
```bash
|
||||
git rebase master -i
|
||||
git push origin my-fix-branch -f
|
||||
```
|
||||
- After your pull request is merged, you can safely delete your branch.
|
||||
|
||||
If you have time to contribute to this project, we feel obliged that you get credit for it.
|
||||
These rules enable us to review your PR faster and will give you appropriate credit in your GitHub profile.
|
||||
We thank you in advance for your contribution!
|
||||
|
||||
### Joining the team
|
||||
We're looking for members to help maintaining Showdown.
|
||||
Please see [this issue](https://github.com/showdownjs/showdown/issues/114) to express interest or comment on this note.
|
||||
|
||||
## Credits
|
||||
Full credit list at https://github.com/showdownjs/showdown/blob/master/CREDITS.md
|
||||
|
||||
Showdown is powered by:<br/>
|
||||
[](https://www.jetbrains.com/webstorm/)
|
||||
|
||||
|
||||
|
||||
[sd-logo]: https://raw.githubusercontent.com/showdownjs/logo/master/dist/logo.readme.png
|
||||
[legacy-branch]: https://github.com/showdownjs/showdown/tree/legacy
|
||||
[releases]: https://github.com/showdownjs/showdown/releases
|
||||
[changelog]: https://github.com/showdownjs/showdown/blob/master/CHANGELOG.md
|
||||
[wiki]: https://github.com/showdownjs/showdown/wiki
|
||||
[cli-wiki]: https://github.com/showdownjs/showdown/wiki/CLI-tool
|
||||
[definitely-typed]: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/showdown
|
||||
[xss-wiki]: https://github.com/showdownjs/showdown/wiki/Markdown's-XSS-Vulnerability-(and-how-to-mitigate-it)
|
||||
[ext-wiki]: https://github.com/showdownjs/showdown/wiki/extensions
|
||||
[coding-rules]: https://github.com/showdownjs/code-style/blob/master/README.md
|
||||
[ng-commit-guide]: https://github.com/showdownjs/code-style/blob/master/README.md#commit-message-convention
|
||||
[boilerplate-repo]: https://github.com/showdownjs/extension-boilerplate
|
||||
@@ -0,0 +1,140 @@
|
||||
# ROADMAP TO VERSION 2.0
|
||||
|
||||
|
||||
## Options
|
||||
|
||||
- [ ] **ghCompatibleHeaderId** (removal)
|
||||
|
||||
Will be removed and **will become the default behavior**.
|
||||
|
||||
- [ ] **customizedHeaderId** (removal)
|
||||
|
||||
This option introduced non compliant syntax so it really belongs in an extension.
|
||||
The new **listener extension system** allows users to directly modify and customize
|
||||
the HTML and add any attributes they wish.
|
||||
|
||||
- [ ] **rawPrefixHeaderId** (removal)
|
||||
|
||||
This option will be superseeded by the option `rawHeaderId`. So basically activating `rawHeaderId` will make
|
||||
showdown only to replace spaces, ', ", > and < with dashes (-) from generated header ids, including prefixes.
|
||||
|
||||
- [X] **literalMidWordAsterisks** (removal)
|
||||
|
||||
This option is weird, hard to maintain and really... makes little sense.
|
||||
|
||||
- [X] **excludeTrailingPunctuationFromURLs** (removal)
|
||||
|
||||
This option will be removed and will be the default behavior from now on.
|
||||
|
||||
- [ ] **strikethrough** (change)
|
||||
|
||||
Will be enabled by default
|
||||
|
||||
- [ ] **disableForced4SpacesIndentedSublists** (to think/postpone)
|
||||
|
||||
This was only a temporary option for backwards compatibility reason. However, most flavours support lists indented
|
||||
with 2 spaces, so it puts us in a tight spot, specially since some markdown beautifiers out there insist in
|
||||
indenting lists with 2 spaces, probably in a misguided try to follow the CommonMark spec.
|
||||
|
||||
The CommonMark spec is, IMHO, a bit confusing for users regarding this, since list sub-blocks (and lists)
|
||||
are determined by the spaces from the start of the line and the first character after the list mark. And the proof
|
||||
are the MD beautifiers out there, which misinterpreted the spec and made a mess
|
||||
|
||||
Showdown syntax is actually easier (and fully compliant with the original spec): if you indent something 4 spaces,
|
||||
it becomes a sub-block. Since lists are blocks, you must indent it 4 spaces for it to become a sub-block.
|
||||
|
||||
Regardless, we kinda have 2 solutions:
|
||||
|
||||
- Drop support for 2 space indentation (and make a lot of users confused since GFM, CommonMark and others allow this)
|
||||
- Create a new list subparser that can be turned on with an option, like gfmListStyle
|
||||
(but postpones even more the alpha 2.0 release since the list subparser is probably the hardest thing to rewrite)
|
||||
|
||||
Tough choices...
|
||||
|
||||
- [ ] **simpleLineBreaks** (change)
|
||||
|
||||
Will be removed from Github Flavor since github only does this in comments (which is weird...)
|
||||
|
||||
- [ ] **openLinksInNewWindow** (removal)
|
||||
|
||||
Will be removed in favor of the new listener extension, which will allow users to manipulate HTML tags attributes
|
||||
directly.
|
||||
|
||||
- [ ] Revamp the option system
|
||||
|
||||
Revamp the option system so that it becomes more simple. Right now, it's really confusing. And option names are weird
|
||||
too. The idea is to pass options to the constructor under an option object, that can have hierarchical structure.
|
||||
Ex:
|
||||
|
||||
```js
|
||||
var conv = new showdown.Converter({
|
||||
options: {
|
||||
links: {
|
||||
autoLinks: true
|
||||
},
|
||||
headings: {
|
||||
startLevel: 2
|
||||
}
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
## Legacy Code Removal
|
||||
- [ ] Legacy extension support
|
||||
|
||||
Old extensions that inject directly into extensions object property will no longer be supported
|
||||
|
||||
- [ ] HTML and OUTPUT extensions
|
||||
|
||||
HTML and OTP extensions will be dropped in favor of Listener Extensions. We might even give them a new name
|
||||
|
||||
## Subparsers
|
||||
- [X] **Anchors**: Revamp the anchors subparser so it calls strikethrough, bold, italic and underline directly
|
||||
- [X] **autoLinks**: Fix some lingering bugs and issues with autolinks
|
||||
|
||||
## Priority Bugs
|
||||
- [X] **#355**: *simplifiedAutoLink URLs inside parenthesis followed by another character are not parsed correctly*
|
||||
- [X] **#534**: *Multiple parentheses () in url link is not parsed correctly*
|
||||
- [ ] **#367**: *sublists rendering with 2 spaces* - related to disableForced4SpacesIndentedSublists option...
|
||||
- [ ] **#537**: *master branch doesn't work in a web worker*
|
||||
|
||||
## CLI
|
||||
- [ ] Refactor the CLI
|
||||
- [ ] **#381**: *Support for src and dst directories in showdown cli*
|
||||
- [ ] **#584**: *Fails to read from stdin*
|
||||
- [ ] **#554**: *CLI not working with jsdom v10*
|
||||
|
||||
## Other stuff
|
||||
- [X] Regexp rewrite for more performance oompf
|
||||
- [ ] Full unit testing
|
||||
- [ ] Better error reporting
|
||||
|
||||
## Stuff that probably won't make it to v2.0
|
||||
- [ ] **#486**: *A backslash at the end of the line is a hard line break*
|
||||
- [ ] **#548**: *anchors and images of subParser are errors when they are specific strings*
|
||||
- [ ] **#549**: *Strange parsing issue with `<pre><code>`*
|
||||
- [ ] Rethink the global variable
|
||||
|
||||
## NEW Features
|
||||
|
||||
### Event system
|
||||
- [X] Listener system revamp
|
||||
- [ ] Standardize events for all event types
|
||||
- [ ] Unit testing
|
||||
- [ ] Functional testing
|
||||
|
||||
This should address:
|
||||
- **#567**: Allow not making header ids lowercase
|
||||
- **#540**: Add complete class to the tasklist list element
|
||||
|
||||
### MD to HTML conversion
|
||||
- [X] Basic support
|
||||
- [X] Basic functional testcase
|
||||
- [ ] Advanced support for all showdown MD features
|
||||
- [ ] Advanced functional testcase
|
||||
- [ ] Unit testing
|
||||
|
||||
## Documentation (for v2.0)
|
||||
- [ ] Options
|
||||
- [ ] Extensions (and the new event system)
|
||||
- [ ] Cookbook (with stuff for backwards compatibility, specially regarding removed options)
|
||||
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env node
|
||||
require('../src/cli/cli');
|
||||
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"name": "showdown",
|
||||
"description": "A Markdown to HTML converter written in Javascript",
|
||||
"homepage": "https://github.com/showdownjs/showdown",
|
||||
"authors": [
|
||||
"Estevão Santos (https://github.com/tivie)",
|
||||
"Pascal Deschênes (https://github.com/pdeschen)"
|
||||
],
|
||||
"main": ["dist/showdown.js"],
|
||||
"ignore": [
|
||||
".editorconfig",
|
||||
".gitattributes",
|
||||
".gitignore",
|
||||
".jscs.json",
|
||||
".jshintignore",
|
||||
".jshintrc",
|
||||
".travis.yml",
|
||||
"Gruntfile.js",
|
||||
"package.json",
|
||||
"test/*"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/showdownjs/showdown.git"
|
||||
},
|
||||
"keywords": [
|
||||
"markdown",
|
||||
"md",
|
||||
"mdown"
|
||||
],
|
||||
"license": "https://github.com/showdownjs/showdown/blob/master/license.txt"
|
||||
}
|
||||
5460
src/main/webapp/static/global/plugins/showdown-master/dist/showdown.js
vendored
Normal file
5460
src/main/webapp/static/global/plugins/showdown-master/dist/showdown.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
src/main/webapp/static/global/plugins/showdown-master/dist/showdown.js.map
vendored
Normal file
1
src/main/webapp/static/global/plugins/showdown-master/dist/showdown.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
3
src/main/webapp/static/global/plugins/showdown-master/dist/showdown.min.js
vendored
Normal file
3
src/main/webapp/static/global/plugins/showdown-master/dist/showdown.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
src/main/webapp/static/global/plugins/showdown-master/dist/showdown.min.js.map
vendored
Normal file
1
src/main/webapp/static/global/plugins/showdown-master/dist/showdown.min.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -0,0 +1,149 @@
|
||||
# Event System
|
||||
|
||||
## Introduction
|
||||
|
||||
|
||||
## The Event Object
|
||||
|
||||
|
||||
## Events
|
||||
|
||||
Events are raised when a subparser is run (or about to be run).
|
||||
Within a subparser, the events always follow a certain order (sequence). For instance, **.before** events always run before **.captureStart**.
|
||||
Each subparser raises several events sequentially:
|
||||
|
||||
1. **.start**: **always runs** except it subparser is disabled
|
||||
|
||||
Raised when the **subparser has started**, but no capturing or any modification to the text was done.
|
||||
|
||||
**Always runs** (except if the subparser is deactivated through options).
|
||||
|
||||
***Properties***:
|
||||
|
||||
| property | type | access | description |
|
||||
|----------|-----------|------------|--------------------------------------------------------------------|
|
||||
| input | string | read | The full text that was passed to the subparser |
|
||||
| output | string | write | The full text with modification that will be passed along the chain|
|
||||
| regex | null | | |
|
||||
| matches | null | | |
|
||||
|
||||
Usually you would want to use this event if you wish to change the input to the subparser
|
||||
|
||||
2. **.captureStart**: *might not be run*;
|
||||
|
||||
Raised when a regex match is found and a capture was successful. Some normalization and modification
|
||||
of the regex captured groups might be performed.
|
||||
|
||||
Might not be run if no regex match is found.
|
||||
|
||||
***Properties***:
|
||||
|
||||
| property | type | access | description |
|
||||
|----------|-----------|------------|--------------------------------------------------------------------|
|
||||
| input | string | read | The captured text |
|
||||
| output | string | write | The text that will be passed to the subparser/other listeners |
|
||||
| regex | RegExp | readonly | Regular Expression used to capture groups |
|
||||
| matches | object | read/write | Matches groups. Changes to this object are reflected in the output |
|
||||
|
||||
Usually you would want to use this event if you wish to modify a certain subparser behavior.
|
||||
Exs: remove all title attributes from links; change indentation of code blocks; etc...
|
||||
|
||||
3. **.captureEnd**: *might not be run*;
|
||||
|
||||
Raised after the modifications to the captured text are done but before the replacement is introduced in the document.
|
||||
|
||||
Might not be run if no regex match is found.
|
||||
|
||||
***Properties***:
|
||||
|
||||
| property | type | access | description |
|
||||
|------------|-----------|------------|--------------------------------------------------------------------------------|
|
||||
| input | string | read | The captured text |
|
||||
| output | string | write | The text that will be passed to the subparser/other listeners |
|
||||
| regex | RegExp | readonly | Regular Expression used to capture groups |
|
||||
| matches | object | read/write | Keypairs of matches groups. Changes to this object are reflected in the output |
|
||||
| attributes | object | read/write | Attributes to add to the HTML output |
|
||||
|
||||
4. **.beforeHash**: *might not be run*;
|
||||
|
||||
Raised before the output is hashed.
|
||||
|
||||
Always run (except if the subparser was deactivated through options), even if no hashing is performed.
|
||||
|
||||
***Properties***:
|
||||
|
||||
| property | type | access | description |
|
||||
|----------|------------|------------|--------------------------------------------------------------------|
|
||||
| input | string | read | The captured text |
|
||||
| output | string | write | The text that will be passed to the subparser/other listeners |
|
||||
| regex | null | | |
|
||||
| matches | null | | |
|
||||
|
||||
Usually you would want to use this event if you wish change the subparser output before it is hashed
|
||||
|
||||
5. **.end**: *always runs*;
|
||||
|
||||
Raised when the subparser has finished its work and is about to exit.
|
||||
|
||||
Always runs (except if the subparser is deactivated through options).
|
||||
|
||||
***Properties***:
|
||||
|
||||
| property | type | access | description |
|
||||
|----------|-----------|------------|--------------------------------------------------------------------|
|
||||
| input | string | read | The partial/full text with the subparser modifications |
|
||||
| output | string | write | The text that will be passed to other subparsers |
|
||||
| regex | null | | |
|
||||
| matches | null | | |
|
||||
|
||||
Usually you would want to use this event if you wish change the subparser hashed output
|
||||
|
||||
|
||||
### Special Events
|
||||
|
||||
There are some special events that are useful for *"positioning"* a listener extension in the main chain of events.
|
||||
Usually these extensions introduce new syntax that, due to precedence
|
||||
These events are always guaranteed to be called, regardless of options or circumstances.
|
||||
|
||||
1. **.before_{subparserName}**: *always runs*
|
||||
|
||||
Raised just before the **{subparserName} is about to be entered**.
|
||||
|
||||
***Properties***:
|
||||
|
||||
| property | type | access | description |
|
||||
|----------|-----------|------------|--------------------------------------------------------------------|
|
||||
| input | string | read | The full text that was passed to the subparser |
|
||||
| output | string | write | The full text with modification that will be passed along the chain|
|
||||
| regex | null | | |
|
||||
| matches | null | | |
|
||||
|
||||
2. **.after**.{subparserName}: *always runs*;
|
||||
|
||||
Raised when the **{subparserName} has exited** and before the next one is called.
|
||||
|
||||
***Properties***:
|
||||
|
||||
| property | type | access | description |
|
||||
|----------|-----------|------------|--------------------------------------------------------------------|
|
||||
| input | string | read | The partial/full text with the subparser modifications |
|
||||
| output | string | write | The text that will be passed to other subparsers |
|
||||
| regex | null | | |
|
||||
| matches | null | | |
|
||||
|
||||
|
||||
### Notes
|
||||
|
||||
- There are 2 main differences between **before.{subparserName}** and **{subparserName}.start**.
|
||||
|
||||
1. **before.{subparserName}** is always guaranteed to be called, even if the subparser is disabled,
|
||||
while **{subparserName}.start** doesn't.
|
||||
|
||||
ex: `makehtml.before.strikethrough` is always called even if the option `strikethrough` is false
|
||||
|
||||
2. **before.{subparserName}** is only raised once in a span context while **{subparserName}.start** is raised
|
||||
everytime **{subparserName}** is called.
|
||||
|
||||
As a rule of thumb,
|
||||
|
||||
## Events List
|
||||
@@ -0,0 +1,9 @@
|
||||
# Index
|
||||
|
||||
1. Options
|
||||
2. Subparsers
|
||||
3. [Event System](event_system.md)
|
||||
1. [Introduction](event_system.md#introduction)
|
||||
2. [The Event Object](event_system.md#the-event-object)
|
||||
3. [Events](event_system.md#events)
|
||||
4. [Events List](event_system.md#events-list)
|
||||
4317
src/main/webapp/static/global/plugins/showdown-master/package-lock.json
generated
Normal file
4317
src/main/webapp/static/global/plugins/showdown-master/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,65 @@
|
||||
{
|
||||
"name": "showdown",
|
||||
"version": "2.0.0-alpha1",
|
||||
"description": "A Markdown to HTML converter written in Javascript",
|
||||
"author": "Estevão Santos",
|
||||
"homepage": "http://showdownjs.com/",
|
||||
"keywords": [
|
||||
"markdown",
|
||||
"converter"
|
||||
],
|
||||
"contributors": [
|
||||
"John Gruber",
|
||||
"John Fraser",
|
||||
"Corey Innis",
|
||||
"Remy Sharp",
|
||||
"Konstantin Käfer",
|
||||
"Roger Braun",
|
||||
"Dominic Tarr",
|
||||
"Cat Chen",
|
||||
"Titus Stone",
|
||||
"Rob Sutherland",
|
||||
"Pavel Lang",
|
||||
"Ben Combee",
|
||||
"Adam Backstrom",
|
||||
"Pascal Deschênes",
|
||||
"Estevão Santos"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/showdownjs/showdown.git",
|
||||
"web": "https://github.com/showdownjs/showdown"
|
||||
},
|
||||
"license": "BSD-3-Clause",
|
||||
"main": "./dist/showdown.js",
|
||||
"scripts": {
|
||||
"test": "grunt test"
|
||||
},
|
||||
"bin": {
|
||||
"showdown": "bin/showdown.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"chai": "4.1.x",
|
||||
"grunt": "^1.0.3",
|
||||
"grunt-contrib-clean": "1.1.x",
|
||||
"grunt-contrib-concat": "1.0.x",
|
||||
"grunt-contrib-jshint": "1.1.x",
|
||||
"grunt-contrib-uglify": "~3.3.0",
|
||||
"grunt-conventional-changelog": "6.1.x",
|
||||
"grunt-conventional-github-releaser": "1.0.x",
|
||||
"grunt-endline": "0.6.x",
|
||||
"grunt-eslint": "19.0.x",
|
||||
"grunt-simple-mocha": "0.4.x",
|
||||
"load-grunt-tasks": "3.5.x",
|
||||
"performance-now": "2.0.x",
|
||||
"quiet-grunt": "0.2.x",
|
||||
"semver": "5.4.x",
|
||||
"semver-sort": "0.0.x",
|
||||
"sinon": "^5.1.1",
|
||||
"source-map-support": "^0.5.9"
|
||||
},
|
||||
"dependencies": {
|
||||
"jsdom": "^11.0.0",
|
||||
"yargs": "^12.0.2"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
* Created by tivie
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
var yargs = require('yargs');
|
||||
|
||||
yargs
|
||||
.version()
|
||||
.alias('v', 'version')
|
||||
.option('h', {
|
||||
alias: 'help',
|
||||
description: 'Show help'
|
||||
})
|
||||
.option('q', {
|
||||
alias: 'quiet',
|
||||
description: 'Quiet mode. Only print errors',
|
||||
type: 'boolean',
|
||||
default: false
|
||||
})
|
||||
.option('m', {
|
||||
alias: 'mute',
|
||||
description: 'Mute mode. Does not print anything',
|
||||
type: 'boolean',
|
||||
default: false
|
||||
})
|
||||
.usage('Usage: showdown <command> [options]')
|
||||
.demand(1, 'You must provide a valid command')
|
||||
.command('makehtml', 'Converts markdown into html')
|
||||
.example('showdown makehtml -i foo.md -o bar.html', 'Converts \'foo.md\' to \'bar.html\'')
|
||||
.wrap(yargs.terminalWidth());
|
||||
|
||||
var argv = yargs.argv,
|
||||
command = argv._[0];
|
||||
|
||||
if (command === 'makehtml') {
|
||||
require('./makehtml.cmd.js').run();
|
||||
} else {
|
||||
yargs.showHelp();
|
||||
}
|
||||
|
||||
if (argv.help) {
|
||||
yargs.showHelp();
|
||||
}
|
||||
process.exit(0);
|
||||
@@ -0,0 +1,195 @@
|
||||
var yargs = require('yargs'),
|
||||
fs = require('fs'),
|
||||
Messenger = require('./messenger.js'),
|
||||
showdown = require('../../dist/showdown'),
|
||||
showdownOptions = showdown.getDefaultOptions(false);
|
||||
|
||||
yargs.reset()
|
||||
.usage('Usage: showdown makehtml [options]')
|
||||
.example('showdown makehtml -i', 'Reads from stdin and outputs to stdout')
|
||||
.example('showdown makehtml -i foo.md -o bar.html', 'Reads \'foo.md\' and writes to \'bar.html\'')
|
||||
.example('showdown makehtml -i --flavor="github"', 'Parses stdin using GFM style')
|
||||
.version()
|
||||
.alias('v', 'version')
|
||||
.config('c')
|
||||
.alias('c', 'config')
|
||||
.help('h')
|
||||
.alias('h', 'help')
|
||||
.option('i', {
|
||||
alias : 'input',
|
||||
describe: 'Input source. Usually a md file. If omitted or empty, reads from stdin',
|
||||
type: 'string'
|
||||
})
|
||||
.option('o', {
|
||||
alias : 'output',
|
||||
describe: 'Output target. Usually a html file. If omitted or empty, writes to stdout',
|
||||
type: 'string',
|
||||
default: false
|
||||
})
|
||||
.option('u', {
|
||||
alias : 'encoding',
|
||||
describe: 'Input encoding',
|
||||
type: 'string'
|
||||
})
|
||||
.option('a', {
|
||||
alias : 'append',
|
||||
describe: 'Append data to output instead of overwriting',
|
||||
type: 'string',
|
||||
default: false
|
||||
})
|
||||
.option('e', {
|
||||
alias : 'extensions',
|
||||
describe: 'Load the specified extensions. Should be valid paths to node compatible extensions',
|
||||
type: 'array'
|
||||
})
|
||||
.option('p', {
|
||||
alias : 'flavor',
|
||||
describe: 'Run with a predetermined flavor of options. Default is vanilla',
|
||||
type: 'string'
|
||||
})
|
||||
.option('q', {
|
||||
alias: 'quiet',
|
||||
description: 'Quiet mode. Only print errors',
|
||||
type: 'boolean',
|
||||
default: false
|
||||
})
|
||||
.option('m', {
|
||||
alias: 'mute',
|
||||
description: 'Mute mode. Does not print anything',
|
||||
type: 'boolean',
|
||||
default: false
|
||||
});
|
||||
|
||||
// load showdown default options
|
||||
for (var opt in showdownOptions) {
|
||||
if (showdownOptions.hasOwnProperty(opt)) {
|
||||
if (showdownOptions[opt].defaultValue === false) {
|
||||
showdownOptions[opt].default = null;
|
||||
} else {
|
||||
showdownOptions[opt].default = showdownOptions[opt].defaultValue;
|
||||
}
|
||||
yargs.option(opt, showdownOptions[opt]);
|
||||
}
|
||||
}
|
||||
|
||||
function run () {
|
||||
'use strict';
|
||||
var argv = yargs.argv,
|
||||
readMode = (!argv.i || argv.i === '') ? 'stdin' : 'file',
|
||||
writeMode = (!argv.o || argv.o === '') ? 'stdout' : 'file',
|
||||
msgMode = (writeMode === 'file') ? 'stdout' : 'stderr',
|
||||
/**
|
||||
* MSG object
|
||||
* @type {Messenger}
|
||||
*/
|
||||
messenger = new Messenger(msgMode, argv.q, argv.m),
|
||||
read = (readMode === 'stdin') ? readFromStdIn : readFromFile,
|
||||
write = (writeMode === 'stdout') ? writeToStdOut : writeToFile,
|
||||
enc = argv.encoding || 'utf8',
|
||||
flavor = argv.p,
|
||||
append = argv.a || false,
|
||||
options = parseOptions(flavor),
|
||||
converter = new showdown.Converter(options),
|
||||
md, html;
|
||||
|
||||
// Load extensions
|
||||
if (argv.e) {
|
||||
messenger.printMsg('Loading extensions');
|
||||
for (var i = 0; i < argv.e.length; ++i) {
|
||||
try {
|
||||
var ext = require(argv.e[i]);
|
||||
converter.addExtension(ext, argv.e[i]);
|
||||
} catch (e) {
|
||||
messenger.printError('Could not load extension ' + argv.e[i] + '. Reason:');
|
||||
messenger.errorExit(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
messenger.printMsg('...');
|
||||
// read the input
|
||||
messenger.printMsg('Reading data from ' + readMode + '...');
|
||||
md = read(enc);
|
||||
|
||||
// process the input
|
||||
messenger.printMsg('Parsing markdown...');
|
||||
html = converter.makeHtml(md);
|
||||
|
||||
// write the output
|
||||
messenger.printMsg('Writing data to ' + writeMode + '...');
|
||||
write(html, append);
|
||||
messenger.okExit();
|
||||
|
||||
function parseOptions (flavor) {
|
||||
var options = {},
|
||||
flavorOpts = showdown.getFlavorOptions(flavor) || {};
|
||||
|
||||
// if flavor is not undefined, let's tell the user we're loading that preset
|
||||
if (flavor) {
|
||||
messenger.printMsg('Loading ' + flavor + ' flavor.');
|
||||
}
|
||||
|
||||
for (var opt in argv) {
|
||||
if (argv.hasOwnProperty(opt)) {
|
||||
// first we load the default options
|
||||
if (showdownOptions.hasOwnProperty(opt) && showdownOptions[opt].default !== null) {
|
||||
options[opt] = showdownOptions[opt].default;
|
||||
}
|
||||
|
||||
// we now override defaults with flavor, if a flavor was indeed passed
|
||||
if (flavorOpts.hasOwnProperty(opt)) {
|
||||
options[opt] = flavorOpts[opt];
|
||||
}
|
||||
|
||||
// lastly we override with explicit passed options
|
||||
// being careful not to pass CLI specific options, such as -v, -h or --extensions
|
||||
if (showdownOptions.hasOwnProperty(opt)) {
|
||||
if (argv[opt] === true) {
|
||||
messenger.printMsg('Enabling option ' + opt);
|
||||
options[opt] = argv[opt];
|
||||
} else if (argv[opt] === false) {
|
||||
options[opt] = argv[opt];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return options;
|
||||
}
|
||||
|
||||
function readFromStdIn () {
|
||||
try {
|
||||
var size = fs.fstatSync(process.stdin.fd).size;
|
||||
return size > 0 ? fs.readSync(process.stdin.fd, size)[0] : '';
|
||||
} catch (e) {
|
||||
var err = new Error('Could not read from stdin, reason: ' + e.message);
|
||||
messenger.errorExit(err);
|
||||
}
|
||||
}
|
||||
|
||||
function readFromFile (encoding) {
|
||||
try {
|
||||
return fs.readFileSync(argv.i, encoding);
|
||||
} catch (err) {
|
||||
messenger.errorExit(err);
|
||||
}
|
||||
}
|
||||
|
||||
function writeToStdOut (html) {
|
||||
return process.stdout.write(html);
|
||||
}
|
||||
|
||||
function writeToFile (html, append) {
|
||||
// If a flag is passed, it means we should append instead of overwriting.
|
||||
// Only works with files, obviously
|
||||
var write = (append) ? fs.appendFileSync : fs.writeFileSync;
|
||||
try {
|
||||
write(argv.o, html);
|
||||
} catch (err) {
|
||||
messenger.errorExit(err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = exports = {
|
||||
run: run
|
||||
};
|
||||
@@ -0,0 +1,40 @@
|
||||
function Messenger (writeMode, supress, mute) {
|
||||
'use strict';
|
||||
writeMode = writeMode || 'stderr';
|
||||
supress = (!!supress || !!mute);
|
||||
mute = !!mute;
|
||||
this._print = (writeMode === 'stdout') ? console.log : console.error;
|
||||
|
||||
this.errorExit = function (e) {
|
||||
if (!mute) {
|
||||
console.error('ERROR: ' + e.message);
|
||||
console.error('Run \'showdown <command> -h\' for help');
|
||||
}
|
||||
process.exit(1);
|
||||
};
|
||||
|
||||
this.okExit = function () {
|
||||
if (!mute) {
|
||||
this._print('\n');
|
||||
this._print('DONE!');
|
||||
}
|
||||
process.exit(0);
|
||||
};
|
||||
|
||||
this.printMsg = function (msg) {
|
||||
if (supress || mute || !msg) {
|
||||
return;
|
||||
}
|
||||
this._print(msg);
|
||||
};
|
||||
|
||||
this.printError = function (msg) {
|
||||
if (mute) {
|
||||
return;
|
||||
}
|
||||
console.error(msg);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
module.exports = Messenger;
|
||||
@@ -0,0 +1,602 @@
|
||||
/**
|
||||
* Created by Estevao on 31-05-2015.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Showdown Converter class
|
||||
* @class
|
||||
* @param {object} [converterOptions]
|
||||
* @returns {Converter}
|
||||
*/
|
||||
showdown.Converter = function (converterOptions) {
|
||||
'use strict';
|
||||
|
||||
var
|
||||
/**
|
||||
* Options used by this converter
|
||||
* @private
|
||||
* @type {{}}
|
||||
*/
|
||||
options = {},
|
||||
|
||||
/**
|
||||
* Language extensions used by this converter
|
||||
* @private
|
||||
* @type {Array}
|
||||
*/
|
||||
langExtensions = [],
|
||||
|
||||
/**
|
||||
* Output modifiers extensions used by this converter
|
||||
* @private
|
||||
* @type {Array}
|
||||
*/
|
||||
outputModifiers = [],
|
||||
|
||||
/**
|
||||
* Event listeners
|
||||
* @private
|
||||
* @type {{}}
|
||||
*/
|
||||
listeners = {},
|
||||
|
||||
/**
|
||||
* The flavor set in this converter
|
||||
*/
|
||||
setConvFlavor = setFlavor,
|
||||
|
||||
/**
|
||||
* Metadata of the document
|
||||
* @type {{parsed: {}, raw: string, format: string}}
|
||||
*/
|
||||
metadata = {
|
||||
parsed: {},
|
||||
raw: '',
|
||||
format: ''
|
||||
};
|
||||
|
||||
_constructor();
|
||||
|
||||
/**
|
||||
* Converter constructor
|
||||
* @private
|
||||
*/
|
||||
function _constructor () {
|
||||
converterOptions = converterOptions || {};
|
||||
|
||||
for (var gOpt in globalOptions) {
|
||||
if (globalOptions.hasOwnProperty(gOpt)) {
|
||||
options[gOpt] = globalOptions[gOpt];
|
||||
}
|
||||
}
|
||||
|
||||
// Merge options
|
||||
if (typeof converterOptions === 'object') {
|
||||
for (var opt in converterOptions) {
|
||||
if (converterOptions.hasOwnProperty(opt)) {
|
||||
options[opt] = converterOptions[opt];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw Error('Converter expects the passed parameter to be an object, but ' + typeof converterOptions +
|
||||
' was passed instead.');
|
||||
}
|
||||
|
||||
if (options.extensions) {
|
||||
showdown.helper.forEach(options.extensions, _parseExtension);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse extension
|
||||
* @param {*} ext
|
||||
* @param {string} [name='']
|
||||
* @private
|
||||
*/
|
||||
function _parseExtension (ext, name) {
|
||||
|
||||
name = name || null;
|
||||
// If it's a string, the extension was previously loaded
|
||||
if (showdown.helper.isString(ext)) {
|
||||
ext = showdown.helper.stdExtName(ext);
|
||||
name = ext;
|
||||
|
||||
// LEGACY_SUPPORT CODE
|
||||
if (showdown.extensions[ext]) {
|
||||
console.warn('DEPRECATION WARNING: ' + ext + ' is an old extension that uses a deprecated loading method.' +
|
||||
'Please inform the developer that the extension should be updated!');
|
||||
legacyExtensionLoading(showdown.extensions[ext], ext);
|
||||
return;
|
||||
// END LEGACY SUPPORT CODE
|
||||
|
||||
} else if (!showdown.helper.isUndefined(extensions[ext])) {
|
||||
ext = extensions[ext];
|
||||
|
||||
} else {
|
||||
throw Error('Extension "' + ext + '" could not be loaded. It was either not found or is not a valid extension.');
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof ext === 'function') {
|
||||
ext = ext();
|
||||
}
|
||||
|
||||
if (!showdown.helper.isArray(ext)) {
|
||||
ext = [ext];
|
||||
}
|
||||
|
||||
var validExt = validate(ext, name);
|
||||
if (!validExt.valid) {
|
||||
throw Error(validExt.error);
|
||||
}
|
||||
|
||||
for (var i = 0; i < ext.length; ++i) {
|
||||
switch (ext[i].type) {
|
||||
|
||||
case 'lang':
|
||||
langExtensions.push(ext[i]);
|
||||
break;
|
||||
|
||||
case 'output':
|
||||
outputModifiers.push(ext[i]);
|
||||
break;
|
||||
}
|
||||
if (ext[i].hasOwnProperty('listeners')) {
|
||||
for (var ln in ext[i].listeners) {
|
||||
if (ext[i].listeners.hasOwnProperty(ln)) {
|
||||
listen(ln, ext[i].listeners[ln]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* LEGACY_SUPPORT
|
||||
* @param {*} ext
|
||||
* @param {string} name
|
||||
*/
|
||||
function legacyExtensionLoading (ext, name) {
|
||||
if (typeof ext === 'function') {
|
||||
ext = ext(new showdown.Converter());
|
||||
}
|
||||
if (!showdown.helper.isArray(ext)) {
|
||||
ext = [ext];
|
||||
}
|
||||
var valid = validate(ext, name);
|
||||
|
||||
if (!valid.valid) {
|
||||
throw Error(valid.error);
|
||||
}
|
||||
|
||||
for (var i = 0; i < ext.length; ++i) {
|
||||
switch (ext[i].type) {
|
||||
case 'lang':
|
||||
langExtensions.push(ext[i]);
|
||||
break;
|
||||
case 'output':
|
||||
outputModifiers.push(ext[i]);
|
||||
break;
|
||||
default:// should never reach here
|
||||
throw Error('Extension loader error: Type unrecognized!!!');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Listen to an event
|
||||
* @param {string} name
|
||||
* @param {function} callback
|
||||
*/
|
||||
function listen (name, callback) {
|
||||
if (!showdown.helper.isString(name)) {
|
||||
throw Error('Invalid argument in converter.listen() method: name must be a string, but ' + typeof name + ' given');
|
||||
}
|
||||
|
||||
if (typeof callback !== 'function') {
|
||||
throw Error('Invalid argument in converter.listen() method: callback must be a function, but ' + typeof callback + ' given');
|
||||
}
|
||||
name = name.toLowerCase();
|
||||
if (!listeners.hasOwnProperty(name)) {
|
||||
listeners[name] = [];
|
||||
}
|
||||
listeners[name].push(callback);
|
||||
}
|
||||
|
||||
function rTrimInputText (text) {
|
||||
var rsp = text.match(/^\s*/)[0].length,
|
||||
rgx = new RegExp('^\\s{0,' + rsp + '}', 'gm');
|
||||
return text.replace(rgx, '');
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {string} evtName Event name
|
||||
* @param {string} text Text
|
||||
* @param {{}} options Converter Options
|
||||
* @param {{}} globals Converter globals
|
||||
* @param {{}} pParams extra params for event
|
||||
* @returns showdown.helper.Event
|
||||
* @private
|
||||
*/
|
||||
this._dispatch = function dispatch (evtName, text, options, globals, pParams) {
|
||||
evtName = evtName.toLowerCase();
|
||||
var params = pParams || {};
|
||||
params.converter = this;
|
||||
params.text = text;
|
||||
params.options = options;
|
||||
params.globals = globals;
|
||||
var event = new showdown.helper.Event(evtName, text, params);
|
||||
|
||||
if (listeners.hasOwnProperty(evtName)) {
|
||||
for (var ei = 0; ei < listeners[evtName].length; ++ei) {
|
||||
var nText = listeners[evtName][ei](event);
|
||||
if (nText && typeof nText !== 'undefined') {
|
||||
event.setText(nText);
|
||||
}
|
||||
}
|
||||
}
|
||||
return event;
|
||||
};
|
||||
|
||||
/**
|
||||
* Listen to an event
|
||||
* @param {string} name
|
||||
* @param {function} callback
|
||||
* @returns {showdown.Converter}
|
||||
*/
|
||||
this.listen = function (name, callback) {
|
||||
listen(name, callback);
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts a markdown string into HTML string
|
||||
* @param {string} text
|
||||
* @returns {*}
|
||||
*/
|
||||
this.makeHtml = function (text) {
|
||||
//check if text is not falsy
|
||||
if (!text) {
|
||||
return text;
|
||||
}
|
||||
|
||||
var globals = {
|
||||
gHtmlBlocks: [],
|
||||
gHtmlMdBlocks: [],
|
||||
gHtmlSpans: [],
|
||||
gUrls: {},
|
||||
gTitles: {},
|
||||
gDimensions: {},
|
||||
gListLevel: 0,
|
||||
hashLinkCounts: {},
|
||||
langExtensions: langExtensions,
|
||||
outputModifiers: outputModifiers,
|
||||
converter: this,
|
||||
ghCodeBlocks: [],
|
||||
metadata: {
|
||||
parsed: {},
|
||||
raw: '',
|
||||
format: ''
|
||||
}
|
||||
};
|
||||
|
||||
// This lets us use ¨ trema as an escape char to avoid md5 hashes
|
||||
// The choice of character is arbitrary; anything that isn't
|
||||
// magic in Markdown will work.
|
||||
text = text.replace(/¨/g, '¨T');
|
||||
|
||||
// Replace $ with ¨D
|
||||
// RegExp interprets $ as a special character
|
||||
// when it's in a replacement string
|
||||
text = text.replace(/\$/g, '¨D');
|
||||
|
||||
// Standardize line endings
|
||||
text = text.replace(/\r\n/g, '\n'); // DOS to Unix
|
||||
text = text.replace(/\r/g, '\n'); // Mac to Unix
|
||||
|
||||
// Stardardize line spaces
|
||||
text = text.replace(/\u00A0/g, ' ');
|
||||
|
||||
if (options.smartIndentationFix) {
|
||||
text = rTrimInputText(text);
|
||||
}
|
||||
|
||||
// Make sure text begins and ends with a couple of newlines:
|
||||
text = '\n\n' + text + '\n\n';
|
||||
|
||||
// detab
|
||||
text = showdown.subParser('makehtml.detab')(text, options, globals);
|
||||
|
||||
/**
|
||||
* Strip any lines consisting only of spaces and tabs.
|
||||
* This makes subsequent regexs easier to write, because we can
|
||||
* match consecutive blank lines with /\n+/ instead of something
|
||||
* contorted like /[ \t]*\n+/
|
||||
*/
|
||||
text = text.replace(/^[ \t]+$/mg, '');
|
||||
|
||||
//run languageExtensions
|
||||
showdown.helper.forEach(langExtensions, function (ext) {
|
||||
text = showdown.subParser('makehtml.runExtension')(ext, text, options, globals);
|
||||
});
|
||||
|
||||
// run the sub parsers
|
||||
text = showdown.subParser('makehtml.metadata')(text, options, globals);
|
||||
text = showdown.subParser('makehtml.hashPreCodeTags')(text, options, globals);
|
||||
text = showdown.subParser('makehtml.githubCodeBlocks')(text, options, globals);
|
||||
text = showdown.subParser('makehtml.hashHTMLBlocks')(text, options, globals);
|
||||
text = showdown.subParser('makehtml.hashCodeTags')(text, options, globals);
|
||||
text = showdown.subParser('makehtml.stripLinkDefinitions')(text, options, globals);
|
||||
text = showdown.subParser('makehtml.blockGamut')(text, options, globals);
|
||||
text = showdown.subParser('makehtml.unhashHTMLSpans')(text, options, globals);
|
||||
text = showdown.subParser('makehtml.unescapeSpecialChars')(text, options, globals);
|
||||
|
||||
// attacklab: Restore dollar signs
|
||||
text = text.replace(/¨D/g, '$$');
|
||||
|
||||
// attacklab: Restore tremas
|
||||
text = text.replace(/¨T/g, '¨');
|
||||
|
||||
// render a complete html document instead of a partial if the option is enabled
|
||||
text = showdown.subParser('makehtml.completeHTMLDocument')(text, options, globals);
|
||||
|
||||
// Run output modifiers
|
||||
showdown.helper.forEach(outputModifiers, function (ext) {
|
||||
text = showdown.subParser('makehtml.runExtension')(ext, text, options, globals);
|
||||
});
|
||||
|
||||
// update metadata
|
||||
metadata = globals.metadata;
|
||||
return text;
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts an HTML string into a markdown string
|
||||
* @param src
|
||||
* @returns {string}
|
||||
*/
|
||||
this.makeMarkdown = function (src) {
|
||||
|
||||
// replace \r\n with \n
|
||||
src = src.replace(/\r\n/g, '\n');
|
||||
src = src.replace(/\r/g, '\n'); // old macs
|
||||
|
||||
// due to an edge case, we need to find this: > <
|
||||
// to prevent removing of non silent white spaces
|
||||
// ex: <em>this is</em> <strong>sparta</strong>
|
||||
src = src.replace(/>[ \t]+</, '>¨NBSP;<');
|
||||
|
||||
var doc = showdown.helper.document.createElement('div');
|
||||
doc.innerHTML = src;
|
||||
|
||||
var globals = {
|
||||
preList: substitutePreCodeTags(doc)
|
||||
};
|
||||
|
||||
// remove all newlines and collapse spaces
|
||||
clean(doc);
|
||||
|
||||
// some stuff, like accidental reference links must now be escaped
|
||||
// TODO
|
||||
// doc.innerHTML = doc.innerHTML.replace(/\[[\S\t ]]/);
|
||||
|
||||
var nodes = doc.childNodes,
|
||||
mdDoc = '';
|
||||
|
||||
for (var i = 0; i < nodes.length; i++) {
|
||||
mdDoc += showdown.subParser('makeMarkdown.node')(nodes[i], globals);
|
||||
}
|
||||
|
||||
function clean (node) {
|
||||
for (var n = 0; n < node.childNodes.length; ++n) {
|
||||
var child = node.childNodes[n];
|
||||
if (child.nodeType === 3) {
|
||||
if (!/\S/.test(child.nodeValue)) {
|
||||
node.removeChild(child);
|
||||
--n;
|
||||
} else {
|
||||
child.nodeValue = child.nodeValue.split('\n').join(' ');
|
||||
child.nodeValue = child.nodeValue.replace(/(\s)+/g, '$1');
|
||||
}
|
||||
} else if (child.nodeType === 1) {
|
||||
clean(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// find all pre tags and replace contents with placeholder
|
||||
// we need this so that we can remove all indentation from html
|
||||
// to ease up parsing
|
||||
function substitutePreCodeTags (doc) {
|
||||
|
||||
var pres = doc.querySelectorAll('pre'),
|
||||
presPH = [];
|
||||
|
||||
for (var i = 0; i < pres.length; ++i) {
|
||||
|
||||
if (pres[i].childElementCount === 1 && pres[i].firstChild.tagName.toLowerCase() === 'code') {
|
||||
var content = pres[i].firstChild.innerHTML.trim(),
|
||||
language = pres[i].firstChild.getAttribute('data-language') || '';
|
||||
|
||||
// if data-language attribute is not defined, then we look for class language-*
|
||||
if (language === '') {
|
||||
var classes = pres[i].firstChild.className.split(' ');
|
||||
for (var c = 0; c < classes.length; ++c) {
|
||||
var matches = classes[c].match(/^language-(.+)$/);
|
||||
if (matches !== null) {
|
||||
language = matches[1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// unescape html entities in content
|
||||
content = showdown.helper.unescapeHTMLEntities(content);
|
||||
|
||||
presPH.push(content);
|
||||
pres[i].outerHTML = '<precode language="' + language + '" precodenum="' + i.toString() + '"></precode>';
|
||||
} else {
|
||||
presPH.push(pres[i].innerHTML);
|
||||
pres[i].innerHTML = '';
|
||||
pres[i].setAttribute('prenum', i.toString());
|
||||
}
|
||||
}
|
||||
return presPH;
|
||||
}
|
||||
|
||||
return mdDoc;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set an option of this Converter instance
|
||||
* @param {string} key
|
||||
* @param {*} value
|
||||
*/
|
||||
this.setOption = function (key, value) {
|
||||
options[key] = value;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the option of this Converter instance
|
||||
* @param {string} key
|
||||
* @returns {*}
|
||||
*/
|
||||
this.getOption = function (key) {
|
||||
return options[key];
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the options of this Converter instance
|
||||
* @returns {{}}
|
||||
*/
|
||||
this.getOptions = function () {
|
||||
return options;
|
||||
};
|
||||
|
||||
/**
|
||||
* Add extension to THIS converter
|
||||
* @param {{}} extension
|
||||
* @param {string} [name=null]
|
||||
*/
|
||||
this.addExtension = function (extension, name) {
|
||||
name = name || null;
|
||||
_parseExtension(extension, name);
|
||||
};
|
||||
|
||||
/**
|
||||
* Use a global registered extension with THIS converter
|
||||
* @param {string} extensionName Name of the previously registered extension
|
||||
*/
|
||||
this.useExtension = function (extensionName) {
|
||||
_parseExtension(extensionName);
|
||||
};
|
||||
|
||||
/**
|
||||
* Set the flavor THIS converter should use
|
||||
* @param {string} name
|
||||
*/
|
||||
this.setFlavor = function (name) {
|
||||
if (!flavor.hasOwnProperty(name)) {
|
||||
throw Error(name + ' flavor was not found');
|
||||
}
|
||||
var preset = flavor[name];
|
||||
setConvFlavor = name;
|
||||
for (var option in preset) {
|
||||
if (preset.hasOwnProperty(option)) {
|
||||
options[option] = preset[option];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the currently set flavor of this converter
|
||||
* @returns {string}
|
||||
*/
|
||||
this.getFlavor = function () {
|
||||
return setConvFlavor;
|
||||
};
|
||||
|
||||
/**
|
||||
* Remove an extension from THIS converter.
|
||||
* Note: This is a costly operation. It's better to initialize a new converter
|
||||
* and specify the extensions you wish to use
|
||||
* @param {Array} extension
|
||||
*/
|
||||
this.removeExtension = function (extension) {
|
||||
if (!showdown.helper.isArray(extension)) {
|
||||
extension = [extension];
|
||||
}
|
||||
for (var a = 0; a < extension.length; ++a) {
|
||||
var ext = extension[a];
|
||||
for (var i = 0; i < langExtensions.length; ++i) {
|
||||
if (langExtensions[i] === ext) {
|
||||
langExtensions[i].splice(i, 1);
|
||||
}
|
||||
}
|
||||
for (var ii = 0; ii < outputModifiers.length; ++i) {
|
||||
if (outputModifiers[ii] === ext) {
|
||||
outputModifiers[ii].splice(i, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Get all extension of THIS converter
|
||||
* @returns {{language: Array, output: Array}}
|
||||
*/
|
||||
this.getAllExtensions = function () {
|
||||
return {
|
||||
language: langExtensions,
|
||||
output: outputModifiers
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the metadata of the previously parsed document
|
||||
* @param raw
|
||||
* @returns {string|{}}
|
||||
*/
|
||||
this.getMetadata = function (raw) {
|
||||
if (raw) {
|
||||
return metadata.raw;
|
||||
} else {
|
||||
return metadata.parsed;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the metadata format of the previously parsed document
|
||||
* @returns {string}
|
||||
*/
|
||||
this.getMetadataFormat = function () {
|
||||
return metadata.format;
|
||||
};
|
||||
|
||||
/**
|
||||
* Private: set a single key, value metadata pair
|
||||
* @param {string} key
|
||||
* @param {string} value
|
||||
*/
|
||||
this._setMetadataPair = function (key, value) {
|
||||
metadata.parsed[key] = value;
|
||||
};
|
||||
|
||||
/**
|
||||
* Private: set metadata format
|
||||
* @param {string} format
|
||||
*/
|
||||
this._setMetadataFormat = function (format) {
|
||||
metadata.format = format;
|
||||
};
|
||||
|
||||
/**
|
||||
* Private: set metadata raw text
|
||||
* @param {string} raw
|
||||
*/
|
||||
this._setMetadataRaw = function (raw) {
|
||||
metadata.raw = raw;
|
||||
};
|
||||
};
|
||||
1687
src/main/webapp/static/global/plugins/showdown-master/src/helpers.js
Normal file
1687
src/main/webapp/static/global/plugins/showdown-master/src/helpers.js
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,17 @@
|
||||
var root = this;
|
||||
|
||||
// AMD Loader
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define(function () {
|
||||
'use strict';
|
||||
return showdown;
|
||||
});
|
||||
|
||||
// CommonJS/nodeJS Loader
|
||||
} else if (typeof module !== 'undefined' && module.exports) {
|
||||
module.exports = showdown;
|
||||
|
||||
// Regular Browser loader
|
||||
} else {
|
||||
root.showdown = showdown;
|
||||
}
|
||||
@@ -0,0 +1,187 @@
|
||||
/**
|
||||
* Created by Tivie on 13-07-2015.
|
||||
*/
|
||||
|
||||
function getDefaultOpts (simple) {
|
||||
'use strict';
|
||||
|
||||
var defaultOptions = {
|
||||
omitExtraWLInCodeBlocks: {
|
||||
defaultValue: false,
|
||||
describe: 'Omit the default extra whiteline added to code blocks',
|
||||
type: 'boolean'
|
||||
},
|
||||
noHeaderId: {
|
||||
defaultValue: false,
|
||||
describe: 'Turn on/off generated header id',
|
||||
type: 'boolean'
|
||||
},
|
||||
prefixHeaderId: {
|
||||
defaultValue: false,
|
||||
describe: 'Add a prefix to the generated header ids. Passing a string will prefix that string to the header id. Setting to true will add a generic \'section-\' prefix',
|
||||
type: 'string'
|
||||
},
|
||||
rawPrefixHeaderId: {
|
||||
defaultValue: false,
|
||||
describe: 'Setting this option to true will prevent showdown from modifying the prefix. This might result in malformed IDs (if, for instance, the " char is used in the prefix)',
|
||||
type: 'boolean'
|
||||
},
|
||||
ghCompatibleHeaderId: {
|
||||
defaultValue: false,
|
||||
describe: 'Generate header ids compatible with github style (spaces are replaced with dashes, a bunch of non alphanumeric chars are removed)',
|
||||
type: 'boolean'
|
||||
},
|
||||
rawHeaderId: {
|
||||
defaultValue: false,
|
||||
describe: 'Remove only spaces, \' and " from generated header ids (including prefixes), replacing them with dashes (-). WARNING: This might result in malformed ids',
|
||||
type: 'boolean'
|
||||
},
|
||||
headerLevelStart: {
|
||||
defaultValue: false,
|
||||
describe: 'The header blocks level start',
|
||||
type: 'integer'
|
||||
},
|
||||
parseImgDimensions: {
|
||||
defaultValue: false,
|
||||
describe: 'Turn on/off image dimension parsing',
|
||||
type: 'boolean'
|
||||
},
|
||||
simplifiedAutoLink: {
|
||||
defaultValue: false,
|
||||
describe: 'Turn on/off GFM autolink style',
|
||||
type: 'boolean'
|
||||
},
|
||||
literalMidWordUnderscores: {
|
||||
defaultValue: false,
|
||||
describe: 'Parse midword underscores as literal underscores',
|
||||
type: 'boolean'
|
||||
},
|
||||
literalMidWordAsterisks: {
|
||||
defaultValue: false,
|
||||
describe: 'Parse midword asterisks as literal asterisks',
|
||||
type: 'boolean'
|
||||
},
|
||||
strikethrough: {
|
||||
defaultValue: false,
|
||||
describe: 'Turn on/off strikethrough support',
|
||||
type: 'boolean'
|
||||
},
|
||||
tables: {
|
||||
defaultValue: false,
|
||||
describe: 'Turn on/off tables support',
|
||||
type: 'boolean'
|
||||
},
|
||||
tablesHeaderId: {
|
||||
defaultValue: false,
|
||||
describe: 'Add an id to table headers',
|
||||
type: 'boolean'
|
||||
},
|
||||
ghCodeBlocks: {
|
||||
defaultValue: true,
|
||||
describe: 'Turn on/off GFM fenced code blocks support',
|
||||
type: 'boolean'
|
||||
},
|
||||
tasklists: {
|
||||
defaultValue: false,
|
||||
describe: 'Turn on/off GFM tasklist support',
|
||||
type: 'boolean'
|
||||
},
|
||||
smoothLivePreview: {
|
||||
defaultValue: false,
|
||||
describe: 'Prevents weird effects in live previews due to incomplete input',
|
||||
type: 'boolean'
|
||||
},
|
||||
smartIndentationFix: {
|
||||
defaultValue: false,
|
||||
description: 'Tries to smartly fix indentation in es6 strings',
|
||||
type: 'boolean'
|
||||
},
|
||||
disableForced4SpacesIndentedSublists: {
|
||||
defaultValue: false,
|
||||
description: 'Disables the requirement of indenting nested sublists by 4 spaces',
|
||||
type: 'boolean'
|
||||
},
|
||||
simpleLineBreaks: {
|
||||
defaultValue: false,
|
||||
description: 'Parses simple line breaks as <br> (GFM Style)',
|
||||
type: 'boolean'
|
||||
},
|
||||
requireSpaceBeforeHeadingText: {
|
||||
defaultValue: false,
|
||||
description: 'Makes adding a space between `#` and the header text mandatory (GFM Style)',
|
||||
type: 'boolean'
|
||||
},
|
||||
ghMentions: {
|
||||
defaultValue: false,
|
||||
description: 'Enables github @mentions',
|
||||
type: 'boolean'
|
||||
},
|
||||
ghMentionsLink: {
|
||||
defaultValue: 'https://github.com/{u}',
|
||||
description: 'Changes the link generated by @mentions. Only applies if ghMentions option is enabled.',
|
||||
type: 'string'
|
||||
},
|
||||
encodeEmails: {
|
||||
defaultValue: true,
|
||||
description: 'Encode e-mail addresses through the use of Character Entities, transforming ASCII e-mail addresses into its equivalent decimal entities',
|
||||
type: 'boolean'
|
||||
},
|
||||
openLinksInNewWindow: {
|
||||
defaultValue: false,
|
||||
description: 'Open all links in new windows',
|
||||
type: 'boolean'
|
||||
},
|
||||
backslashEscapesHTMLTags: {
|
||||
defaultValue: false,
|
||||
description: 'Support for HTML Tag escaping. ex: \<div>foo\</div>',
|
||||
type: 'boolean'
|
||||
},
|
||||
emoji: {
|
||||
defaultValue: false,
|
||||
description: 'Enable emoji support. Ex: `this is a :smile: emoji`',
|
||||
type: 'boolean'
|
||||
},
|
||||
underline: {
|
||||
defaultValue: false,
|
||||
description: 'Enable support for underline. Syntax is double or triple underscores: `__underline word__`. With this option enabled, underscores no longer parses into `<em>` and `<strong>`',
|
||||
type: 'boolean'
|
||||
},
|
||||
completeHTMLDocument: {
|
||||
defaultValue: false,
|
||||
description: 'Outputs a complete html document, including `<html>`, `<head>` and `<body>` tags',
|
||||
type: 'boolean'
|
||||
},
|
||||
metadata: {
|
||||
defaultValue: false,
|
||||
description: 'Enable support for document metadata (defined at the top of the document between `«««` and `»»»` or between `---` and `---`).',
|
||||
type: 'boolean'
|
||||
},
|
||||
splitAdjacentBlockquotes: {
|
||||
defaultValue: false,
|
||||
description: 'Split adjacent blockquote blocks',
|
||||
type: 'boolean'
|
||||
}
|
||||
};
|
||||
if (simple === false) {
|
||||
return JSON.parse(JSON.stringify(defaultOptions));
|
||||
}
|
||||
var ret = {};
|
||||
for (var opt in defaultOptions) {
|
||||
if (defaultOptions.hasOwnProperty(opt)) {
|
||||
ret[opt] = defaultOptions[opt].defaultValue;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
function allOptionsOn () {
|
||||
'use strict';
|
||||
var options = getDefaultOpts(true),
|
||||
ret = {};
|
||||
for (var opt in options) {
|
||||
if (options.hasOwnProperty(opt)) {
|
||||
ret[opt] = true;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -0,0 +1,379 @@
|
||||
/**
|
||||
* Created by Tivie on 06-01-2015.
|
||||
*/
|
||||
// Private properties
|
||||
var showdown = {},
|
||||
parsers = {},
|
||||
extensions = {},
|
||||
globalOptions = getDefaultOpts(true),
|
||||
setFlavor = 'vanilla',
|
||||
flavor = {
|
||||
github: {
|
||||
omitExtraWLInCodeBlocks: true,
|
||||
simplifiedAutoLink: true,
|
||||
literalMidWordUnderscores: true,
|
||||
strikethrough: true,
|
||||
tables: true,
|
||||
tablesHeaderId: true,
|
||||
ghCodeBlocks: true,
|
||||
tasklists: true,
|
||||
disableForced4SpacesIndentedSublists: true,
|
||||
simpleLineBreaks: true,
|
||||
requireSpaceBeforeHeadingText: true,
|
||||
ghCompatibleHeaderId: true,
|
||||
ghMentions: true,
|
||||
backslashEscapesHTMLTags: true,
|
||||
emoji: true,
|
||||
splitAdjacentBlockquotes: true
|
||||
},
|
||||
original: {
|
||||
noHeaderId: true,
|
||||
ghCodeBlocks: false
|
||||
},
|
||||
ghost: {
|
||||
omitExtraWLInCodeBlocks: true,
|
||||
parseImgDimensions: true,
|
||||
simplifiedAutoLink: true,
|
||||
literalMidWordUnderscores: true,
|
||||
strikethrough: true,
|
||||
tables: true,
|
||||
tablesHeaderId: true,
|
||||
ghCodeBlocks: true,
|
||||
tasklists: true,
|
||||
smoothLivePreview: true,
|
||||
simpleLineBreaks: true,
|
||||
requireSpaceBeforeHeadingText: true,
|
||||
ghMentions: false,
|
||||
encodeEmails: true
|
||||
},
|
||||
vanilla: getDefaultOpts(true),
|
||||
allOn: allOptionsOn()
|
||||
};
|
||||
|
||||
/**
|
||||
* helper namespace
|
||||
* @type {{}}
|
||||
*/
|
||||
showdown.helper = {};
|
||||
|
||||
/**
|
||||
* TODO LEGACY SUPPORT CODE
|
||||
* @type {{}}
|
||||
*/
|
||||
showdown.extensions = {};
|
||||
|
||||
/**
|
||||
* Set a global option
|
||||
* @static
|
||||
* @param {string} key
|
||||
* @param {*} value
|
||||
* @returns {showdown}
|
||||
*/
|
||||
showdown.setOption = function (key, value) {
|
||||
'use strict';
|
||||
globalOptions[key] = value;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get a global option
|
||||
* @static
|
||||
* @param {string} key
|
||||
* @returns {*}
|
||||
*/
|
||||
showdown.getOption = function (key) {
|
||||
'use strict';
|
||||
return globalOptions[key];
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the global options
|
||||
* @static
|
||||
* @returns {{}}
|
||||
*/
|
||||
showdown.getOptions = function () {
|
||||
'use strict';
|
||||
return globalOptions;
|
||||
};
|
||||
|
||||
/**
|
||||
* Reset global options to the default values
|
||||
* @static
|
||||
*/
|
||||
showdown.resetOptions = function () {
|
||||
'use strict';
|
||||
globalOptions = getDefaultOpts(true);
|
||||
};
|
||||
|
||||
/**
|
||||
* Set the flavor showdown should use as default
|
||||
* @param {string} name
|
||||
*/
|
||||
showdown.setFlavor = function (name) {
|
||||
'use strict';
|
||||
if (!flavor.hasOwnProperty(name)) {
|
||||
throw Error(name + ' flavor was not found');
|
||||
}
|
||||
showdown.resetOptions();
|
||||
var preset = flavor[name];
|
||||
setFlavor = name;
|
||||
for (var option in preset) {
|
||||
if (preset.hasOwnProperty(option)) {
|
||||
globalOptions[option] = preset[option];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the currently set flavor
|
||||
* @returns {string}
|
||||
*/
|
||||
showdown.getFlavor = function () {
|
||||
'use strict';
|
||||
return setFlavor;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the options of a specified flavor. Returns undefined if the flavor was not found
|
||||
* @param {string} name Name of the flavor
|
||||
* @returns {{}|undefined}
|
||||
*/
|
||||
showdown.getFlavorOptions = function (name) {
|
||||
'use strict';
|
||||
if (flavor.hasOwnProperty(name)) {
|
||||
return flavor[name];
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the default options
|
||||
* @static
|
||||
* @param {boolean} [simple=true]
|
||||
* @returns {{}}
|
||||
*/
|
||||
showdown.getDefaultOptions = function (simple) {
|
||||
'use strict';
|
||||
return getDefaultOpts(simple);
|
||||
};
|
||||
|
||||
/**
|
||||
* Get or set a subParser
|
||||
*
|
||||
* subParser(name) - Get a registered subParser
|
||||
* subParser(name, func) - Register a subParser
|
||||
* @static
|
||||
* @param {string} name
|
||||
* @param {function} [func]
|
||||
* @returns {*}
|
||||
*/
|
||||
showdown.subParser = function (name, func) {
|
||||
'use strict';
|
||||
if (showdown.helper.isString(name)) {
|
||||
if (typeof func !== 'undefined') {
|
||||
parsers[name] = func;
|
||||
} else {
|
||||
if (parsers.hasOwnProperty(name)) {
|
||||
return parsers[name];
|
||||
} else {
|
||||
throw Error('SubParser named ' + name + ' not registered!');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw Error('showdown.subParser function first argument must be a string (the name of the subparser)');
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets or registers an extension
|
||||
* @static
|
||||
* @param {string} name
|
||||
* @param {object|function=} ext
|
||||
* @returns {*}
|
||||
*/
|
||||
showdown.extension = function (name, ext) {
|
||||
'use strict';
|
||||
|
||||
if (!showdown.helper.isString(name)) {
|
||||
throw Error('Extension \'name\' must be a string');
|
||||
}
|
||||
|
||||
name = showdown.helper.stdExtName(name);
|
||||
|
||||
// Getter
|
||||
if (showdown.helper.isUndefined(ext)) {
|
||||
if (!extensions.hasOwnProperty(name)) {
|
||||
throw Error('Extension named ' + name + ' is not registered!');
|
||||
}
|
||||
return extensions[name];
|
||||
|
||||
// Setter
|
||||
} else {
|
||||
// Expand extension if it's wrapped in a function
|
||||
if (typeof ext === 'function') {
|
||||
ext = ext();
|
||||
}
|
||||
|
||||
// Ensure extension is an array
|
||||
if (!showdown.helper.isArray(ext)) {
|
||||
ext = [ext];
|
||||
}
|
||||
|
||||
var validExtension = validate(ext, name);
|
||||
|
||||
if (validExtension.valid) {
|
||||
extensions[name] = ext;
|
||||
} else {
|
||||
throw Error(validExtension.error);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets all extensions registered
|
||||
* @returns {{}}
|
||||
*/
|
||||
showdown.getAllExtensions = function () {
|
||||
'use strict';
|
||||
return extensions;
|
||||
};
|
||||
|
||||
/**
|
||||
* Remove an extension
|
||||
* @param {string} name
|
||||
*/
|
||||
showdown.removeExtension = function (name) {
|
||||
'use strict';
|
||||
delete extensions[name];
|
||||
};
|
||||
|
||||
/**
|
||||
* Removes all extensions
|
||||
*/
|
||||
showdown.resetExtensions = function () {
|
||||
'use strict';
|
||||
extensions = {};
|
||||
};
|
||||
|
||||
/**
|
||||
* Validate extension
|
||||
* @param {array} extension
|
||||
* @param {string} name
|
||||
* @returns {{valid: boolean, error: string}}
|
||||
*/
|
||||
function validate (extension, name) {
|
||||
'use strict';
|
||||
|
||||
var errMsg = (name) ? 'Error in ' + name + ' extension->' : 'Error in unnamed extension',
|
||||
ret = {
|
||||
valid: true,
|
||||
error: ''
|
||||
};
|
||||
|
||||
if (!showdown.helper.isArray(extension)) {
|
||||
extension = [extension];
|
||||
}
|
||||
|
||||
for (var i = 0; i < extension.length; ++i) {
|
||||
var baseMsg = errMsg + ' sub-extension ' + i + ': ',
|
||||
ext = extension[i];
|
||||
if (typeof ext !== 'object') {
|
||||
ret.valid = false;
|
||||
ret.error = baseMsg + 'must be an object, but ' + typeof ext + ' given';
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (!showdown.helper.isString(ext.type)) {
|
||||
ret.valid = false;
|
||||
ret.error = baseMsg + 'property "type" must be a string, but ' + typeof ext.type + ' given';
|
||||
return ret;
|
||||
}
|
||||
|
||||
var type = ext.type = ext.type.toLowerCase();
|
||||
|
||||
// normalize extension type
|
||||
if (type === 'language') {
|
||||
type = ext.type = 'lang';
|
||||
}
|
||||
|
||||
if (type === 'html') {
|
||||
type = ext.type = 'output';
|
||||
}
|
||||
|
||||
if (type !== 'lang' && type !== 'output' && type !== 'listener') {
|
||||
ret.valid = false;
|
||||
ret.error = baseMsg + 'type ' + type + ' is not recognized. Valid values: "lang/language", "output/html" or "listener"';
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (type === 'listener') {
|
||||
if (showdown.helper.isUndefined(ext.listeners)) {
|
||||
ret.valid = false;
|
||||
ret.error = baseMsg + '. Extensions of type "listener" must have a property called "listeners"';
|
||||
return ret;
|
||||
}
|
||||
} else {
|
||||
if (showdown.helper.isUndefined(ext.filter) && showdown.helper.isUndefined(ext.regex)) {
|
||||
ret.valid = false;
|
||||
ret.error = baseMsg + type + ' extensions must define either a "regex" property or a "filter" method';
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
if (ext.listeners) {
|
||||
if (typeof ext.listeners !== 'object') {
|
||||
ret.valid = false;
|
||||
ret.error = baseMsg + '"listeners" property must be an object but ' + typeof ext.listeners + ' given';
|
||||
return ret;
|
||||
}
|
||||
for (var ln in ext.listeners) {
|
||||
if (ext.listeners.hasOwnProperty(ln)) {
|
||||
if (typeof ext.listeners[ln] !== 'function') {
|
||||
ret.valid = false;
|
||||
ret.error = baseMsg + '"listeners" property must be an hash of [event name]: [callback]. listeners.' + ln +
|
||||
' must be a function but ' + typeof ext.listeners[ln] + ' given';
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ext.filter) {
|
||||
if (typeof ext.filter !== 'function') {
|
||||
ret.valid = false;
|
||||
ret.error = baseMsg + '"filter" must be a function, but ' + typeof ext.filter + ' given';
|
||||
return ret;
|
||||
}
|
||||
} else if (ext.regex) {
|
||||
if (showdown.helper.isString(ext.regex)) {
|
||||
ext.regex = new RegExp(ext.regex, 'g');
|
||||
}
|
||||
if (!(ext.regex instanceof RegExp)) {
|
||||
ret.valid = false;
|
||||
ret.error = baseMsg + '"regex" property must either be a string or a RegExp object, but ' + typeof ext.regex + ' given';
|
||||
return ret;
|
||||
}
|
||||
if (showdown.helper.isUndefined(ext.replace)) {
|
||||
ret.valid = false;
|
||||
ret.error = baseMsg + '"regex" extensions must implement a replace string or function';
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate extension
|
||||
* @param {object} ext
|
||||
* @returns {boolean}
|
||||
*/
|
||||
showdown.validateExtension = function (ext) {
|
||||
'use strict';
|
||||
|
||||
var validateExtension = validate(ext, null);
|
||||
if (!validateExtension.valid) {
|
||||
console.warn(validateExtension.error);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* These are all the transformations that form block-level
|
||||
* tags like paragraphs, headers, and list items.
|
||||
*/
|
||||
showdown.subParser('makehtml.blockGamut', function (text, options, globals) {
|
||||
'use strict';
|
||||
|
||||
text = globals.converter._dispatch('makehtml.blockGamut.before', text, options, globals).getText();
|
||||
|
||||
// we parse blockquotes first so that we can have headings and hrs
|
||||
// inside blockquotes
|
||||
text = showdown.subParser('makehtml.blockQuotes')(text, options, globals);
|
||||
text = showdown.subParser('makehtml.headers')(text, options, globals);
|
||||
|
||||
// Do Horizontal Rules:
|
||||
text = showdown.subParser('makehtml.horizontalRule')(text, options, globals);
|
||||
|
||||
text = showdown.subParser('makehtml.lists')(text, options, globals);
|
||||
text = showdown.subParser('makehtml.codeBlocks')(text, options, globals);
|
||||
text = showdown.subParser('makehtml.tables')(text, options, globals);
|
||||
|
||||
// We already ran _HashHTMLBlocks() before, in Markdown(), but that
|
||||
// was to escape raw HTML in the original Markdown source. This time,
|
||||
// we're escaping the markup we've just created, so that we don't wrap
|
||||
// <p> tags around block-level tags.
|
||||
text = showdown.subParser('makehtml.hashHTMLBlocks')(text, options, globals);
|
||||
text = showdown.subParser('makehtml.paragraphs')(text, options, globals);
|
||||
|
||||
text = globals.converter._dispatch('makehtml.blockGamut.after', text, options, globals).getText();
|
||||
|
||||
return text;
|
||||
});
|
||||
@@ -0,0 +1,42 @@
|
||||
showdown.subParser('makehtml.blockQuotes', function (text, options, globals) {
|
||||
'use strict';
|
||||
|
||||
text = globals.converter._dispatch('makehtml.blockQuotes.before', text, options, globals).getText();
|
||||
|
||||
// add a couple extra lines after the text and endtext mark
|
||||
text = text + '\n\n';
|
||||
|
||||
var rgx = /(^ {0,3}>[ \t]?.+\n(.+\n)*\n*)+/gm;
|
||||
|
||||
if (options.splitAdjacentBlockquotes) {
|
||||
rgx = /^ {0,3}>[\s\S]*?(?:\n\n)/gm;
|
||||
}
|
||||
|
||||
text = text.replace(rgx, function (bq) {
|
||||
// attacklab: hack around Konqueror 3.5.4 bug:
|
||||
// "----------bug".replace(/^-/g,"") == "bug"
|
||||
bq = bq.replace(/^[ \t]*>[ \t]?/gm, ''); // trim one level of quoting
|
||||
|
||||
// attacklab: clean up hack
|
||||
bq = bq.replace(/¨0/g, '');
|
||||
|
||||
bq = bq.replace(/^[ \t]+$/gm, ''); // trim whitespace-only lines
|
||||
bq = showdown.subParser('makehtml.githubCodeBlocks')(bq, options, globals);
|
||||
bq = showdown.subParser('makehtml.blockGamut')(bq, options, globals); // recurse
|
||||
|
||||
bq = bq.replace(/(^|\n)/g, '$1 ');
|
||||
// These leading spaces screw with <pre> content, so we need to fix that:
|
||||
bq = bq.replace(/(\s*<pre>[^\r]+?<\/pre>)/gm, function (wholeMatch, m1) {
|
||||
var pre = m1;
|
||||
// attacklab: hack around Konqueror 3.5.4 bug:
|
||||
pre = pre.replace(/^ /mg, '¨0');
|
||||
pre = pre.replace(/¨0/g, '');
|
||||
return pre;
|
||||
});
|
||||
|
||||
return showdown.subParser('makehtml.hashBlock')('<blockquote>\n' + bq + '\n</blockquote>', options, globals);
|
||||
});
|
||||
|
||||
text = globals.converter._dispatch('makehtml.blockQuotes.after', text, options, globals).getText();
|
||||
return text;
|
||||
});
|
||||
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* Process Markdown `<pre><code>` blocks.
|
||||
*/
|
||||
showdown.subParser('makehtml.codeBlocks', function (text, options, globals) {
|
||||
'use strict';
|
||||
|
||||
text = globals.converter._dispatch('makehtml.codeBlocks.before', text, options, globals).getText();
|
||||
|
||||
// sentinel workarounds for lack of \A and \Z, safari\khtml bug
|
||||
text += '¨0';
|
||||
|
||||
var pattern = /(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=¨0))/g;
|
||||
text = text.replace(pattern, function (wholeMatch, m1, m2) {
|
||||
var codeblock = m1,
|
||||
nextChar = m2,
|
||||
end = '\n';
|
||||
|
||||
codeblock = showdown.subParser('makehtml.outdent')(codeblock, options, globals);
|
||||
codeblock = showdown.subParser('makehtml.encodeCode')(codeblock, options, globals);
|
||||
codeblock = showdown.subParser('makehtml.detab')(codeblock, options, globals);
|
||||
codeblock = codeblock.replace(/^\n+/g, ''); // trim leading newlines
|
||||
codeblock = codeblock.replace(/\n+$/g, ''); // trim trailing newlines
|
||||
|
||||
if (options.omitExtraWLInCodeBlocks) {
|
||||
end = '';
|
||||
}
|
||||
|
||||
codeblock = '<pre><code>' + codeblock + end + '</code></pre>';
|
||||
|
||||
return showdown.subParser('makehtml.hashBlock')(codeblock, options, globals) + nextChar;
|
||||
});
|
||||
|
||||
// strip sentinel
|
||||
text = text.replace(/¨0/, '');
|
||||
|
||||
text = globals.converter._dispatch('makehtml.codeBlocks.after', text, options, globals).getText();
|
||||
return text;
|
||||
});
|
||||
@@ -0,0 +1,48 @@
|
||||
/**
|
||||
*
|
||||
* * Backtick quotes are used for <code></code> spans.
|
||||
*
|
||||
* * You can use multiple backticks as the delimiters if you want to
|
||||
* include literal backticks in the code span. So, this input:
|
||||
*
|
||||
* Just type ``foo `bar` baz`` at the prompt.
|
||||
*
|
||||
* Will translate to:
|
||||
*
|
||||
* <p>Just type <code>foo `bar` baz</code> at the prompt.</p>
|
||||
*
|
||||
* There's no arbitrary limit to the number of backticks you
|
||||
* can use as delimters. If you need three consecutive backticks
|
||||
* in your code, use four for delimiters, etc.
|
||||
*
|
||||
* * You can use spaces to get literal backticks at the edges:
|
||||
*
|
||||
* ... type `` `bar` `` ...
|
||||
*
|
||||
* Turns to:
|
||||
*
|
||||
* ... type <code>`bar`</code> ...
|
||||
*/
|
||||
showdown.subParser('makehtml.codeSpans', function (text, options, globals) {
|
||||
'use strict';
|
||||
|
||||
text = globals.converter._dispatch('makehtml.codeSpans.before', text, options, globals).getText();
|
||||
|
||||
if (typeof(text) === 'undefined') {
|
||||
text = '';
|
||||
}
|
||||
text = text.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,
|
||||
function (wholeMatch, m1, m2, m3) {
|
||||
var c = m3;
|
||||
c = c.replace(/^([ \t]*)/g, ''); // leading whitespace
|
||||
c = c.replace(/[ \t]*$/g, ''); // trailing whitespace
|
||||
c = showdown.subParser('makehtml.encodeCode')(c, options, globals);
|
||||
c = m1 + '<code>' + c + '</code>';
|
||||
c = showdown.subParser('makehtml.hashHTMLSpans')(c, options, globals);
|
||||
return c;
|
||||
}
|
||||
);
|
||||
|
||||
text = globals.converter._dispatch('makehtml.codeSpans.after', text, options, globals).getText();
|
||||
return text;
|
||||
});
|
||||
@@ -0,0 +1,62 @@
|
||||
/**
|
||||
* Create a full HTML document from the processed markdown
|
||||
*/
|
||||
showdown.subParser('makehtml.completeHTMLDocument', function (text, options, globals) {
|
||||
'use strict';
|
||||
|
||||
if (!options.completeHTMLDocument) {
|
||||
return text;
|
||||
}
|
||||
|
||||
text = globals.converter._dispatch('makehtml.completeHTMLDocument.before', text, options, globals).getText();
|
||||
|
||||
var doctype = 'html',
|
||||
doctypeParsed = '<!DOCTYPE HTML>\n',
|
||||
title = '',
|
||||
charset = '<meta charset="utf-8">\n',
|
||||
lang = '',
|
||||
metadata = '';
|
||||
|
||||
if (typeof globals.metadata.parsed.doctype !== 'undefined') {
|
||||
doctypeParsed = '<!DOCTYPE ' + globals.metadata.parsed.doctype + '>\n';
|
||||
doctype = globals.metadata.parsed.doctype.toString().toLowerCase();
|
||||
if (doctype === 'html' || doctype === 'html5') {
|
||||
charset = '<meta charset="utf-8">';
|
||||
}
|
||||
}
|
||||
|
||||
for (var meta in globals.metadata.parsed) {
|
||||
if (globals.metadata.parsed.hasOwnProperty(meta)) {
|
||||
switch (meta.toLowerCase()) {
|
||||
case 'doctype':
|
||||
break;
|
||||
|
||||
case 'title':
|
||||
title = '<title>' + globals.metadata.parsed.title + '</title>\n';
|
||||
break;
|
||||
|
||||
case 'charset':
|
||||
if (doctype === 'html' || doctype === 'html5') {
|
||||
charset = '<meta charset="' + globals.metadata.parsed.charset + '">\n';
|
||||
} else {
|
||||
charset = '<meta name="charset" content="' + globals.metadata.parsed.charset + '">\n';
|
||||
}
|
||||
break;
|
||||
|
||||
case 'language':
|
||||
case 'lang':
|
||||
lang = ' lang="' + globals.metadata.parsed[meta] + '"';
|
||||
metadata += '<meta name="' + meta + '" content="' + globals.metadata.parsed[meta] + '">\n';
|
||||
break;
|
||||
|
||||
default:
|
||||
metadata += '<meta name="' + meta + '" content="' + globals.metadata.parsed[meta] + '">\n';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
text = doctypeParsed + '<html' + lang + '>\n<head>\n' + title + charset + metadata + '</head>\n<body>\n' + text.trim() + '\n</body>\n</html>';
|
||||
|
||||
text = globals.converter._dispatch('makehtml.completeHTMLDocument.after', text, options, globals).getText();
|
||||
return text;
|
||||
});
|
||||
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* Convert all tabs to spaces
|
||||
*/
|
||||
showdown.subParser('makehtml.detab', function (text, options, globals) {
|
||||
'use strict';
|
||||
text = globals.converter._dispatch('makehtml.detab.before', text, options, globals).getText();
|
||||
|
||||
// expand first n-1 tabs
|
||||
text = text.replace(/\t(?=\t)/g, ' '); // g_tab_width
|
||||
|
||||
// replace the nth with two sentinels
|
||||
text = text.replace(/\t/g, '¨A¨B');
|
||||
|
||||
// use the sentinel to anchor our regex so it doesn't explode
|
||||
text = text.replace(/¨B(.+?)¨A/g, function (wholeMatch, m1) {
|
||||
var leadingText = m1,
|
||||
numSpaces = 4 - leadingText.length % 4; // g_tab_width
|
||||
|
||||
// there *must* be a better way to do this:
|
||||
for (var i = 0; i < numSpaces; i++) {
|
||||
leadingText += ' ';
|
||||
}
|
||||
|
||||
return leadingText;
|
||||
});
|
||||
|
||||
// clean up sentinels
|
||||
text = text.replace(/¨A/g, ' '); // g_tab_width
|
||||
text = text.replace(/¨B/g, '');
|
||||
|
||||
text = globals.converter._dispatch('makehtml.detab.after', text, options, globals).getText();
|
||||
return text;
|
||||
});
|
||||
@@ -0,0 +1,11 @@
|
||||
showdown.subParser('makehtml.ellipsis', function (text, options, globals) {
|
||||
'use strict';
|
||||
|
||||
text = globals.converter._dispatch('makehtml.ellipsis.before', text, options, globals).getText();
|
||||
|
||||
text = text.replace(/\.\.\./g, '…');
|
||||
|
||||
text = globals.converter._dispatch('makehtml.ellipsis.after', text, options, globals).getText();
|
||||
|
||||
return text;
|
||||
});
|
||||
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Turn emoji codes into emojis
|
||||
*
|
||||
* List of supported emojis: https://github.com/showdownjs/showdown/wiki/Emojis
|
||||
*/
|
||||
showdown.subParser('makehtml.emoji', function (text, options, globals) {
|
||||
'use strict';
|
||||
|
||||
if (!options.emoji) {
|
||||
return text;
|
||||
}
|
||||
|
||||
text = globals.converter._dispatch('makehtml.emoji.before', text, options, globals).getText();
|
||||
|
||||
var emojiRgx = /:([\S]+?):/g;
|
||||
|
||||
text = text.replace(emojiRgx, function (wm, emojiCode) {
|
||||
if (showdown.helper.emojis.hasOwnProperty(emojiCode)) {
|
||||
return showdown.helper.emojis[emojiCode];
|
||||
}
|
||||
return wm;
|
||||
});
|
||||
|
||||
text = globals.converter._dispatch('makehtml.emoji.after', text, options, globals).getText();
|
||||
|
||||
return text;
|
||||
});
|
||||
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* Smart processing for ampersands and angle brackets that need to be encoded.
|
||||
*/
|
||||
showdown.subParser('makehtml.encodeAmpsAndAngles', function (text, options, globals) {
|
||||
'use strict';
|
||||
text = globals.converter._dispatch('makehtml.encodeAmpsAndAngles.before', text, options, globals).getText();
|
||||
|
||||
// Ampersand-encoding based entirely on Nat Irons's Amputator MT plugin:
|
||||
// http://bumppo.net/projects/amputator/
|
||||
text = text.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g, '&');
|
||||
|
||||
// Encode naked <'s
|
||||
text = text.replace(/<(?![a-z\/?$!])/gi, '<');
|
||||
|
||||
// Encode <
|
||||
text = text.replace(/</g, '<');
|
||||
|
||||
// Encode >
|
||||
text = text.replace(/>/g, '>');
|
||||
|
||||
text = globals.converter._dispatch('makehtml.encodeAmpsAndAngles.after', text, options, globals).getText();
|
||||
return text;
|
||||
});
|
||||
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* Returns the string, with after processing the following backslash escape sequences.
|
||||
*
|
||||
* attacklab: The polite way to do this is with the new escapeCharacters() function:
|
||||
*
|
||||
* text = escapeCharacters(text,"\\",true);
|
||||
* text = escapeCharacters(text,"`*_{}[]()>#+-.!",true);
|
||||
*
|
||||
* ...but we're sidestepping its use of the (slow) RegExp constructor
|
||||
* as an optimization for Firefox. This function gets called a LOT.
|
||||
*/
|
||||
showdown.subParser('makehtml.encodeBackslashEscapes', function (text, options, globals) {
|
||||
'use strict';
|
||||
text = globals.converter._dispatch('makehtml.encodeBackslashEscapes.before', text, options, globals).getText();
|
||||
|
||||
text = text.replace(/\\(\\)/g, showdown.helper.escapeCharactersCallback);
|
||||
text = text.replace(/\\([`*_{}\[\]()>#+.!~=|:-])/g, showdown.helper.escapeCharactersCallback);
|
||||
|
||||
text = globals.converter._dispatch('makehtml.encodeBackslashEscapes.after', text, options, globals).getText();
|
||||
return text;
|
||||
});
|
||||
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* Encode/escape certain characters inside Markdown code runs.
|
||||
* The point is that in code, these characters are literals,
|
||||
* and lose their special Markdown meanings.
|
||||
*/
|
||||
showdown.subParser('makehtml.encodeCode', function (text, options, globals) {
|
||||
'use strict';
|
||||
|
||||
text = globals.converter._dispatch('makehtml.encodeCode.before', text, options, globals).getText();
|
||||
|
||||
// Encode all ampersands; HTML entities are not
|
||||
// entities within a Markdown code span.
|
||||
text = text
|
||||
.replace(/&/g, '&')
|
||||
// Do the angle bracket song and dance:
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
// Now, escape characters that are magic in Markdown:
|
||||
.replace(/([*_{}\[\]\\=~-])/g, showdown.helper.escapeCharactersCallback);
|
||||
|
||||
text = globals.converter._dispatch('makehtml.encodeCode.after', text, options, globals).getText();
|
||||
return text;
|
||||
});
|
||||
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* Within tags -- meaning between < and > -- encode [\ ` * _ ~ =] so they
|
||||
* don't conflict with their use in Markdown for code, italics and strong.
|
||||
*/
|
||||
showdown.subParser('makehtml.escapeSpecialCharsWithinTagAttributes', function (text, options, globals) {
|
||||
'use strict';
|
||||
text = globals.converter._dispatch('makehtml.escapeSpecialCharsWithinTagAttributes.before', text, options, globals).getText();
|
||||
|
||||
// Build a regex to find HTML tags.
|
||||
var tags = /<\/?[a-z\d_:-]+(?:[\s]+[\s\S]+?)?>/gi,
|
||||
comments = /<!(--(?:(?:[^>-]|-[^>])(?:[^-]|-[^-])*)--)>/gi;
|
||||
|
||||
text = text.replace(tags, function (wholeMatch) {
|
||||
return wholeMatch
|
||||
.replace(/(.)<\/?code>(?=.)/g, '$1`')
|
||||
.replace(/([\\`*_~=|])/g, showdown.helper.escapeCharactersCallback);
|
||||
});
|
||||
|
||||
text = text.replace(comments, function (wholeMatch) {
|
||||
return wholeMatch
|
||||
.replace(/([\\`*_~=|])/g, showdown.helper.escapeCharactersCallback);
|
||||
});
|
||||
|
||||
text = globals.converter._dispatch('makehtml.escapeSpecialCharsWithinTagAttributes.after', text, options, globals).getText();
|
||||
return text;
|
||||
});
|
||||
@@ -0,0 +1,46 @@
|
||||
/**
|
||||
* Handle github codeblocks prior to running HashHTML so that
|
||||
* HTML contained within the codeblock gets escaped properly
|
||||
* Example:
|
||||
* ```ruby
|
||||
* def hello_world(x)
|
||||
* puts "Hello, #{x}"
|
||||
* end
|
||||
* ```
|
||||
*/
|
||||
showdown.subParser('makehtml.githubCodeBlocks', function (text, options, globals) {
|
||||
'use strict';
|
||||
|
||||
// early exit if option is not enabled
|
||||
if (!options.ghCodeBlocks) {
|
||||
return text;
|
||||
}
|
||||
|
||||
text = globals.converter._dispatch('makehtml.githubCodeBlocks.before', text, options, globals).getText();
|
||||
|
||||
text += '¨0';
|
||||
|
||||
text = text.replace(/(?:^|\n)(?: {0,3})(```+|~~~+)(?: *)([^\s`~]*)\n([\s\S]*?)\n(?: {0,3})\1/g, function (wholeMatch, delim, language, codeblock) {
|
||||
var end = (options.omitExtraWLInCodeBlocks) ? '' : '\n';
|
||||
|
||||
// First parse the github code block
|
||||
codeblock = showdown.subParser('makehtml.encodeCode')(codeblock, options, globals);
|
||||
codeblock = showdown.subParser('makehtml.detab')(codeblock, options, globals);
|
||||
codeblock = codeblock.replace(/^\n+/g, ''); // trim leading newlines
|
||||
codeblock = codeblock.replace(/\n+$/g, ''); // trim trailing whitespace
|
||||
|
||||
codeblock = '<pre><code' + (language ? ' class="' + language + ' language-' + language + '"' : '') + '>' + codeblock + end + '</code></pre>';
|
||||
|
||||
codeblock = showdown.subParser('makehtml.hashBlock')(codeblock, options, globals);
|
||||
|
||||
// Since GHCodeblocks can be false positives, we need to
|
||||
// store the primitive text and the parsed text in a global var,
|
||||
// and then return a token
|
||||
return '\n\n¨G' + (globals.ghCodeBlocks.push({text: wholeMatch, codeblock: codeblock}) - 1) + 'G\n\n';
|
||||
});
|
||||
|
||||
// attacklab: strip sentinel
|
||||
text = text.replace(/¨0/, '');
|
||||
|
||||
return globals.converter._dispatch('makehtml.githubCodeBlocks.after', text, options, globals).getText();
|
||||
});
|
||||
@@ -0,0 +1,8 @@
|
||||
showdown.subParser('makehtml.hashBlock', function (text, options, globals) {
|
||||
'use strict';
|
||||
text = globals.converter._dispatch('makehtml.hashBlock.before', text, options, globals).getText();
|
||||
text = text.replace(/(^\n+|\n+$)/g, '');
|
||||
text = '\n\n¨K' + (globals.gHtmlBlocks.push(text) - 1) + 'K\n\n';
|
||||
text = globals.converter._dispatch('makehtml.hashBlock.after', text, options, globals).getText();
|
||||
return text;
|
||||
});
|
||||
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* Hash and escape <code> elements that should not be parsed as markdown
|
||||
*/
|
||||
showdown.subParser('makehtml.hashCodeTags', function (text, options, globals) {
|
||||
'use strict';
|
||||
text = globals.converter._dispatch('makehtml.hashCodeTags.before', text, options, globals).getText();
|
||||
|
||||
var repFunc = function (wholeMatch, match, left, right) {
|
||||
var codeblock = left + showdown.subParser('makehtml.encodeCode')(match, options, globals) + right;
|
||||
return '¨C' + (globals.gHtmlSpans.push(codeblock) - 1) + 'C';
|
||||
};
|
||||
|
||||
// Hash naked <code>
|
||||
text = showdown.helper.replaceRecursiveRegExp(text, repFunc, '<code\\b[^>]*>', '</code>', 'gim');
|
||||
|
||||
text = globals.converter._dispatch('makehtml.hashCodeTags.after', text, options, globals).getText();
|
||||
return text;
|
||||
});
|
||||
@@ -0,0 +1,19 @@
|
||||
showdown.subParser('makehtml.hashElement', function (text, options, globals) {
|
||||
'use strict';
|
||||
|
||||
return function (wholeMatch, m1) {
|
||||
var blockText = m1;
|
||||
|
||||
// Undo double lines
|
||||
blockText = blockText.replace(/\n\n/g, '\n');
|
||||
blockText = blockText.replace(/^\n/, '');
|
||||
|
||||
// strip trailing blank lines
|
||||
blockText = blockText.replace(/\n+$/g, '');
|
||||
|
||||
// Replace the element text with a marker ("¨KxK" where x is its key)
|
||||
blockText = '\n\n¨K' + (globals.gHtmlBlocks.push(blockText) - 1) + 'K\n\n';
|
||||
|
||||
return blockText;
|
||||
};
|
||||
});
|
||||
@@ -0,0 +1,98 @@
|
||||
showdown.subParser('makehtml.hashHTMLBlocks', function (text, options, globals) {
|
||||
'use strict';
|
||||
text = globals.converter._dispatch('makehtml.hashHTMLBlocks.before', text, options, globals).getText();
|
||||
|
||||
var blockTags = [
|
||||
'pre',
|
||||
'div',
|
||||
'h1',
|
||||
'h2',
|
||||
'h3',
|
||||
'h4',
|
||||
'h5',
|
||||
'h6',
|
||||
'blockquote',
|
||||
'table',
|
||||
'dl',
|
||||
'ol',
|
||||
'ul',
|
||||
'script',
|
||||
'noscript',
|
||||
'form',
|
||||
'fieldset',
|
||||
'iframe',
|
||||
'math',
|
||||
'style',
|
||||
'section',
|
||||
'header',
|
||||
'footer',
|
||||
'nav',
|
||||
'article',
|
||||
'aside',
|
||||
'address',
|
||||
'audio',
|
||||
'canvas',
|
||||
'figure',
|
||||
'hgroup',
|
||||
'output',
|
||||
'video',
|
||||
'p'
|
||||
],
|
||||
repFunc = function (wholeMatch, match, left, right) {
|
||||
var txt = wholeMatch;
|
||||
// check if this html element is marked as markdown
|
||||
// if so, it's contents should be parsed as markdown
|
||||
if (left.search(/\bmarkdown\b/) !== -1) {
|
||||
txt = left + globals.converter.makeHtml(match) + right;
|
||||
}
|
||||
return '\n\n¨K' + (globals.gHtmlBlocks.push(txt) - 1) + 'K\n\n';
|
||||
};
|
||||
|
||||
if (options.backslashEscapesHTMLTags) {
|
||||
// encode backslash escaped HTML tags
|
||||
text = text.replace(/\\<(\/?[^>]+?)>/g, function (wm, inside) {
|
||||
return '<' + inside + '>';
|
||||
});
|
||||
}
|
||||
|
||||
// hash HTML Blocks
|
||||
for (var i = 0; i < blockTags.length; ++i) {
|
||||
|
||||
var opTagPos,
|
||||
rgx1 = new RegExp('^ {0,3}(<' + blockTags[i] + '\\b[^>]*>)', 'im'),
|
||||
patLeft = '<' + blockTags[i] + '\\b[^>]*>',
|
||||
patRight = '</' + blockTags[i] + '>';
|
||||
// 1. Look for the first position of the first opening HTML tag in the text
|
||||
while ((opTagPos = showdown.helper.regexIndexOf(text, rgx1)) !== -1) {
|
||||
|
||||
// if the HTML tag is \ escaped, we need to escape it and break
|
||||
|
||||
|
||||
//2. Split the text in that position
|
||||
var subTexts = showdown.helper.splitAtIndex(text, opTagPos),
|
||||
//3. Match recursively
|
||||
newSubText1 = showdown.helper.replaceRecursiveRegExp(subTexts[1], repFunc, patLeft, patRight, 'im');
|
||||
|
||||
// prevent an infinite loop
|
||||
if (newSubText1 === subTexts[1]) {
|
||||
break;
|
||||
}
|
||||
text = subTexts[0].concat(newSubText1);
|
||||
}
|
||||
}
|
||||
// HR SPECIAL CASE
|
||||
text = text.replace(/(\n {0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g,
|
||||
showdown.subParser('makehtml.hashElement')(text, options, globals));
|
||||
|
||||
// Special case for standalone HTML comments
|
||||
text = showdown.helper.replaceRecursiveRegExp(text, function (txt) {
|
||||
return '\n\n¨K' + (globals.gHtmlBlocks.push(txt) - 1) + 'K\n\n';
|
||||
}, '^ {0,3}<!--', '-->', 'gm');
|
||||
|
||||
// PHP and ASP-style processor instructions (<?...?> and <%...%>)
|
||||
text = text.replace(/(?:\n\n)( {0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g,
|
||||
showdown.subParser('makehtml.hashElement')(text, options, globals));
|
||||
|
||||
text = globals.converter._dispatch('makehtml.hashHTMLBlocks.after', text, options, globals).getText();
|
||||
return text;
|
||||
});
|
||||
@@ -0,0 +1,58 @@
|
||||
/**
|
||||
* Hash span elements that should not be parsed as markdown
|
||||
*/
|
||||
showdown.subParser('makehtml.hashHTMLSpans', function (text, options, globals) {
|
||||
'use strict';
|
||||
text = globals.converter._dispatch('makehtml.hashHTMLSpans.before', text, options, globals).getText();
|
||||
|
||||
// Hash Self Closing tags
|
||||
text = text.replace(/<[^>]+?\/>/gi, function (wm) {
|
||||
return showdown.helper._hashHTMLSpan(wm, globals);
|
||||
});
|
||||
|
||||
// Hash tags without properties
|
||||
text = text.replace(/<([^>]+?)>[\s\S]*?<\/\1>/g, function (wm) {
|
||||
return showdown.helper._hashHTMLSpan(wm, globals);
|
||||
});
|
||||
|
||||
// Hash tags with properties
|
||||
text = text.replace(/<([^>]+?)\s[^>]+?>[\s\S]*?<\/\1>/g, function (wm) {
|
||||
return showdown.helper._hashHTMLSpan(wm, globals);
|
||||
});
|
||||
|
||||
// Hash self closing tags without />
|
||||
text = text.replace(/<[^>]+?>/gi, function (wm) {
|
||||
return showdown.helper._hashHTMLSpan(wm, globals);
|
||||
});
|
||||
|
||||
text = globals.converter._dispatch('makehtml.hashHTMLSpans.after', text, options, globals).getText();
|
||||
return text;
|
||||
});
|
||||
|
||||
/**
|
||||
* Unhash HTML spans
|
||||
*/
|
||||
showdown.subParser('makehtml.unhashHTMLSpans', function (text, options, globals) {
|
||||
'use strict';
|
||||
text = globals.converter._dispatch('makehtml.unhashHTMLSpans.before', text, options, globals).getText();
|
||||
|
||||
for (var i = 0; i < globals.gHtmlSpans.length; ++i) {
|
||||
var repText = globals.gHtmlSpans[i],
|
||||
// limiter to prevent infinite loop (assume 10 as limit for recurse)
|
||||
limit = 0;
|
||||
|
||||
while (/¨C(\d+)C/.test(repText)) {
|
||||
var num = RegExp.$1;
|
||||
repText = repText.replace('¨C' + num + 'C', globals.gHtmlSpans[num]);
|
||||
if (limit === 10) {
|
||||
console.error('maximum nesting of 10 spans reached!!!');
|
||||
break;
|
||||
}
|
||||
++limit;
|
||||
}
|
||||
text = text.replace('¨C' + i + 'C', repText);
|
||||
}
|
||||
|
||||
text = globals.converter._dispatch('makehtml.unhashHTMLSpans.after', text, options, globals).getText();
|
||||
return text;
|
||||
});
|
||||
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* Hash and escape <pre><code> elements that should not be parsed as markdown
|
||||
*/
|
||||
showdown.subParser('makehtml.hashPreCodeTags', function (text, options, globals) {
|
||||
'use strict';
|
||||
text = globals.converter._dispatch('makehtml.hashPreCodeTags.before', text, options, globals).getText();
|
||||
|
||||
var repFunc = function (wholeMatch, match, left, right) {
|
||||
// encode html entities
|
||||
var codeblock = left + showdown.subParser('makehtml.encodeCode')(match, options, globals) + right;
|
||||
return '\n\n¨G' + (globals.ghCodeBlocks.push({text: wholeMatch, codeblock: codeblock}) - 1) + 'G\n\n';
|
||||
};
|
||||
|
||||
// Hash <pre><code>
|
||||
text = showdown.helper.replaceRecursiveRegExp(text, repFunc, '^ {0,3}<pre\\b[^>]*>\\s*<code\\b[^>]*>', '^ {0,3}</code>\\s*</pre>', 'gim');
|
||||
|
||||
text = globals.converter._dispatch('makehtml.hashPreCodeTags.after', text, options, globals).getText();
|
||||
return text;
|
||||
});
|
||||
@@ -0,0 +1,126 @@
|
||||
showdown.subParser('makehtml.headers', function (text, options, globals) {
|
||||
'use strict';
|
||||
|
||||
text = globals.converter._dispatch('makehtml.headers.before', text, options, globals).getText();
|
||||
|
||||
var headerLevelStart = (isNaN(parseInt(options.headerLevelStart))) ? 1 : parseInt(options.headerLevelStart),
|
||||
|
||||
// Set text-style headers:
|
||||
// Header 1
|
||||
// ========
|
||||
//
|
||||
// Header 2
|
||||
// --------
|
||||
//
|
||||
setextRegexH1 = (options.smoothLivePreview) ? /^(.+)[ \t]*\n={2,}[ \t]*\n+/gm : /^(.+)[ \t]*\n=+[ \t]*\n+/gm,
|
||||
setextRegexH2 = (options.smoothLivePreview) ? /^(.+)[ \t]*\n-{2,}[ \t]*\n+/gm : /^(.+)[ \t]*\n-+[ \t]*\n+/gm;
|
||||
|
||||
text = text.replace(setextRegexH1, function (wholeMatch, m1) {
|
||||
|
||||
var spanGamut = showdown.subParser('makehtml.spanGamut')(m1, options, globals),
|
||||
hID = (options.noHeaderId) ? '' : ' id="' + headerId(m1) + '"',
|
||||
hLevel = headerLevelStart,
|
||||
hashBlock = '<h' + hLevel + hID + '>' + spanGamut + '</h' + hLevel + '>';
|
||||
return showdown.subParser('makehtml.hashBlock')(hashBlock, options, globals);
|
||||
});
|
||||
|
||||
text = text.replace(setextRegexH2, function (matchFound, m1) {
|
||||
var spanGamut = showdown.subParser('makehtml.spanGamut')(m1, options, globals),
|
||||
hID = (options.noHeaderId) ? '' : ' id="' + headerId(m1) + '"',
|
||||
hLevel = headerLevelStart + 1,
|
||||
hashBlock = '<h' + hLevel + hID + '>' + spanGamut + '</h' + hLevel + '>';
|
||||
return showdown.subParser('makehtml.hashBlock')(hashBlock, options, globals);
|
||||
});
|
||||
|
||||
// atx-style headers:
|
||||
// # Header 1
|
||||
// ## Header 2
|
||||
// ## Header 2 with closing hashes ##
|
||||
// ...
|
||||
// ###### Header 6
|
||||
//
|
||||
var atxStyle = (options.requireSpaceBeforeHeadingText) ? /^(#{1,6})[ \t]+(.+?)[ \t]*#*\n+/gm : /^(#{1,6})[ \t]*(.+?)[ \t]*#*\n+/gm;
|
||||
|
||||
text = text.replace(atxStyle, function (wholeMatch, m1, m2) {
|
||||
var hText = m2;
|
||||
if (options.customizedHeaderId) {
|
||||
hText = m2.replace(/\s?\{([^{]+?)}\s*$/, '');
|
||||
}
|
||||
|
||||
var span = showdown.subParser('makehtml.spanGamut')(hText, options, globals),
|
||||
hID = (options.noHeaderId) ? '' : ' id="' + headerId(m2) + '"',
|
||||
hLevel = headerLevelStart - 1 + m1.length,
|
||||
header = '<h' + hLevel + hID + '>' + span + '</h' + hLevel + '>';
|
||||
|
||||
return showdown.subParser('makehtml.hashBlock')(header, options, globals);
|
||||
});
|
||||
|
||||
function headerId (m) {
|
||||
var title,
|
||||
prefix;
|
||||
|
||||
// It is separate from other options to allow combining prefix and customized
|
||||
if (options.customizedHeaderId) {
|
||||
var match = m.match(/\{([^{]+?)}\s*$/);
|
||||
if (match && match[1]) {
|
||||
m = match[1];
|
||||
}
|
||||
}
|
||||
|
||||
title = m;
|
||||
|
||||
// Prefix id to prevent causing inadvertent pre-existing style matches.
|
||||
if (showdown.helper.isString(options.prefixHeaderId)) {
|
||||
prefix = options.prefixHeaderId;
|
||||
} else if (options.prefixHeaderId === true) {
|
||||
prefix = 'section-';
|
||||
} else {
|
||||
prefix = '';
|
||||
}
|
||||
|
||||
if (!options.rawPrefixHeaderId) {
|
||||
title = prefix + title;
|
||||
}
|
||||
|
||||
if (options.ghCompatibleHeaderId) {
|
||||
title = title
|
||||
.replace(/ /g, '-')
|
||||
// replace previously escaped chars (&, ¨ and $)
|
||||
.replace(/&/g, '')
|
||||
.replace(/¨T/g, '')
|
||||
.replace(/¨D/g, '')
|
||||
// replace rest of the chars (&~$ are repeated as they might have been escaped)
|
||||
// borrowed from github's redcarpet (some they should produce similar results)
|
||||
.replace(/[&+$,\/:;=?@"#{}|^¨~\[\]`\\*)(%.!'<>]/g, '')
|
||||
.toLowerCase();
|
||||
} else if (options.rawHeaderId) {
|
||||
title = title
|
||||
.replace(/ /g, '-')
|
||||
// replace previously escaped chars (&, ¨ and $)
|
||||
.replace(/&/g, '&')
|
||||
.replace(/¨T/g, '¨')
|
||||
.replace(/¨D/g, '$')
|
||||
// replace " and '
|
||||
.replace(/["']/g, '-')
|
||||
.toLowerCase();
|
||||
} else {
|
||||
title = title
|
||||
.replace(/[^\w]/g, '')
|
||||
.toLowerCase();
|
||||
}
|
||||
|
||||
if (options.rawPrefixHeaderId) {
|
||||
title = prefix + title;
|
||||
}
|
||||
|
||||
if (globals.hashLinkCounts[title]) {
|
||||
title = title + '-' + (globals.hashLinkCounts[title]++);
|
||||
} else {
|
||||
globals.hashLinkCounts[title] = 1;
|
||||
}
|
||||
return title;
|
||||
}
|
||||
|
||||
text = globals.converter._dispatch('makehtml.headers.after', text, options, globals).getText();
|
||||
return text;
|
||||
});
|
||||
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* Turn Markdown horizontal rule shortcuts into <hr /> tags.
|
||||
*
|
||||
* Any 3 or more unindented consecutive hyphens, asterisks or underscores with or without a space beetween them
|
||||
* in a single line is considered a horizontal rule
|
||||
*/
|
||||
showdown.subParser('makehtml.horizontalRule', function (text, options, globals) {
|
||||
'use strict';
|
||||
text = globals.converter._dispatch('makehtml.horizontalRule.before', text, options, globals).getText();
|
||||
|
||||
var key = showdown.subParser('makehtml.hashBlock')('<hr />', options, globals);
|
||||
text = text.replace(/^ {0,2}( ?-){3,}[ \t]*$/gm, key);
|
||||
text = text.replace(/^ {0,2}( ?\*){3,}[ \t]*$/gm, key);
|
||||
text = text.replace(/^ {0,2}( ?_){3,}[ \t]*$/gm, key);
|
||||
|
||||
text = globals.converter._dispatch('makehtml.horizontalRule.after', text, options, globals).getText();
|
||||
return text;
|
||||
});
|
||||
@@ -0,0 +1,104 @@
|
||||
/**
|
||||
* Turn Markdown image shortcuts into <img> tags.
|
||||
*/
|
||||
showdown.subParser('makehtml.images', function (text, options, globals) {
|
||||
'use strict';
|
||||
|
||||
text = globals.converter._dispatch('makehtml.images.before', text, options, globals).getText();
|
||||
|
||||
var inlineRegExp = /!\[([^\]]*?)][ \t]*()\([ \t]?<?([\S]+?(?:\([\S]*?\)[\S]*?)?)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g,
|
||||
crazyRegExp = /!\[([^\]]*?)][ \t]*()\([ \t]?<([^>]*)>(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(?:(["'])([^"]*?)\6))?[ \t]?\)/g,
|
||||
base64RegExp = /!\[([^\]]*?)][ \t]*()\([ \t]?<?(data:.+?\/.+?;base64,[A-Za-z0-9+/=\n]+?)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g,
|
||||
referenceRegExp = /!\[([^\]]*?)] ?(?:\n *)?\[([\s\S]*?)]()()()()()/g,
|
||||
refShortcutRegExp = /!\[([^\[\]]+)]()()()()()/g;
|
||||
|
||||
function writeImageTagBase64 (wholeMatch, altText, linkId, url, width, height, m5, title) {
|
||||
url = url.replace(/\s/g, '');
|
||||
return writeImageTag (wholeMatch, altText, linkId, url, width, height, m5, title);
|
||||
}
|
||||
|
||||
function writeImageTag (wholeMatch, altText, linkId, url, width, height, m5, title) {
|
||||
|
||||
var gUrls = globals.gUrls,
|
||||
gTitles = globals.gTitles,
|
||||
gDims = globals.gDimensions;
|
||||
|
||||
linkId = linkId.toLowerCase();
|
||||
|
||||
if (!title) {
|
||||
title = '';
|
||||
}
|
||||
// Special case for explicit empty url
|
||||
if (wholeMatch.search(/\(<?\s*>? ?(['"].*['"])?\)$/m) > -1) {
|
||||
url = '';
|
||||
|
||||
} else if (url === '' || url === null) {
|
||||
if (linkId === '' || linkId === null) {
|
||||
// lower-case and turn embedded newlines into spaces
|
||||
linkId = altText.toLowerCase().replace(/ ?\n/g, ' ');
|
||||
}
|
||||
url = '#' + linkId;
|
||||
|
||||
if (!showdown.helper.isUndefined(gUrls[linkId])) {
|
||||
url = gUrls[linkId];
|
||||
if (!showdown.helper.isUndefined(gTitles[linkId])) {
|
||||
title = gTitles[linkId];
|
||||
}
|
||||
if (!showdown.helper.isUndefined(gDims[linkId])) {
|
||||
width = gDims[linkId].width;
|
||||
height = gDims[linkId].height;
|
||||
}
|
||||
} else {
|
||||
return wholeMatch;
|
||||
}
|
||||
}
|
||||
|
||||
altText = altText
|
||||
.replace(/"/g, '"')
|
||||
//altText = showdown.helper.escapeCharacters(altText, '*_', false);
|
||||
.replace(showdown.helper.regexes.asteriskDashTildeAndColon, showdown.helper.escapeCharactersCallback);
|
||||
//url = showdown.helper.escapeCharacters(url, '*_', false);
|
||||
url = url.replace(showdown.helper.regexes.asteriskDashTildeAndColon, showdown.helper.escapeCharactersCallback);
|
||||
var result = '<img src="' + url + '" alt="' + altText + '"';
|
||||
|
||||
if (title && showdown.helper.isString(title)) {
|
||||
title = title
|
||||
.replace(/"/g, '"')
|
||||
//title = showdown.helper.escapeCharacters(title, '*_', false);
|
||||
.replace(showdown.helper.regexes.asteriskDashTildeAndColon, showdown.helper.escapeCharactersCallback);
|
||||
result += ' title="' + title + '"';
|
||||
}
|
||||
|
||||
if (width && height) {
|
||||
width = (width === '*') ? 'auto' : width;
|
||||
height = (height === '*') ? 'auto' : height;
|
||||
|
||||
result += ' width="' + width + '"';
|
||||
result += ' height="' + height + '"';
|
||||
}
|
||||
|
||||
result += ' />';
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// First, handle reference-style labeled images: ![alt text][id]
|
||||
text = text.replace(referenceRegExp, writeImageTag);
|
||||
|
||||
// Next, handle inline images: 
|
||||
|
||||
// base64 encoded images
|
||||
text = text.replace(base64RegExp, writeImageTagBase64);
|
||||
|
||||
// cases with crazy urls like ./image/cat1).png
|
||||
text = text.replace(crazyRegExp, writeImageTag);
|
||||
|
||||
// normal cases
|
||||
text = text.replace(inlineRegExp, writeImageTag);
|
||||
|
||||
// handle reference-style shortcuts: ![img text]
|
||||
text = text.replace(refShortcutRegExp, writeImageTag);
|
||||
|
||||
text = globals.converter._dispatch('makehtml.images.after', text, options, globals).getText();
|
||||
return text;
|
||||
});
|
||||
@@ -0,0 +1,66 @@
|
||||
showdown.subParser('makehtml.italicsAndBold', function (text, options, globals) {
|
||||
'use strict';
|
||||
|
||||
text = globals.converter._dispatch('makehtml.italicsAndBold.before', text, options, globals).getText();
|
||||
|
||||
// it's faster to have 3 separate regexes for each case than have just one
|
||||
// because of backtracing, in some cases, it could lead to an exponential effect
|
||||
// called "catastrophic backtrace". Ominous!
|
||||
|
||||
function parseInside (txt, left, right) {
|
||||
return left + txt + right;
|
||||
}
|
||||
|
||||
// Parse underscores
|
||||
if (options.literalMidWordUnderscores) {
|
||||
text = text.replace(/\b___(\S[\s\S]*?)___\b/g, function (wm, txt) {
|
||||
return parseInside (txt, '<strong><em>', '</em></strong>');
|
||||
});
|
||||
text = text.replace(/\b__(\S[\s\S]*?)__\b/g, function (wm, txt) {
|
||||
return parseInside (txt, '<strong>', '</strong>');
|
||||
});
|
||||
text = text.replace(/\b_(\S[\s\S]*?)_\b/g, function (wm, txt) {
|
||||
return parseInside (txt, '<em>', '</em>');
|
||||
});
|
||||
} else {
|
||||
text = text.replace(/___(\S[\s\S]*?)___/g, function (wm, m) {
|
||||
return (/\S$/.test(m)) ? parseInside (m, '<strong><em>', '</em></strong>') : wm;
|
||||
});
|
||||
text = text.replace(/__(\S[\s\S]*?)__/g, function (wm, m) {
|
||||
return (/\S$/.test(m)) ? parseInside (m, '<strong>', '</strong>') : wm;
|
||||
});
|
||||
text = text.replace(/_([^\s_][\s\S]*?)_/g, function (wm, m) {
|
||||
// !/^_[^_]/.test(m) - test if it doesn't start with __ (since it seems redundant, we removed it)
|
||||
return (/\S$/.test(m)) ? parseInside (m, '<em>', '</em>') : wm;
|
||||
});
|
||||
}
|
||||
|
||||
// Now parse asterisks
|
||||
/*
|
||||
if (options.literalMidWordAsterisks) {
|
||||
text = text.replace(/([^*]|^)\B\*\*\*(\S[\s\S]+?)\*\*\*\B(?!\*)/g, function (wm, lead, txt) {
|
||||
return parseInside (txt, lead + '<strong><em>', '</em></strong>');
|
||||
});
|
||||
text = text.replace(/([^*]|^)\B\*\*(\S[\s\S]+?)\*\*\B(?!\*)/g, function (wm, lead, txt) {
|
||||
return parseInside (txt, lead + '<strong>', '</strong>');
|
||||
});
|
||||
text = text.replace(/([^*]|^)\B\*(\S[\s\S]+?)\*\B(?!\*)/g, function (wm, lead, txt) {
|
||||
return parseInside (txt, lead + '<em>', '</em>');
|
||||
});
|
||||
} else {
|
||||
*/
|
||||
text = text.replace(/\*\*\*(\S[\s\S]*?)\*\*\*/g, function (wm, m) {
|
||||
return (/\S$/.test(m)) ? parseInside (m, '<strong><em>', '</em></strong>') : wm;
|
||||
});
|
||||
text = text.replace(/\*\*(\S[\s\S]*?)\*\*/g, function (wm, m) {
|
||||
return (/\S$/.test(m)) ? parseInside (m, '<strong>', '</strong>') : wm;
|
||||
});
|
||||
text = text.replace(/\*([^\s*][\s\S]*?)\*/g, function (wm, m) {
|
||||
// !/^\*[^*]/.test(m) - test if it doesn't start with ** (since it seems redundant, we removed it)
|
||||
return (/\S$/.test(m)) ? parseInside (m, '<em>', '</em>') : wm;
|
||||
});
|
||||
//}
|
||||
|
||||
text = globals.converter._dispatch('makehtml.italicsAndBold.after', text, options, globals).getText();
|
||||
return text;
|
||||
});
|
||||
@@ -0,0 +1,419 @@
|
||||
////
|
||||
// makehtml/links.js
|
||||
// Copyright (c) 2018 ShowdownJS
|
||||
//
|
||||
// Transforms MD links into `<a>` html anchors
|
||||
//
|
||||
// A link contains link text (the visible text), a link destination (the URI that is the link destination), and
|
||||
// optionally a link title. There are two basic kinds of links in Markdown.
|
||||
// In inline links the destination and title are given immediately after the link text.
|
||||
// In reference links the destination and title are defined elsewhere in the document.
|
||||
//
|
||||
// ***Author:***
|
||||
// - Estevão Soares dos Santos (Tivie) <https://github.com/tivie>
|
||||
////
|
||||
|
||||
(function () {
|
||||
/**
|
||||
* Helper function: Wrapper function to pass as second replace parameter
|
||||
*
|
||||
* @param {RegExp} rgx
|
||||
* @param {string} evtRootName
|
||||
* @param {{}} options
|
||||
* @param {{}} globals
|
||||
* @returns {Function}
|
||||
*/
|
||||
function replaceAnchorTag (rgx, evtRootName, options, globals, emptyCase) {
|
||||
emptyCase = !!emptyCase;
|
||||
return function (wholeMatch, text, id, url, m5, m6, title) {
|
||||
// bail we we find 2 newlines somewhere
|
||||
if (/\n\n/.test(wholeMatch)) {
|
||||
return wholeMatch;
|
||||
}
|
||||
|
||||
var evt = createEvent(rgx, evtRootName + '.captureStart', wholeMatch, text, id, url, title, options, globals);
|
||||
return writeAnchorTag(evt, options, globals, emptyCase);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO Normalize this
|
||||
* Helper function: Create a capture event
|
||||
* @param {RegExp} rgx
|
||||
* @param {String} evtName Event name
|
||||
* @param {String} wholeMatch
|
||||
* @param {String} text
|
||||
* @param {String} id
|
||||
* @param {String} url
|
||||
* @param {String} title
|
||||
* @param {{}} options
|
||||
* @param {{}} globals
|
||||
* @returns {showdown.helper.Event|*}
|
||||
*/
|
||||
function createEvent (rgx, evtName, wholeMatch, text, id, url, title, options, globals) {
|
||||
return globals.converter._dispatch(evtName, wholeMatch, options, globals, {
|
||||
regexp: rgx,
|
||||
matches: {
|
||||
wholeMatch: wholeMatch,
|
||||
text: text,
|
||||
id: id,
|
||||
url: url,
|
||||
title: title
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper Function: Normalize and write an anchor tag based on passed parameters
|
||||
* @param evt
|
||||
* @param options
|
||||
* @param globals
|
||||
* @param {boolean} emptyCase
|
||||
* @returns {string}
|
||||
*/
|
||||
function writeAnchorTag (evt, options, globals, emptyCase) {
|
||||
|
||||
var wholeMatch = evt.getMatches().wholeMatch;
|
||||
var text = evt.getMatches().text;
|
||||
var id = evt.getMatches().id;
|
||||
var url = evt.getMatches().url;
|
||||
var title = evt.getMatches().title;
|
||||
var target = '';
|
||||
|
||||
if (!title) {
|
||||
title = '';
|
||||
}
|
||||
id = (id) ? id.toLowerCase() : '';
|
||||
|
||||
if (emptyCase) {
|
||||
url = '';
|
||||
} else if (!url) {
|
||||
if (!id) {
|
||||
// lower-case and turn embedded newlines into spaces
|
||||
id = text.toLowerCase().replace(/ ?\n/g, ' ');
|
||||
}
|
||||
url = '#' + id;
|
||||
|
||||
if (!showdown.helper.isUndefined(globals.gUrls[id])) {
|
||||
url = globals.gUrls[id];
|
||||
if (!showdown.helper.isUndefined(globals.gTitles[id])) {
|
||||
title = globals.gTitles[id];
|
||||
}
|
||||
} else {
|
||||
return wholeMatch;
|
||||
}
|
||||
}
|
||||
//url = showdown.helper.escapeCharacters(url, '*_:~', false); // replaced line to improve performance
|
||||
url = url.replace(showdown.helper.regexes.asteriskDashTildeAndColon, showdown.helper.escapeCharactersCallback);
|
||||
|
||||
if (title !== '' && title !== null) {
|
||||
title = title.replace(/"/g, '"');
|
||||
//title = showdown.helper.escapeCharacters(title, '*_', false); // replaced line to improve performance
|
||||
title = title.replace(showdown.helper.regexes.asteriskDashTildeAndColon, showdown.helper.escapeCharactersCallback);
|
||||
title = ' title="' + title + '"';
|
||||
}
|
||||
|
||||
// optionLinksInNewWindow only applies
|
||||
// to external links. Hash links (#) open in same page
|
||||
if (options.openLinksInNewWindow && !/^#/.test(url)) {
|
||||
// escaped _
|
||||
target = ' target="¨E95Eblank"';
|
||||
}
|
||||
|
||||
// Text can be a markdown element, so we run through the appropriate parsers
|
||||
text = showdown.subParser('makehtml.codeSpans')(text, options, globals);
|
||||
text = showdown.subParser('makehtml.emoji')(text, options, globals);
|
||||
text = showdown.subParser('makehtml.underline')(text, options, globals);
|
||||
text = showdown.subParser('makehtml.italicsAndBold')(text, options, globals);
|
||||
text = showdown.subParser('makehtml.strikethrough')(text, options, globals);
|
||||
text = showdown.subParser('makehtml.ellipsis')(text, options, globals);
|
||||
text = showdown.subParser('makehtml.hashHTMLSpans')(text, options, globals);
|
||||
|
||||
//evt = createEvent(rgx, evtRootName + '.captureEnd', wholeMatch, text, id, url, title, options, globals);
|
||||
|
||||
var result = '<a href="' + url + '"' + title + target + '>' + text + '</a>';
|
||||
|
||||
//evt = createEvent(rgx, evtRootName + '.beforeHash', wholeMatch, text, id, url, title, options, globals);
|
||||
|
||||
result = showdown.subParser('makehtml.hashHTMLSpans')(result, options, globals);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
var evtRootName = 'makehtml.links';
|
||||
|
||||
/**
|
||||
* Turn Markdown link shortcuts into XHTML <a> tags.
|
||||
*/
|
||||
showdown.subParser('makehtml.links', function (text, options, globals) {
|
||||
|
||||
text = globals.converter._dispatch(evtRootName + '.start', text, options, globals).getText();
|
||||
|
||||
// 1. Handle reference-style links: [link text] [id]
|
||||
text = showdown.subParser('makehtml.links.reference')(text, options, globals);
|
||||
|
||||
// 2. Handle inline-style links: [link text](url "optional title")
|
||||
text = showdown.subParser('makehtml.links.inline')(text, options, globals);
|
||||
|
||||
// 3. Handle reference-style shortcuts: [link text]
|
||||
// These must come last in case there's a [link text][1] or [link text](/foo)
|
||||
text = showdown.subParser('makehtml.links.referenceShortcut')(text, options, globals);
|
||||
|
||||
// 4. Handle angle brackets links -> `<http://example.com/>`
|
||||
// Must come after links, because you can use < and > delimiters in inline links like [this](<url>).
|
||||
text = showdown.subParser('makehtml.links.angleBrackets')(text, options, globals);
|
||||
|
||||
// 5. Handle GithubMentions (if option is enabled)
|
||||
text = showdown.subParser('makehtml.links.ghMentions')(text, options, globals);
|
||||
|
||||
// 6. Handle <a> tags and img tags
|
||||
text = text.replace(/<a\s[^>]*>[\s\S]*<\/a>/g, function (wholeMatch) {
|
||||
return showdown.helper._hashHTMLSpan(wholeMatch, globals);
|
||||
});
|
||||
|
||||
text = text.replace(/<img\s[^>]*\/?>/g, function (wholeMatch) {
|
||||
return showdown.helper._hashHTMLSpan(wholeMatch, globals);
|
||||
});
|
||||
|
||||
// 7. Handle naked links (if option is enabled)
|
||||
text = showdown.subParser('makehtml.links.naked')(text, options, globals);
|
||||
|
||||
text = globals.converter._dispatch(evtRootName + '.end', text, options, globals).getText();
|
||||
return text;
|
||||
});
|
||||
|
||||
/**
|
||||
* TODO WRITE THIS DOCUMENTATION
|
||||
*/
|
||||
showdown.subParser('makehtml.links.inline', function (text, options, globals) {
|
||||
var evtRootName = evtRootName + '.inline';
|
||||
|
||||
text = globals.converter._dispatch(evtRootName + '.start', text, options, globals).getText();
|
||||
|
||||
// 1. Look for empty cases: []() and [empty]() and []("title")
|
||||
var rgxEmpty = /\[(.*?)]()()()()\(<? ?>? ?(?:["'](.*)["'])?\)/g;
|
||||
text = text.replace(rgxEmpty, replaceAnchorTag(rgxEmpty, evtRootName, options, globals, true));
|
||||
|
||||
// 2. Look for cases with crazy urls like ./image/cat1).png
|
||||
var rgxCrazy = /\[((?:\[[^\]]*]|[^\[\]])*)]()\s?\([ \t]?<([^>]*)>(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g;
|
||||
text = text.replace(rgxCrazy, replaceAnchorTag(rgxCrazy, evtRootName, options, globals));
|
||||
|
||||
// 3. inline links with no title or titles wrapped in ' or ":
|
||||
// [text](url.com) || [text](<url.com>) || [text](url.com "title") || [text](<url.com> "title")
|
||||
//var rgx2 = /\[[ ]*[\s]?[ ]*([^\n\[\]]*?)[ ]*[\s]?[ ]*] ?()\(<?[ ]*[\s]?[ ]*([^\s'"]*)>?(?:[ ]*[\n]?[ ]*()(['"])(.*?)\5)?[ ]*[\s]?[ ]*\)/; // this regex is too slow!!!
|
||||
var rgx2 = /\[([\S ]*?)]\s?()\( *<?([^\s'"]*?(?:\([\S]*?\)[\S]*?)?)>?\s*(?:()(['"])(.*?)\5)? *\)/g;
|
||||
text = text.replace(rgx2, replaceAnchorTag(rgx2, evtRootName, options, globals));
|
||||
|
||||
// 4. inline links with titles wrapped in (): [foo](bar.com (title))
|
||||
var rgx3 = /\[([\S ]*?)]\s?()\( *<?([^\s'"]*?(?:\([\S]*?\)[\S]*?)?)>?\s+()()\((.*?)\) *\)/g;
|
||||
text = text.replace(rgx3, replaceAnchorTag(rgx3, evtRootName, options, globals));
|
||||
|
||||
text = globals.converter._dispatch(evtRootName + '.end', text, options, globals).getText();
|
||||
|
||||
return text;
|
||||
});
|
||||
|
||||
/**
|
||||
* TODO WRITE THIS DOCUMENTATION
|
||||
*/
|
||||
showdown.subParser('makehtml.links.reference', function (text, options, globals) {
|
||||
var evtRootName = evtRootName + '.reference';
|
||||
|
||||
text = globals.converter._dispatch(evtRootName + '.start', text, options, globals).getText();
|
||||
|
||||
var rgx = /\[((?:\[[^\]]*]|[^\[\]])*)] ?(?:\n *)?\[(.*?)]()()()()/g;
|
||||
text = text.replace(rgx, replaceAnchorTag(rgx, evtRootName, options, globals));
|
||||
|
||||
text = globals.converter._dispatch(evtRootName + '.end', text, options, globals).getText();
|
||||
|
||||
return text;
|
||||
});
|
||||
|
||||
/**
|
||||
* TODO WRITE THIS DOCUMENTATION
|
||||
*/
|
||||
showdown.subParser('makehtml.links.referenceShortcut', function (text, options, globals) {
|
||||
var evtRootName = evtRootName + '.referenceShortcut';
|
||||
|
||||
text = globals.converter._dispatch(evtRootName + '.start', text, options, globals).getText();
|
||||
|
||||
var rgx = /\[([^\[\]]+)]()()()()()/g;
|
||||
text = text.replace(rgx, replaceAnchorTag(rgx, evtRootName, options, globals));
|
||||
|
||||
text = globals.converter._dispatch(evtRootName + '.end', text, options, globals).getText();
|
||||
|
||||
return text;
|
||||
});
|
||||
|
||||
/**
|
||||
* TODO WRITE THIS DOCUMENTATION
|
||||
*/
|
||||
showdown.subParser('makehtml.links.ghMentions', function (text, options, globals) {
|
||||
var evtRootName = evtRootName + 'ghMentions';
|
||||
|
||||
if (!options.ghMentions) {
|
||||
return text;
|
||||
}
|
||||
|
||||
text = globals.converter._dispatch(evtRootName + '.start', text, options, globals).getText();
|
||||
|
||||
var rgx = /(^|\s)(\\)?(@([a-z\d]+(?:[a-z\d._-]+?[a-z\d]+)*))/gi;
|
||||
|
||||
text = text.replace(rgx, function (wholeMatch, st, escape, mentions, username) {
|
||||
// bail if the mentions was escaped
|
||||
if (escape === '\\') {
|
||||
return st + mentions;
|
||||
}
|
||||
|
||||
// check if options.ghMentionsLink is a string
|
||||
// TODO Validation should be done at initialization not at runtime
|
||||
if (!showdown.helper.isString(options.ghMentionsLink)) {
|
||||
throw new Error('ghMentionsLink option must be a string');
|
||||
}
|
||||
var url = options.ghMentionsLink.replace(/{u}/g, username);
|
||||
var evt = createEvent(rgx, evtRootName + '.captureStart', wholeMatch, mentions, null, url, null, options, globals);
|
||||
// captureEnd Event is triggered inside writeAnchorTag function
|
||||
return st + writeAnchorTag(evt, options, globals);
|
||||
});
|
||||
|
||||
text = globals.converter._dispatch(evtRootName + '.end', text, options, globals).getText();
|
||||
|
||||
return text;
|
||||
});
|
||||
|
||||
/**
|
||||
* TODO WRITE THIS DOCUMENTATION
|
||||
*/
|
||||
showdown.subParser('makehtml.links.angleBrackets', function (text, options, globals) {
|
||||
var evtRootName = 'makehtml.links.angleBrackets';
|
||||
|
||||
text = globals.converter._dispatch(evtRootName + '.start', text, options, globals).getText();
|
||||
|
||||
// 1. Parse links first
|
||||
var urlRgx = /<(((?:https?|ftp):\/\/|www\.)[^'">\s]+)>/gi;
|
||||
text = text.replace(urlRgx, function (wholeMatch, url, urlStart) {
|
||||
var text = url;
|
||||
url = (urlStart === 'www.') ? 'http://' + url : url;
|
||||
var evt = createEvent(urlRgx, evtRootName + '.captureStart', wholeMatch, text, null, url, null, options, globals);
|
||||
return writeAnchorTag(evt, options, globals);
|
||||
});
|
||||
|
||||
// 2. Then Mail Addresses
|
||||
var mailRgx = /<(?:mailto:)?([-.\w]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi;
|
||||
text = text.replace(mailRgx, function (wholeMatch, mail) {
|
||||
var url = 'mailto:';
|
||||
mail = showdown.subParser('makehtml.unescapeSpecialChars')(mail, options, globals);
|
||||
if (options.encodeEmails) {
|
||||
url = showdown.helper.encodeEmailAddress(url + mail);
|
||||
mail = showdown.helper.encodeEmailAddress(mail);
|
||||
} else {
|
||||
url = url + mail;
|
||||
}
|
||||
var evt = createEvent(mailRgx, evtRootName + '.captureStart', wholeMatch, mail, null, url, null, options, globals);
|
||||
return writeAnchorTag(evt, options, globals);
|
||||
});
|
||||
|
||||
text = globals.converter._dispatch(evtRootName + '.end', text, options, globals).getText();
|
||||
return text;
|
||||
});
|
||||
|
||||
/**
|
||||
* TODO MAKE THIS WORK (IT'S NOT ACTIVATED)
|
||||
* TODO WRITE THIS DOCUMENTATION
|
||||
*/
|
||||
showdown.subParser('makehtml.links.naked', function (text, options, globals) {
|
||||
if (!options.simplifiedAutoLink) {
|
||||
return text;
|
||||
}
|
||||
|
||||
var evtRootName = 'makehtml.links.naked';
|
||||
|
||||
text = globals.converter._dispatch(evtRootName + '.start', text, options, globals).getText();
|
||||
|
||||
// 2. Now we check for
|
||||
// we also include leading markdown magic chars [_*~] for cases like __https://www.google.com/foobar__
|
||||
var urlRgx = /([_*~]*?)(((?:https?|ftp):\/\/|www\.)[^\s<>"'`´.-][^\s<>"'`´]*?\.[a-z\d.]+[^\s<>"']*)\1/gi;
|
||||
text = text.replace(urlRgx, function (wholeMatch, leadingMDChars, url, urlPrefix) {
|
||||
|
||||
// we now will start traversing the url from the front to back, looking for punctuation chars [_*~,;:.!?\)\]]
|
||||
var len = url.length;
|
||||
var suffix = '';
|
||||
for (var i = len - 1; i >= 0; --i) {
|
||||
var char = url.charAt(i);
|
||||
|
||||
if (/[_*~,;:.!?]/.test(char)) {
|
||||
// it's a punctuation char
|
||||
// we remove it from the url
|
||||
url = url.slice(0, -1);
|
||||
// and prepend it to the suffix
|
||||
suffix = char + suffix;
|
||||
} else if (/\)/.test(char)) {
|
||||
var opPar = url.match(/\(/g) || [];
|
||||
var clPar = url.match(/\)/g);
|
||||
|
||||
// it's a curved parenthesis so we need to check for "balance" (kinda)
|
||||
if (opPar.length < clPar.length) {
|
||||
// there are more closing Parenthesis than opening so chop it!!!!!
|
||||
url = url.slice(0, -1);
|
||||
// and prepend it to the suffix
|
||||
suffix = char + suffix;
|
||||
} else {
|
||||
// it's (kinda) balanced so our work is done
|
||||
break;
|
||||
}
|
||||
} else if (/]/.test(char)) {
|
||||
var opPar2 = url.match(/\[/g) || [];
|
||||
var clPar2 = url.match(/\]/g);
|
||||
// it's a squared parenthesis so we need to check for "balance" (kinda)
|
||||
if (opPar2.length < clPar2.length) {
|
||||
// there are more closing Parenthesis than opening so chop it!!!!!
|
||||
url = url.slice(0, -1);
|
||||
// and prepend it to the suffix
|
||||
suffix = char + suffix;
|
||||
} else {
|
||||
// it's (kinda) balanced so our work is done
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
// it's not a punctuation or a parenthesis so our work is done
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// we copy the treated url to the text variable
|
||||
var text = url;
|
||||
// finally, if it's a www shortcut, we prepend http
|
||||
url = (urlPrefix === 'www.') ? 'http://' + url : url;
|
||||
|
||||
// url part is done so let's take care of text now
|
||||
// we need to escape the text (because of links such as www.example.com/foo__bar__baz)
|
||||
text = text.replace(showdown.helper.regexes.asteriskDashTildeAndColon, showdown.helper.escapeCharactersCallback);
|
||||
|
||||
// finally we dispatch the event
|
||||
var evt = createEvent(urlRgx, evtRootName + '.captureStart', wholeMatch, text, null, url, null, options, globals);
|
||||
|
||||
// and return the link tag, with the leadingMDChars and suffix. The leadingMDChars are added at the end too because
|
||||
// we consumed those characters in the regexp
|
||||
return leadingMDChars + writeAnchorTag(evt, options, globals) + suffix + leadingMDChars;
|
||||
});
|
||||
|
||||
// 2. Then mails
|
||||
var mailRgx = /(^|\s)(?:mailto:)?([A-Za-z0-9!#$%&'*+-/=?^_`{|}~.]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)(?=$|\s)/gmi;
|
||||
text = text.replace(mailRgx, function (wholeMatch, leadingChar, mail) {
|
||||
var url = 'mailto:';
|
||||
mail = showdown.subParser('makehtml.unescapeSpecialChars')(mail, options, globals);
|
||||
if (options.encodeEmails) {
|
||||
url = showdown.helper.encodeEmailAddress(url + mail);
|
||||
mail = showdown.helper.encodeEmailAddress(mail);
|
||||
} else {
|
||||
url = url + mail;
|
||||
}
|
||||
var evt = createEvent(mailRgx, evtRootName + '.captureStart', wholeMatch, mail, null, url, null, options, globals);
|
||||
return leadingChar + writeAnchorTag(evt, options, globals);
|
||||
});
|
||||
|
||||
|
||||
text = globals.converter._dispatch(evtRootName + '.end', text, options, globals).getText();
|
||||
return text;
|
||||
});
|
||||
})();
|
||||
@@ -0,0 +1,216 @@
|
||||
/**
|
||||
* Form HTML ordered (numbered) and unordered (bulleted) lists.
|
||||
*/
|
||||
showdown.subParser('makehtml.lists', function (text, options, globals) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Process the contents of a single ordered or unordered list, splitting it
|
||||
* into individual list items.
|
||||
* @param {string} listStr
|
||||
* @param {boolean} trimTrailing
|
||||
* @returns {string}
|
||||
*/
|
||||
function processListItems (listStr, trimTrailing) {
|
||||
// The $g_list_level global keeps track of when we're inside a list.
|
||||
// Each time we enter a list, we increment it; when we leave a list,
|
||||
// we decrement. If it's zero, we're not in a list anymore.
|
||||
//
|
||||
// We do this because when we're not inside a list, we want to treat
|
||||
// something like this:
|
||||
//
|
||||
// I recommend upgrading to version
|
||||
// 8. Oops, now this line is treated
|
||||
// as a sub-list.
|
||||
//
|
||||
// As a single paragraph, despite the fact that the second line starts
|
||||
// with a digit-period-space sequence.
|
||||
//
|
||||
// Whereas when we're inside a list (or sub-list), that line will be
|
||||
// treated as the start of a sub-list. What a kludge, huh? This is
|
||||
// an aspect of Markdown's syntax that's hard to parse perfectly
|
||||
// without resorting to mind-reading. Perhaps the solution is to
|
||||
// change the syntax rules such that sub-lists must start with a
|
||||
// starting cardinal number; e.g. "1." or "a.".
|
||||
globals.gListLevel++;
|
||||
|
||||
// trim trailing blank lines:
|
||||
listStr = listStr.replace(/\n{2,}$/, '\n');
|
||||
|
||||
// attacklab: add sentinel to emulate \z
|
||||
listStr += '¨0';
|
||||
|
||||
var rgx = /(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0| {0,3}([*+-]|\d+[.])[ \t]+))/gm,
|
||||
isParagraphed = (/\n[ \t]*\n(?!¨0)/.test(listStr));
|
||||
|
||||
// Since version 1.5, nesting sublists requires 4 spaces (or 1 tab) indentation,
|
||||
// which is a syntax breaking change
|
||||
// activating this option reverts to old behavior
|
||||
// This will be removed in version 2.0
|
||||
if (options.disableForced4SpacesIndentedSublists) {
|
||||
rgx = /(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0|\2([*+-]|\d+[.])[ \t]+))/gm;
|
||||
}
|
||||
|
||||
listStr = listStr.replace(rgx, function (wholeMatch, m1, m2, m3, m4, taskbtn, checked) {
|
||||
checked = (checked && checked.trim() !== '');
|
||||
|
||||
var item = showdown.subParser('makehtml.outdent')(m4, options, globals),
|
||||
bulletStyle = '';
|
||||
|
||||
// Support for github tasklists
|
||||
if (taskbtn && options.tasklists) {
|
||||
bulletStyle = ' class="task-list-item" style="list-style-type: none;"';
|
||||
item = item.replace(/^[ \t]*\[(x|X| )?]/m, function () {
|
||||
var otp = '<input type="checkbox" disabled style="margin: 0px 0.35em 0.25em -1.6em; vertical-align: middle;"';
|
||||
if (checked) {
|
||||
otp += ' checked';
|
||||
}
|
||||
otp += '>';
|
||||
return otp;
|
||||
});
|
||||
}
|
||||
|
||||
// ISSUE #312
|
||||
// This input: - - - a
|
||||
// causes trouble to the parser, since it interprets it as:
|
||||
// <ul><li><li><li>a</li></li></li></ul>
|
||||
// instead of:
|
||||
// <ul><li>- - a</li></ul>
|
||||
// So, to prevent it, we will put a marker (¨A)in the beginning of the line
|
||||
// Kind of hackish/monkey patching, but seems more effective than overcomplicating the list parser
|
||||
item = item.replace(/^([-*+]|\d\.)[ \t]+[\S\n ]*/g, function (wm2) {
|
||||
return '¨A' + wm2;
|
||||
});
|
||||
|
||||
// SPECIAL CASE: an heading followed by a paragraph of text that is not separated by a double newline
|
||||
// or/nor indented. ex:
|
||||
//
|
||||
// - # foo
|
||||
// bar is great
|
||||
//
|
||||
// While this does now follow the spec per se, not allowing for this might cause confusion since
|
||||
// header blocks don't need double newlines after
|
||||
if (/^#+.+\n.+/.test(item)) {
|
||||
item = item.replace(/^(#+.+)$/m, '$1\n');
|
||||
}
|
||||
|
||||
// m1 - Leading line or
|
||||
// Has a double return (multi paragraph)
|
||||
if (m1 || (item.search(/\n{2,}/) > -1)) {
|
||||
item = showdown.subParser('makehtml.githubCodeBlocks')(item, options, globals);
|
||||
item = showdown.subParser('makehtml.blockGamut')(item, options, globals);
|
||||
} else {
|
||||
|
||||
// Recursion for sub-lists:
|
||||
item = showdown.subParser('makehtml.lists')(item, options, globals);
|
||||
item = item.replace(/\n$/, ''); // chomp(item)
|
||||
item = showdown.subParser('makehtml.hashHTMLBlocks')(item, options, globals);
|
||||
|
||||
// Colapse double linebreaks
|
||||
item = item.replace(/\n\n+/g, '\n\n');
|
||||
|
||||
if (isParagraphed) {
|
||||
item = showdown.subParser('makehtml.paragraphs')(item, options, globals);
|
||||
} else {
|
||||
item = showdown.subParser('makehtml.spanGamut')(item, options, globals);
|
||||
}
|
||||
}
|
||||
|
||||
// now we need to remove the marker (¨A)
|
||||
item = item.replace('¨A', '');
|
||||
// we can finally wrap the line in list item tags
|
||||
item = '<li' + bulletStyle + '>' + item + '</li>\n';
|
||||
|
||||
return item;
|
||||
});
|
||||
|
||||
// attacklab: strip sentinel
|
||||
listStr = listStr.replace(/¨0/g, '');
|
||||
|
||||
globals.gListLevel--;
|
||||
|
||||
if (trimTrailing) {
|
||||
listStr = listStr.replace(/\s+$/, '');
|
||||
}
|
||||
|
||||
return listStr;
|
||||
}
|
||||
|
||||
function styleStartNumber (list, listType) {
|
||||
// check if ol and starts by a number different than 1
|
||||
if (listType === 'ol') {
|
||||
var res = list.match(/^ *(\d+)\./);
|
||||
if (res && res[1] !== '1') {
|
||||
return ' start="' + res[1] + '"';
|
||||
}
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Check and parse consecutive lists (better fix for issue #142)
|
||||
* @param {string} list
|
||||
* @param {string} listType
|
||||
* @param {boolean} trimTrailing
|
||||
* @returns {string}
|
||||
*/
|
||||
function parseConsecutiveLists (list, listType, trimTrailing) {
|
||||
// check if we caught 2 or more consecutive lists by mistake
|
||||
// we use the counterRgx, meaning if listType is UL we look for OL and vice versa
|
||||
var olRgx = (options.disableForced4SpacesIndentedSublists) ? /^ ?\d+\.[ \t]/gm : /^ {0,3}\d+\.[ \t]/gm,
|
||||
ulRgx = (options.disableForced4SpacesIndentedSublists) ? /^ ?[*+-][ \t]/gm : /^ {0,3}[*+-][ \t]/gm,
|
||||
counterRxg = (listType === 'ul') ? olRgx : ulRgx,
|
||||
result = '';
|
||||
|
||||
if (list.search(counterRxg) !== -1) {
|
||||
(function parseCL (txt) {
|
||||
var pos = txt.search(counterRxg),
|
||||
style = styleStartNumber(list, listType);
|
||||
if (pos !== -1) {
|
||||
// slice
|
||||
result += '\n\n<' + listType + style + '>\n' + processListItems(txt.slice(0, pos), !!trimTrailing) + '</' + listType + '>\n';
|
||||
|
||||
// invert counterType and listType
|
||||
listType = (listType === 'ul') ? 'ol' : 'ul';
|
||||
counterRxg = (listType === 'ul') ? olRgx : ulRgx;
|
||||
|
||||
//recurse
|
||||
parseCL(txt.slice(pos));
|
||||
} else {
|
||||
result += '\n\n<' + listType + style + '>\n' + processListItems(txt, !!trimTrailing) + '</' + listType + '>\n';
|
||||
}
|
||||
})(list);
|
||||
} else {
|
||||
var style = styleStartNumber(list, listType);
|
||||
result = '\n\n<' + listType + style + '>\n' + processListItems(list, !!trimTrailing) + '</' + listType + '>\n';
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// Start of list parsing
|
||||
var subListRgx = /^(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm;
|
||||
var mainListRgx = /(\n\n|^\n?)(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm;
|
||||
|
||||
text = globals.converter._dispatch('lists.before', text, options, globals).getText();
|
||||
// add sentinel to hack around khtml/safari bug:
|
||||
// http://bugs.webkit.org/show_bug.cgi?id=11231
|
||||
text += '¨0';
|
||||
|
||||
if (globals.gListLevel) {
|
||||
text = text.replace(subListRgx, function (wholeMatch, list, m2) {
|
||||
var listType = (m2.search(/[*+-]/g) > -1) ? 'ul' : 'ol';
|
||||
return parseConsecutiveLists(list, listType, true);
|
||||
});
|
||||
} else {
|
||||
text = text.replace(mainListRgx, function (wholeMatch, m1, list, m3) {
|
||||
var listType = (m3.search(/[*+-]/g) > -1) ? 'ul' : 'ol';
|
||||
return parseConsecutiveLists(list, listType, false);
|
||||
});
|
||||
}
|
||||
|
||||
// strip sentinel
|
||||
text = text.replace(/¨0/, '');
|
||||
text = globals.converter._dispatch('makehtml.lists.after', text, options, globals).getText();
|
||||
return text;
|
||||
});
|
||||
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* Parse metadata at the top of the document
|
||||
*/
|
||||
showdown.subParser('makehtml.metadata', function (text, options, globals) {
|
||||
'use strict';
|
||||
|
||||
if (!options.metadata) {
|
||||
return text;
|
||||
}
|
||||
|
||||
text = globals.converter._dispatch('makehtml.metadata.before', text, options, globals).getText();
|
||||
|
||||
function parseMetadataContents (content) {
|
||||
// raw is raw so it's not changed in any way
|
||||
globals.metadata.raw = content;
|
||||
|
||||
// escape chars forbidden in html attributes
|
||||
// double quotes
|
||||
content = content
|
||||
// ampersand first
|
||||
.replace(/&/g, '&')
|
||||
// double quotes
|
||||
.replace(/"/g, '"');
|
||||
|
||||
content = content.replace(/\n {4}/g, ' ');
|
||||
content.replace(/^([\S ]+): +([\s\S]+?)$/gm, function (wm, key, value) {
|
||||
globals.metadata.parsed[key] = value;
|
||||
return '';
|
||||
});
|
||||
}
|
||||
|
||||
text = text.replace(/^\s*«««+(\S*?)\n([\s\S]+?)\n»»»+\n/, function (wholematch, format, content) {
|
||||
parseMetadataContents(content);
|
||||
return '¨M';
|
||||
});
|
||||
|
||||
text = text.replace(/^\s*---+(\S*?)\n([\s\S]+?)\n---+\n/, function (wholematch, format, content) {
|
||||
if (format) {
|
||||
globals.metadata.format = format;
|
||||
}
|
||||
parseMetadataContents(content);
|
||||
return '¨M';
|
||||
});
|
||||
|
||||
text = text.replace(/¨M/g, '');
|
||||
|
||||
text = globals.converter._dispatch('makehtml.metadata.after', text, options, globals).getText();
|
||||
return text;
|
||||
});
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user