diff options
author | terminaldweller <thabogre@gmail.com> | 2021-04-11 08:10:09 +0000 |
---|---|---|
committer | terminaldweller <thabogre@gmail.com> | 2021-04-11 08:10:09 +0000 |
commit | 64347c601fcb30904857e3ffc3b4d54a617b6441 (patch) | |
tree | 42e338c15dde925174e4313c623bdb2edaa67941 | |
parent | added a dockerfile. fixed the relative path issues (diff) | |
download | blog-64347c601fcb30904857e3ffc3b4d54a617b6441.tar.gz blog-64347c601fcb30904857e3ffc3b4d54a617b6441.zip |
everything seems to be working now
-rw-r--r-- | css/devibeans.css | 88 | ||||
-rw-r--r-- | css/master.css | 30 | ||||
-rwxr-xr-x | server.js | 30 | ||||
-rw-r--r-- | views/index.ejs | 9 |
4 files changed, 140 insertions, 17 deletions
diff --git a/css/devibeans.css b/css/devibeans.css new file mode 100644 index 0000000..cd78393 --- /dev/null +++ b/css/devibeans.css @@ -0,0 +1,88 @@ +/* + devibeans (dark) + Created by Farzad Sadeghi (http://github.com/terminaldweller) + Inspired by vim's jellybeans theme (https://github.com/nanotech/jellybeans.vim) +*/ + +.hljs-comment, +.hljs-quote { + color: #339966; +} + +.hljs-params { + color: #a39e9b; +} + +.hljs-regexp { + color: #d700ff; +} + +/* Red */ +.hljs-tag, +.hljs-selector-id, +.hljs-number, +.hljs-literal { + color: #ef5350; +} + +.hljs.meta { + color: #0087ff; +} + +.hljs-operator { + color: #005faf; +} + +/* devibeans blue */ +.hljs-selector-class, +.hljs-variable, +.hljs-template-variable, +.hljs-link, +.hljs-keyword { + color: #64b5f6; +} + +/* Paraíso Orange */ +.hljs-built_in, +.hljs-title, +.hljs-deletion { + color: #ff8700; +} + +/* Paraíso Yellow */ +.hljs-type, +.hljs-section, +.hljs-function, +.hljs-name, +.hljs-attribute { + color: #ffd75f; +} + +/* Paraíso Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet, +.hljs-addition { + color: #558b2f; +} + +/* Paraíso Purple */ +.hljs-selector-tag { + color: #9966ff; +} + +.hljs { + display: block; + overflow-x: auto; + background: #000000; + color: #a39e9b; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/css/master.css b/css/master.css index e1ebd90..0f819e3 100644 --- a/css/master.css +++ b/css/master.css @@ -1,30 +1,42 @@ -@import "parasiso-dark.css"; +@import "devibeans.css"; -body{$ +body { + color: #005f87; + background: #000000; + font-family: "DejaVuSansMono NF", Helvetica, monospace; +} + +.article{$ text-align: left; padding: 2%; border-style: solid; position: relative; - /* left: 0; */ - /* right: 50%; */ white-space: -moz-pre-wrap !important; color: #005f87; background: #000000; font-family: "DejaVuSansMono NF", Helvetica, monospace; overflow-wrap: break-word; + float: left; + width: 78%; } .sidenav { + padding: 2%; color: #005f87; height: 100%; - width: 10%; border-style: solid; - position: fixed; - z-index: 0; + position: relative; + /* z-index: 0; */ top: 0; right: 0; background-color: #000000; overflow-x: hidden; - padding-top: 1%; - text-align: center; + text-align: left; + float: right; + width: 13%; +} + +a { + color: #005f87; + text-decoration: none; } @@ -20,18 +20,16 @@ const mit = require("markdown-it")({ html: true }) }); const app = express(); -app.use(express.static(__dirname)); app.use(express.static(path.join(__dirname, "css"))); app.set("views", path.join(__dirname, "views")); app.set("view engine", "ejs"); app.engine("ejs", require("ejs").__express); -app.get("/", (req, res) => { +app.get("/$", (req, res) => { let readStream = fs.createReadStream( - path.join(__dirname, "mds/cstruct2luatable.md"), + path.join(__dirname, "mds", "cstruct2luatable.md"), "utf-8" ); - // FIXME-this is gonna be so wrong when the md is bigger than one chunk readStream.on("data", (chunk) => { res.render("index", { data: { @@ -42,4 +40,26 @@ app.get("/", (req, res) => { }); }); -app.listen(3000); +app.get("/mds/:mdname$", (req, res) => { + if (req.params["mdname"] == "") { + res.write("nothing requested!"); + } + try { + let readStream = fs.createReadStream( + path.join(__dirname, req.path), + "utf-8" + ); + readStream.on("data", (chunk) => { + res.render("index", { + data: { + blogHttp: mit.render(chunk), + mds: fs.readdirSync(path.join(__dirname, "mds"), "utf-8"), + }, + }); + }); + } catch (err) { + console.log(err); + } +}); + +app.listen(9000); diff --git a/views/index.ejs b/views/index.ejs index 69e8a9d..8c2fe43 100644 --- a/views/index.ejs +++ b/views/index.ejs @@ -4,16 +4,19 @@ <meta charset="utf-8"> <meta name="viewport" content="width=device-width"> <title>Blog</title> - <link rel="stylesheet" href="/css/master.css" type="text/css" media="screen" title="no title" charset="utf-8"> + <link rel="stylesheet" href="/master.css" type="text/css" media="screen" title="no title" charset="utf-8"> </head> <body> <script>0</script> <div class="sidenav"> <% data.mds.forEach(function(md) { %> - <h2><%= md %></h2> - <a href="#" target="_blank"><%= md %></a> + <ul> + <li><a href=<%= "/mds/"+md %> target="_self" rel="noreferrer noopener" type="text/html"><%= md %></a></li> + </ul> <% }) %> </div> + <div class="article"> <%- data.blogHttp %> + </div> </body> </html> |