aboutsummaryrefslogtreecommitdiff
path: root/content/posts
diff options
context:
space:
mode:
Diffstat (limited to 'content/posts')
-rw-r--r--content/posts/2021-12-05-mathyd-easy-tex-to-svg.md24
1 files changed, 17 insertions, 7 deletions
diff --git a/content/posts/2021-12-05-mathyd-easy-tex-to-svg.md b/content/posts/2021-12-05-mathyd-easy-tex-to-svg.md
index 040be71..5e64743 100644
--- a/content/posts/2021-12-05-mathyd-easy-tex-to-svg.md
+++ b/content/posts/2021-12-05-mathyd-easy-tex-to-svg.md
@@ -49,7 +49,9 @@ docker run --rm -d -e MATHYD_HMAC_KEY="2dhXA3HTmfEMq2d5" -p 3000:3000 pablotron/
reusing the key from the examples above.
* Don't expose [Mathyd][] via a publicly-accessible [URL][]; it does
not support [TLS][] and [MathJax][] may use a lot of memory for large
- input files.
+ input files. If you really do want to do this, then you'll need to
+ proxy the [Mathyd][] endpoint behind [Apache][] or [nginx][] on an
+ authenticated, [TLS][]-encrypted [URL][].
### Technical Details
@@ -57,15 +59,18 @@ Under the hood, [Mathyd][] is just:
1. a [container][] running an [Express][] [HTTP][] daemon that exposes a
single endpoint that accepts a `PUT` request containing:
- * A [JSON][]-encoded body of input parameters
+ * A [JSON][]-encoded body of input parameters.
* A hex-encoded, [SHA-256 HMAC][hmac] of the body and the [HMAC][]
secret key in the `x-mathyd-hmac-sha256` header.
The endpoint does the following:
- 1. Verifies the body [HMAC][]
- 2. Converts the input [TeX][] to [SVG][] (via [MathJax][])
- 3. Returns a [JSON][] response containing the generated [SVG][]
+ 1. Verifies the body [HMAC][].
+ 2. Parses the [JSON][] body and extracts the input parameters,
+ including the source [TeX][].
+ 3. Converts the input [TeX][] to [SVG][] (via [MathJax][]).
+ 4. Returns a [JSON][]-encoded response containing the generated
+ [SVG][].
2. A command-line client, written in [Ruby][], which:
1. Reads [TeX][] from standard input and serializes it as [JSON][].
@@ -88,8 +93,9 @@ I prefer [SVGs][svg] over bitmap images whenever possible because:
* [SVGs][svg] scale to any screen size and resolution. This is
particularly useful for [responsive design][].
* [SVGs][svg] are supported by all modern browsers, including mobile
- browsers. (Fun fact: even the [animated logo for this page][logo] is
- an [SVG][]).
+ browsers.
+
+Fun fact: even the [animated logo for this page][logo] is an [SVG][].
### Links
@@ -135,3 +141,7 @@ check out [Mathy][] instead.
"Responsive web design."
[tls]: https://en.wikipedia.org/wiki/Transport_Layer_Security
"Transport Layer Security"
+[apache]: https://apache.org/
+ "Apache web server"
+[nginx]: https://www.nginx.com/
+ "nginx web server"