Add pug and html renderer. Implement hidden flag.
This commit is contained in:
parent
aa563e60ea
commit
3684688cdc
16 changed files with 119 additions and 33 deletions
19
src/renderer/html.ts
Normal file
19
src/renderer/html.ts
Normal file
|
@ -0,0 +1,19 @@
|
|||
import Renderer , {File} from "../renderer.js"
|
||||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
import matter from 'gray-matter'
|
||||
|
||||
export default class Html implements Renderer {
|
||||
name = "html"
|
||||
fileExtensions = ["htm", "html"]
|
||||
|
||||
loadAsHTML(filePath: string): File {
|
||||
const fileContents = fs.readFileSync(path.join("./", filePath), 'utf8')
|
||||
const { data: metadata, content: htmlContent } = matter(fileContents)
|
||||
|
||||
return {
|
||||
data: metadata,
|
||||
html: htmlContent
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue