This commit is contained in:
Ole Eskild Steensen 2022-03-15 22:23:18 +01:00
commit 8049a354cd
8 changed files with 69 additions and 30 deletions

View File

@ -82,6 +82,10 @@ module.exports = function(eleventyConfig) {
eleventyConfig.addTransform('link', function(str) {
return str && str.replace(/\[\[(.*?)\]\]/g, function(match, p1) {
//Check if it is an embedded excalidraw drawing or mathjax javascript
if (p1.indexOf(",") > -1) {
return match;
}
const [fileName, linkTitle] = p1.split("|");
let permalink = `/notes/${slugify(fileName)}`;

2
.env Normal file
View File

@ -0,0 +1,2 @@
THEME=https://raw.githubusercontent.com/colineckert/obsidian-things/main/obsidian.css
BASE_THEME=light

1
.gitignore vendored
View File

@ -1,3 +1,2 @@
node_modules
dist
**/.env*

41
package-lock.json generated
View File

@ -12,6 +12,7 @@
"@azure/storage-blob": "^12.8.0",
"@octokit/core": "^3.5.1",
"@sindresorhus/slugify": "^1.1.0",
"axios": "^0.26.1",
"dotenv": "^10.0.0",
"gray-matter": "^4.0.3",
"markdown-it": "^12.3.2",
@ -603,12 +604,11 @@
"integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k="
},
"node_modules/axios": {
"version": "0.21.4",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz",
"integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==",
"dev": true,
"version": "0.26.1",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz",
"integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==",
"dependencies": {
"follow-redirects": "^1.14.0"
"follow-redirects": "^1.14.8"
}
},
"node_modules/babel-walk": {
@ -1583,7 +1583,6 @@
"version": "1.14.9",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.9.tgz",
"integrity": "sha512-MQDfihBQYMcyy5dhRDJUHcw7lb2Pv/TuE6xP1vyraLukNDHKbDxDNaOE3NbCAdKQApno+GPRyo1YAp89yCjK4w==",
"dev": true,
"funding": [
{
"type": "individual",
@ -2467,6 +2466,15 @@
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
}
},
"node_modules/localtunnel/node_modules/axios": {
"version": "0.21.4",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz",
"integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==",
"dev": true,
"dependencies": {
"follow-redirects": "^1.14.0"
}
},
"node_modules/localtunnel/node_modules/cliui": {
"version": "7.0.4",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz",
@ -5329,12 +5337,11 @@
"integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k="
},
"axios": {
"version": "0.21.4",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz",
"integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==",
"dev": true,
"version": "0.26.1",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz",
"integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==",
"requires": {
"follow-redirects": "^1.14.0"
"follow-redirects": "^1.14.8"
}
},
"babel-walk": {
@ -6130,8 +6137,7 @@
"follow-redirects": {
"version": "1.14.9",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.9.tgz",
"integrity": "sha512-MQDfihBQYMcyy5dhRDJUHcw7lb2Pv/TuE6xP1vyraLukNDHKbDxDNaOE3NbCAdKQApno+GPRyo1YAp89yCjK4w==",
"dev": true
"integrity": "sha512-MQDfihBQYMcyy5dhRDJUHcw7lb2Pv/TuE6xP1vyraLukNDHKbDxDNaOE3NbCAdKQApno+GPRyo1YAp89yCjK4w=="
},
"form-data": {
"version": "4.0.0",
@ -6775,6 +6781,15 @@
"color-convert": "^2.0.1"
}
},
"axios": {
"version": "0.21.4",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz",
"integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==",
"dev": true,
"requires": {
"follow-redirects": "^1.14.0"
}
},
"cliui": {
"version": "7.0.4",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz",

View File

@ -24,6 +24,7 @@
"@azure/storage-blob": "^12.8.0",
"@octokit/core": "^3.5.1",
"@sindresorhus/slugify": "^1.1.0",
"axios": "^0.26.1",
"dotenv": "^10.0.0",
"gray-matter": "^4.0.3",
"markdown-it": "^12.3.2",

View File

@ -1,13 +1,18 @@
require("dotenv").config();
let themeStyle = "";
if (process.env.THEME) {
fetch(process.env.THEME).then(response => response.text()).then(text => {
themeStyle = "<style>" + text + "</style>";
});
}
module.exports = {
env: process.env.ELEVENTY_ENV,
theme: process.env.THEME,
themeStyle: themeStyle,
baseTheme: process.env.BASE_THEME || "dark"
};
const axios = require("axios");
module.exports = async() => {
let themeStyle = "";
if (process.env.THEME) {
const res = await axios.get(process.env.THEME)
themeStyle = `<style>${res.data}</style>`;
}
return {
env: process.env.ELEVENTY_ENV,
theme: process.env.THEME,
themeStyle: themeStyle,
baseTheme: process.env.BASE_THEME || "dark"
}
};

View File

@ -10,11 +10,18 @@
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.25.0/themes/prism-okaidia.min.css" integrity="sha512-mIs9kKbaw6JZFfSuo+MovjU+Ntggfoj8RwAmJbVXQ5mkAX5LlgETQEweFPI18humSPHymTb5iikEOKWF7I8ncQ==" crossorigin="anonymous" referrerpolicy="no-referrer"/>
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
<script>
MathJax = {
tex: {
inlineMath: [["$", "$"]]
}
};
</script>
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js"></script>
<link href="/styles/style.css" rel="stylesheet">
{%-if meta.themeStyle%}
{{meta.themeStyle}}
{{meta.themeStyle | safe}}
{%endif%}
<link href="/styles/custom-style.css" rel="stylesheet">

View File

@ -41,12 +41,18 @@ h4 {
text-align: center;
}
body {
background-color: rgb(32, 31, 31);
.theme-dark {
background: rgb(32, 31, 31);
color: white;
font-family: 'Roboto', sans-serif;
}
.theme-light {
background: white;
color: black;
font-family: 'Roboto', sans-serif;
}
a {
text-decoration: underline;
color: rgb(97, 186, 245);