社区文档构建进行中,欢迎编辑。社区答疑群(非官方):717421103
Widget:ParseWikiToHtml
<label><input id="PWTHIsDisplay" type="button" value="显示预览" onclick="PWTHFun.parse()"/></label>(Widget原作者:丩卩夂忄 bid:4494421)
<textarea id="PWTHWiki" style="width:100%;height:;"></textarea> |
渲染成的HTML: <textarea id="PWTHHtml" style="width:100%;height:200px;"></textarea> <script> PWTHFun={ "parse":function(){ PWTHFun.sendFd(document.getElementById("PWTHWiki").value); }, "sendFd":function(text){ let url="https://wiki.biligame.com"+mw.config.values.wgScriptPath+"/api.php"; let params = { action: 'parse', text: text, format: 'json' }; let api = new mw.Api(); api.get( params ).done( function ( data ) { let res = data.parse.text['*'].replace(//g,"").trim(); document.getElementById("PWTHHtml").value = res; document.getElementById("PWTHDisplay").innerHTML=res; } ); }, } window.addEventListener("load",function(){ PWTHFun.parse() }) </script> <style>
- ParseWikiToHtml #toc{
display:none; } </style>