Make a test site, start converting from markdown to html
parent
fb5aecc3c8
commit
3770f6a483
|
@ -1 +1,2 @@
|
|||
node_modules
|
||||
testsite/dist/**
|
|
@ -14,7 +14,7 @@ myblog
|
|||
|-> about.md
|
||||
|-> styles.css
|
||||
```
|
||||
And blogtool generates a static site in dist/ with a list of articles for the home page, an about page with a profile picture and bio from profile.jpg and about.md, each page will include styless.css and all assets will be available at /static
|
||||
with utf-8 encoded articles. Blogtool generates a static site in dist/ with a list of articles for the home page, an about page with a profile picture and bio from profile.jpg and about.md, each page will include styless.css and all assets will be available at /static.
|
||||
```
|
||||
dist
|
||||
|
|
||||
|
|
15
index.js
15
index.js
|
@ -1,12 +1,21 @@
|
|||
const showdown = require("showdown");
|
||||
const converter = new showdown.Converter();
|
||||
const nunjucks = require("nunjucks");
|
||||
const showdown = require("shohwdown");
|
||||
const fs = require("fs");
|
||||
|
||||
async function main (){
|
||||
nunjucks.configure({
|
||||
autoescape: true
|
||||
});
|
||||
//nunjucks.render()
|
||||
try{ fs.mkdirSync('dist'); }
|
||||
catch {}
|
||||
var articles = fs.readdirSync('articles');
|
||||
for(var i=0;i<articles.length;i++){
|
||||
var article = fs.readFileSync('articles/'+articles[i], {encoding: 'utf-8'});
|
||||
article = converter.makeHtml(article);
|
||||
fs.writeFileSync('dist/'+articles[i].substring(0, articles[i].length - 3)+'.html', article, {encoding: 'utf-8'});
|
||||
}
|
||||
//var test = fs.readFileSync("./test.md", {encoding: 'utf-8'});
|
||||
}
|
||||
|
||||
|
||||
module.exports.main = main;
|
|
@ -0,0 +1,2 @@
|
|||
###### this is my test page
|
||||
uwu
|
|
@ -0,0 +1,4 @@
|
|||
## yeet
|
||||
**this is** a *test*
|
||||
|
||||
[weeeooo](http://google.com)
|
Binary file not shown.
After Width: | Height: | Size: 55 KiB |
|
@ -0,0 +1,3 @@
|
|||
body {
|
||||
background: #fffff2;
|
||||
}
|
Loading…
Reference in New Issue