Make a test site, start converting from markdown to html

master
knotteye 3 years ago
parent fb5aecc3c8
commit 3770f6a483
  1. 1
      .gitignore
  2. 2
      README.md
  3. 15
      index.js
  4. 0
      templates
  5. 2
      testsite/about.md
  6. 4
      testsite/articles/test.md
  7. BIN
      testsite/profile.jpg
  8. 3
      testsite/styles.css

1
.gitignore vendored

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

@ -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…
Cancel
Save