对比测试代码编号

$(function(){
    $('pre code').each(function(){
    	texts = $(this).text().replace(/&(?!#?[a-zA-Z0-9]+;)/g, '&')
        .replace(//g, '>').replace(/'/g, ''').replace(/"/g, '"')        
        var codetext = texts.split('\n');
        var code = '';
        $(codetext).each(function(v){
        	code += '
  • '+codetext[v]+'
  • '; }) code = '
      '+code+'
    '; $(this).html(code); }); });

    测试markdown常规代码块

        $('pre code').each(function(){
        	texts = $(this).text().replace(/&(?!#?[a-zA-Z0-9]+;)/g, '&')
            .replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/'/g, '&#39;').replace(/"/g, '&quot;')        
            var codetext = texts.split('\n');
            var code = '';
            $(codetext).each(function(v){
            	code += '<li>'+codetext[v]+'</li>';
            })        
            code = '<ol>'+code+'</ol>';
            $(this).html(code);
        });
    });
    

    测试图片折叠效果

    [测试篇]MarkDown之代码块行号+折叠图片
    <-此处有图片

    相关文章:

    • 2021-06-17
    • 2021-04-30
    • 2022-02-04
    • 2021-08-02
    • 2021-04-30
    • 2021-07-09
    • 2022-12-23
    猜你喜欢
    • 2022-12-23
    • 2022-01-05
    • 2022-12-23
    • 2022-12-23
    • 2022-01-17
    • 2022-12-23
    • 2021-11-04
    相关资源
    相似解决方案