做一個簡單的markdown editor

做一個簡單的markdown editor

放入package.json後使用npm install

package.json

 {
      "name": "RealtimeMarkdownViewer",
      "description": "Realtime Markdown Viewer",
      "main": "server.js",
      "version": "1.0.0",
      "repository": {
        "type": "git",
        "url": "git@github.com:sifxtreme/realtime-markdown.git"
      },
      "keywords": [
        "markdown",
        "realtime",
        "sharejs"
      ],
      "author": "Asif Ahmed",
      "dependencies": {
        "express": "^4.12.4",
        "ejs": "^2.3.1",
        "redis": "^0.10.3",
        "share": "0.6.3"
      },
      "engines": {
        "node": "0.10.x",
        "npm": "1.3.x"
      }
    }

server.js

建造views資料夾,裡面存放模板

在views內創造pad.ejs

建造public資料夾在根目錄,即為我們的static folder

裡面放入style.css

public裡面放入script.js

此時輸入 node server 可看到兩個框框,在左邊那個框輸入markdown試試

讓他成為共筆的markdown

https://github.com/showdownjs https://www.npmjs.com/package/showdown

Last updated

Was this helpful?