markedjs实现markdown文本转html预览效果代码

代码语言:html

所属分类:其他

代码描述:markedjs实现markdown文本转html预览效果代码,还能生成html代码

代码标签: markedjs markdown 文本 html 预览

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum=1.0,minimum=1.0,user-scalable=0" />
    <title>BFW NEW PAGE</title>
    <script id="bfwone" data="dep=jquery.17&err=0" type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/bfwone.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/marked.min.js"></script>

 <style>
        #area>table {
            width: 100%;
            table-layout: fixed;
        }
    
        #area table tr td {
            margin: 0;
            padding: 6px;
            border: 0;
    
        }
    
   table {
      width: 100%;
      border-collapse: collapse;
      font-family: Arial, sans-serif;
    }

    th, td {
      border: 1px solid #ddd;
      padding: 8px;
      text-align: left;
    }

    th {
      background-color: #f2f2f2;
    }

    tr:nth-child(even) {
      background-color: #f9f9f9;
    }

    tr:hover {
      background-color: #f1f1f1;
    }
        #md-area {
    
            width: 100%;
            height: 600px;
            font-size: 18px;
            overflow: hidden;
            font-weight: bold;
            outline: none;
        }
    
        #show-area {
            height: 600px;
            background-color: #FCF6E5;
               overflow: scroll;
        }
    
        .clearfix:before {
            content: "";
            display: table;
         
        }
    </style>
</head>
<body>


 <script>
 bready(function(){
mdSwitch();
     
 });
        function mdSwitch() {
            var mdValue = document.getElementById("md-area").value;

            var html =  marked(mdValue);
            document.getElementById("show-area").innerHTML = html;
        }
        
        function showcode(){
             var mdValue = document.getElementById("md-area").value;
           
            var html = marked(mdValue);
  .........完整代码请登录后点击上方下载按钮下载查看

网友评论0