html支持LaTeX嘛,latex.html

Whzecomjm's Wiki

// 获取 get 参数的函数

function QueryGET(TheName){

var urlt = window.location.href.split("?");

if(!urlt[1]){}else{

var clearurl = urlt[1].split("#");

var gets = clearurl[0].split("&");

for(var i=0;i

var get = gets[i].split("=");

if(get[0] == TheName){

var TheValue = get[1];

break;

}

}

}

return TheValue;

}

function line_code(num){

canvas = document.getElementById('line_num_canvas');

if (canvas.getContext) {

ctx = canvas.getContext('2d');

}

canvas.width = 70;

canvas.height = 28;

ctx.font = "16px Arial";

// 设置对齐方式

ctx.textAlign = "right";

// 设置填充颜色

ctx.fillStyle = "#888888";

// 设置字体内容,以及在画布上的位置

ctx.fillText(num, 65, 21);

// 返回图像

var image = new Image();

return canvas.toDataURL("image/png");

}

$(document).ready(function(){

// 运行代码高亮库

hljs.initHighlightingOnLoad();

// 设置 Markdown 转换时代码高亮函数

marked.setOptions({

highlight: function (code,lang) {

return hljs.highlightAuto(code).value;

}

});

var renderer = new marked.Renderer();

renderer.image = function(href, title, text){

return '

'+text+'
';

};

renderer.link = function(href, title, text){

var reg = new RegExp("^[\\w\\-\\:]+$");

if(reg.test(href)){

return ''+text+'';

}else{

return ''+text+'';

}

};

// 分析地址,获取源文件地址

var dirurl="data";

name = QueryGET("name");

if(!name || name == undefined || name == "undefined"){

dirurl += "/index";

}else{

subnames = name.split(":");

for(i in subnames){

dirurl += "/" +subnames[i];

};

}

fileurl = dirurl + ".md";

// 请求 Markdown 文件

$.ajax({

url:fileurl,

async:true,

dataType:"text",

error:function(){

$("#content").html('

该页面还不存在哦~

');

},

success:function(markdownString){

// 将转换好的内容写入页面

$("#content").html(function(){

return marked(markdownString,{ renderer: renderer });

});

// 代码高亮加行号

$('pre code').each(function(){

var thecode = $(this).html().split('\n');

var code = "";

for(k in thecode){

if(!thecode[k] && k == (thecode.length-1)){}else{

m=k+1;

code +='

';

}

}

$(this).html(code);

});

// 设置页面标题

pagetitle=$("#content").find(":header:first").text();

if(pagetitle != ""){

$("title").text(pagetitle + " - Wiki in box");

}

}

});

});

Loading……

MathJax.Hub.Config({

extensions: ["tex2jax.js"],

jax: ["input/TeX", "output/HTML-CSS"],

tex2jax: {

inlineMath: [ ['$','$'], ["\\(","\\)"] ],

displayMath: [ ['$$','$$'], ["\\[","\\]"] ],

processEscapes: true

},

"HTML-CSS": { availableFonts: ["TeX"] ,scale: 90}

});

一键复制

编辑

Web IDE

原始数据

按行查看

历史

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值