Added ability to add LaTeX
This commit is contained in:
parent
4fa1ffe3cb
commit
3e19940e71
|
@ -91,6 +91,19 @@
|
||||||
(md4tj-begin-tag "p" (list (list "id" "lastupdated")))
|
(md4tj-begin-tag "p" (list (list "id" "lastupdated")))
|
||||||
"Last updated: " (current-time-string)
|
"Last updated: " (current-time-string)
|
||||||
(md4tj-end-tag "p")))
|
(md4tj-end-tag "p")))
|
||||||
|
((and (string-match "^$$.*$$" line) (eq (nth 1 state) 'normal)) ;; LaTeX formula
|
||||||
|
(shell-command (concat "./pnglatex"
|
||||||
|
" -d 300"
|
||||||
|
" -f "
|
||||||
|
"\""
|
||||||
|
(string-replace "$$" "" line)
|
||||||
|
"\""
|
||||||
|
" -o "
|
||||||
|
"./teximg/"
|
||||||
|
(md5 (string-replace "$$" "" line)) ".png"))
|
||||||
|
(md4tj-begin-tag "img" (list (list "class" "teximg") ;; give teximgs their own class
|
||||||
|
(list "src" (concat "./teximg/" (md5 (string-replace "$$" "" line)) ".png"))
|
||||||
|
(list "alt" (string-replace "$$" "" line)))))
|
||||||
;; If this is some other signal, ignore
|
;; If this is some other signal, ignore
|
||||||
((string-match "^@@" line) "")
|
((string-match "^@@" line) "")
|
||||||
;; Otherwise, process as normal
|
;; Otherwise, process as normal
|
||||||
|
@ -146,7 +159,9 @@
|
||||||
(t 'normal))))
|
(t 'normal))))
|
||||||
|
|
||||||
(defun md4tj-begin ()
|
(defun md4tj-begin ()
|
||||||
"Insert beginning code for all html."
|
"Insert beginning code for all html, initialize."
|
||||||
|
(shell-command "mkdir -p ./teximg") ;; Ensure ./teximg folder exists
|
||||||
|
(shell-command "rm ./teximg/*") ;; Clear everything from the folder
|
||||||
(concat "<!DOCTYPE html>\n"
|
(concat "<!DOCTYPE html>\n"
|
||||||
(md4tj-begin-tag "html"
|
(md4tj-begin-tag "html"
|
||||||
(list (list "lang"
|
(list (list "lang"
|
||||||
|
|
|
@ -9,3 +9,11 @@ video {
|
||||||
outline: dashed 1px black;
|
outline: dashed 1px black;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.teximg {
|
||||||
|
display: block;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
width: 5%;
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
|
|
@ -70,6 +70,7 @@ int main() {
|
||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
<p><a href="https://crawl.develz.org">Dungeon Crawl Stone Soup</a> - My favorite FOSS roguelike (Yes, I know the greatest roguelike of all time is NetHack, I don't care).</p>
|
<p><a href="https://crawl.develz.org">Dungeon Crawl Stone Soup</a> - My favorite FOSS roguelike (Yes, I know the greatest roguelike of all time is NetHack, I don't care).</p>
|
||||||
<p id="lastupdated">Last updated: Wed Jan 4 13:40:47 2023</p>
|
<img class="teximg" src="./teximg/05e525335903ae89ce2a72ebe2582879.png" alt="e^{i \pi} + 1 = 0">
|
||||||
|
<p id="lastupdated">Last updated: Wed Jan 4 14:56:23 2023</p>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
|
@ -25,4 +25,5 @@ int main() {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
[Dungeon Crawl Stone Soup](https://crawl.develz.org) - My favorite FOSS roguelike (Yes, I know the greatest roguelike of all time is NetHack, I don't care).
|
[Dungeon Crawl Stone Soup](https://crawl.develz.org) - My favorite FOSS roguelike (Yes, I know the greatest roguelike of all time is NetHack, I don't care).
|
||||||
|
$$e^{i \pi} + 1 = 0$$
|
||||||
@@LASTUPDATED
|
@@LASTUPDATED
|
Loading…
Reference in New Issue