Make a test site, start converting from markdown to html

master
knotteye 2020-12-22 11:14:44 -06:00
parent fb5aecc3c8
commit 3770f6a483
8 changed files with 23 additions and 4 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
node_modules
testsite/dist/**

View File

@ -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
|

View File

@ -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
templates Normal file
View File

2
testsite/about.md Normal file
View File

@ -0,0 +1,2 @@
###### this is my test page
uwu

View File

@ -0,0 +1,4 @@
## yeet
**this is** a *test*
[weeeooo](http://google.com)

BIN
testsite/profile.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

3
testsite/styles.css Normal file
View File

@ -0,0 +1,3 @@
body {
background: #fffff2;
}