基于vue的markdown编辑器效果

代码语言:html

所属分类:其他

代码描述:基于vue的markdown编辑器效果,使用marked.js进行实时markdown转换成html

代码标签: markdown 编辑器 效果

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

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Vue.js实现Markdown编辑器</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link type="text/css" rel="stylesheet" href="http://repo.bfw.wiki/bfwrepo/css/font-awesome-4.7.0/css/font-awesome.min.css">
    <link type="text/css" rel="stylesheet" href="http://repo.bfw.wiki/bfwrepo/css/normalize.css">
    <style>
        @import url("https://fonts.googleapis.com/css?family=Noto+Sans:400,700|Source+Code+Pro");
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  font-family: "Noto Sans", sans-serif;
  font-size: 16px;
}

h1, h2, h3, h4, h5, h6 {
  margin-top: 0;
}

#app-wall {
  min-height: 100vh;
  padding: 5rem 0;
  -webkit-transition: background .4s;
  transition: background .4s;
}
#app-wall.full {
  padding: 0;
}
#app-wall.full #app {
  width: 100%;
  height: calc(100vh - 40px);
  padding: 0;
  font-size: 100%;
}

#app {
  width: 40rem;
  max-width: 100%;
  height: 400px;
  margin: 0 auto;
  padding: 0 1rem;
  font-size: 70%;
  -webkit-transition: all .4s;
  transition: all .4s;
}

header {
  position: relative;
  height: 20px;
  line-height: 20px;
  text-align: center;
  font-size: .75em;
  color: rgba(0, 0, 0, 0.8);
  background: lightgray;
  border-radius: 5px 5px 0 0;
}
header .buttons {
  position: absolute;
  top: 6px;
  left: 22px;
  width: 8px;
  height: 8px;
  background: rgba(255, 153, 0, 0.5);
  border-radius: 50%;
  box-shadow: -12px 0 0 rgba(204, 0, 0, 0.6), 12px 0 0 rgba(0, 204, 0, 0.4);
}

.editor {
  position: relative;
  min-height: 100%;
  background: rgba(0, 0, 0, 0.2);
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  overflow: hidden;
}
.editor .code,
.editor .result,
.editor .settings {
  width: 50%;
  padding: 1rem;
}
.editor .code {
  resize: none;
  border: none;
  font-family: "Source Code Pro", monospace;
  back.........完整代码请登录后点击上方下载按钮下载查看

网友评论0