diff --git a/config.toml b/config.toml
index e07d9c9..26fd552 100644
--- a/config.toml
+++ b/config.toml
@@ -16,8 +16,9 @@ paginate = 10
[params]
subtitle = "A Journal"
brand = "
Ipse Solus"
- highlightjs = "androidstudio"
- highlightjs_extra_languages = ["yaml", "xml-dtd"]
+ highlightjs = "tomorrow"
+ highlightjs_extra_languages = ["yaml"]
+ custom_js = ["js/math-code.js"]
dateFormat = "02 Jan 2006, 15:04"
[menu]
diff --git a/content/post/its-alive.md b/content/post/its-alive.md
index fcd7c6a..25f83fa 100644
--- a/content/post/its-alive.md
+++ b/content/post/its-alive.md
@@ -10,11 +10,11 @@ Here's a snippet of Go.
```go
func str2int(strnum string) int {
- i, err := strconv.Atoi(strnum)
- if err != nil {
- return 9999
- }
- return i
+ i, err := strconv.Atoi(strnum)
+ if err != nil {
+ return 9999
+ }
+ return i
}
```
diff --git a/content/post/nextcloud-caldav-error.md b/content/post/nextcloud-caldav-error.md
index f47b6ef..fe32392 100644
--- a/content/post/nextcloud-caldav-error.md
+++ b/content/post/nextcloud-caldav-error.md
@@ -10,7 +10,7 @@ Unfortunately, out of the box, it wasn't working. I tried all sorts of suggestio
Then, after a day of staring blankly at the problem, I suddenly realized what was wrong. There was a simple `regex` typo in the htaccess configuration that came from nextcloud. Let's see if you can see the difference. Here's what nextcloud gives you:
-```xml
+```apache
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} DavClnt
@@ -27,7 +27,7 @@ Then, after a day of staring blankly at the problem, I suddenly realized what wa
and here is what I ended up running successfully with:
-```xml
+```apache
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} DavClnt
@@ -45,4 +45,3 @@ and here is what I ended up running successfully with:
Can you see it? Hint: RewriteRules require leading forward-slashes to work. But REGEX rules require leading back-slashes to escape special characters in uris. So, I had to change this `^\.` to this `^/\.` and everything started working.
Hopefully, for those of you into self-hosting, this will save you the hours of pain and suffering it cost me.
-
diff --git a/static/js/math-code.js b/static/js/math-code.js
new file mode 100644
index 0000000..4616a27
--- /dev/null
+++ b/static/js/math-code.js
@@ -0,0 +1,20 @@
+(function() {
+ var i, text, code, codes = document.getElementsByTagName('code');
+ for (i = 0; i < codes.length;) {
+ code = codes[i];
+ if (code.parentNode.tagName !== 'PRE' && code.childElementCount === 0) {
+ text = code.textContent;
+ if (/^\$[^$]/.test(text) && /[^$]\$$/.test(text)) {
+ text = text.replace(/^\$/, '\\(').replace(/\$$/, '\\)');
+ code.textContent = text;
+ }
+ if (/^\\\((.|\s)+\\\)$/.test(text) || /^\\\[(.|\s)+\\\]$/.test(text) ||
+ /^\$(.|\s)+\$$/.test(text) ||
+ /^\\begin\{([^}]+)\}(.|\s)+\\end\{[^}]+\}$/.test(text)) {
+ code.outerHTML = code.innerHTML; // remove
+ continue;
+ }
+ }
+ i++;
+ }
+ })();
\ No newline at end of file