markdown-button
https://gyazo.com/6b9ee763f64c852c009379e3f0300093
daiiz.icon
変換したいときだけボタンを書けばいい
ボタン自身も変換後のMarkdownコードに含まれてしまうのはなんとかしたい
html-button,tex-button を作りたくなってきた
code:button.js
function main(){var m=function(b){b=b.replace(/&/g,"&");b=b.replace(/</g,"<");b=b.replace(/>/g,">");b=b.replace(/"/g,""");return b=b.replace(/'/g,"'")},n=function(b){b=void 0===b?0:b;for(var a="",g=1;g<b;g++)a+=" ";return a},p=function(b){b=void 0===b?"":b;var a=document.createElement("div");a.innerHTML=b;b=a.querySelectorAll("strong");for(var g=0;g<b.length;g++){for(var c=bg,e=+c.className.split("level-")1,d=c.innerHTML,e=void 0===e?1:e,e=6-e,f="",h=0;h<e;h++)f+="#";c.innerHTML= f+" "+d}return a.innerHTML},q=function(b){b=void 0===b?"":b;var a=document.createElement("div");a.innerHTML=b;b=a.querySelectorAll("a");for(var g=0;g<b.length;g++){var c=bg,e=c.innerText.trim(),d=c.href,e=""+e+"("+d+")",f=c.querySelector("img");null!==f&&(e="[!Image("+f.src+")]("+d+")");c.innerText=e}return a.innerText},f=document.querySelector(".lines"),r=f.querySelector(".line-title .text").innerText,f=f.querySelectorAll(".line");var pageTexts=[];for(var l=1;l<f.length;l++){for(var d=fl.querySelector(".text").cloneNode(!0), h=d.querySelectorAll("span.empty-char-index"),a=0;a<h.length;a++){var k=ha;k.innerText=""}h=d.querySelectorAll("span.backquote");for(a=0;a<h.length;a++)k=ha,k.innerText="`";a=d.innerHTML.replace(/<span>/g,"");a=a.replace(/<span.+?>/g,"").replace(/<\/span>/g,"");a=a.replace(/<br.+?>/g,"");a=a.replace(/\n/gi,"").replace(/\t/gi,"").trim();a=p(a);a=q(a);d=d.querySelector(".indent-mark");null!==d&&(k=+d.style.width.split("em")0/1.5,a=n(k)+"- "+a);null===d&&0<a.length&&"#"!==a0&&(a+="<br>");pageTexts.push(a)}(function(b, a){b=void 0===b?"Title":b;a=void 0===a?[]:a;for(var d="# "+b+"\n",c=0;c<a.length;c++)d+="\n"+ac;print(m(d))} )(r,pageTexts)}; const print = body => {
const url = URL.createObjectURL(new Blob(bom, body, { type: "text/plain",
}))
window.open(url)
}
main()
code:button.old.js
(function(){var m=function(b){b=b.replace(/&/g,"&");b=b.replace(/</g,"<");b=b.replace(/>/g,">");b=b.replace(/"/g,""");return b=b.replace(/'/g,"'")},n=function(b){b=void 0===b?0:b;for(var a="",g=1;g<b;g++)a+=" ";return a},p=function(b){b=void 0===b?"":b;var a=document.createElement("div");a.innerHTML=b;b=a.querySelectorAll("strong");for(var g=0;g<b.length;g++){for(var c=bg,e=+c.className.split("level-")1,d=c.innerHTML,e=void 0===e?1:e,e=6-e,f="",h=0;h<e;h++)f+="#";c.innerHTML= f+" "+d}return a.innerHTML},q=function(b){b=void 0===b?"":b;var a=document.createElement("div");a.innerHTML=b;b=a.querySelectorAll("a");for(var g=0;g<b.length;g++){var c=bg,e=c.innerText.trim(),d=c.href,e=""+e+"("+d+")",f=c.querySelector("img");null!==f&&(e="[!Image("+f.src+")]("+d+")");c.innerText=e}return a.innerText},f=document.querySelector(".lines"),r=f.querySelector(".line-title .text").innerText,f=f.querySelectorAll(".line");pageTexts=[];for(var l=1;l<f.length;l++){for(var d=fl.querySelector(".text").cloneNode(!0), h=d.querySelectorAll("span.empty-char-index"),a=0;a<h.length;a++){var k=ha;k.innerText=""}h=d.querySelectorAll("span.backquote");for(a=0;a<h.length;a++)k=ha,k.innerText="`";a=d.innerHTML.replace(/<span>/g,"");a=a.replace(/<span.+?>/g,"").replace(/<\/span>/g,"");a=a.replace(/<br.+?>/g,"");a=a.replace(/\n/gi,"").replace(/\t/gi,"").trim();a=p(a);a=q(a);d=d.querySelector(".indent-mark");null!==d&&(k=+d.style.width.split("em")0/1.5,a=n(k)+"- "+a);null===d&&0<a.length&&"#"!==a0&&(a+="<br>");pageTexts.push(a)}(function(b, a){b=void 0===b?"Title":b;a=void 0===a?[]:a;for(var d="# "+b+"\n",c=0;c<a.length;c++)d+="\n"+ac;c=window.open();c.document.open();c.document.write("<title>"+b+"</title>");c.document.write("<pre>");c.document.write(m(d));c.document.write("</pre>");c.document.close()})(r,pageTexts)})();