Implemented markdown preview
This commit is contained in:
parent
d5ab483e9d
commit
e4972b54d0
9 changed files with 957 additions and 183 deletions
18
tasks/preview-markdown.js
Normal file
18
tasks/preview-markdown.js
Normal file
|
@ -0,0 +1,18 @@
|
|||
"use strict"
|
||||
|
||||
import "dotenv/config"
|
||||
import open from "open"
|
||||
|
||||
if (process.argv.length < 3 || !process.argv[2].match(/\.md$/)) {
|
||||
console.info("Usage: node open-preview.js file")
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
const file = process.argv[2]
|
||||
const options = process.argv[3]
|
||||
|
||||
if (options === "use-proxy") {
|
||||
open(`${process.env.LOCALHOST_PROXY}/${file}`)
|
||||
} else {
|
||||
open(`http://localhost:${process.env.PORT ?? 8080}/${file}`)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue