diff --git a/README.md b/README.md index 1a26da7..0ebda94 100644 --- a/README.md +++ b/README.md @@ -5,25 +5,20 @@ Hugo-Tufte is a minimalist blog-like theme for the [static site generator Hugo](https://gohugo.io) that attempts to be a faithful implementation of the [Tufte-css](https://github.com/edwardtufte/tufte-css) project. -It supports mathematical typesetting via [MathJax](https://www.mathjax.org). +It supports mathematical typesetting via [katex](https://katex.org/). By utilizing copious partial templates the theme is largely customizable. ## State of Project -This theme is largely unmaintained. If there is a particular fork -that should be considered the primary project please submit a PR -updating the README, thanks! +This is a fork of the original [hugo-tufte](https://github.com/shawnohare/hugo-tufte); ## Math -Mathjax renders LaTeX written inside of markdown files. LaTeX can be -written more or less as normal, but inline and display environments that -start with `\` must be escaped. Some examples: +[katex](https://katex.org/) renders LaTeX written inside of markdown files. LaTeX can be +written more or less as normal. Some examples: -- `This $\LaTeX$ will be rendered inline.` -- `This \\(\LaTeX\\) will be rendered inline.` -- `A simple displayed equation: $$f(x, y) := e^{x^2 - y^2}.$$` -- `A simple displayed equation: \\[f(x, y) := e^{x^2 - y^2}.\\]` +- This `\\( \frac{1}{2} \\)` will be rendered inline. +- A simple displayed equation: `$$f(x, y) := e^{x^2 - y^2}.$$` There currently seems to be some weirdness with other environments, such as the `align` environment. These environments will render provided @@ -78,9 +73,9 @@ support all the features present in the - **Usage**: Accepts the named parameters `cite` and `footer`. - **Example**: ```html - {{% blockquote cite="www.shawnohare.com" footer="Shawn" %}} + {{< blockquote cite="www.shawnohare.com" footer="Shawn" >}} There is nothing more beautiful than an elegant mathematical proof. - {{% /blockquote %}}` + {{< /blockquote >}} ``` - `div` @@ -103,17 +98,20 @@ support all the features present in the styled epigraph will be used if the `type` parameter is set to `compact`. - **Example**: ``` - {{% epigraph pre="Author Writer, " cite="Math is Fun" %}} + {{< epigraph pre="Author Writer, " cite="Math is Fun" >}} This is an example of an epigraph with some math \\( \mathbb N \subseteq \mathbb R \\) to start the beginning of a section. - {{% /epigraph %}} + {{< /epigraph >}} ``` - `marginnote` - **Description**: Wrap text to produce a numberless margin note. - - Usage: `{{% marginnote %}}...{{% /marginnote %}}` - - **Example**: `{{% marginnote %}}Some marginnote{{% /marginnote%}}` + - Usage: `{{< marginnote >}}...{{< /marginnote >}}` + - **Example**: + ```html + {{< marginnote >}}Some marginnote{{< /marginnote>}} + ``` - `section` - **Description**: This shortcode is provided as a work-around for wrapping @@ -130,11 +128,14 @@ support all the features present in the - `sidenote` - **Description**: Wrap text to produce an automatically numbered sidenote. - **Usage**: identical to `marginnote` - `{{% sidenote %}}...{{% /sidenote %}}` - - **Example**: `{{% sidenote %}}Some sidenote{{% /sidenote %}}` + `{{< sidenote >}}...{{< /sidenote >}}` + - **Example**: + ```html + {{< sidenote >}}Some sidenote{{< /sidenote >}} + ``` -## Templates -TODO -- [ ] Describe the role of each template file, as commenting within the files - themselves seems to break the templates. + +#### TODO +- [ ] Describe the role of each template file. Commenting in template files works. +- [ ] Fix the F**ing css diff --git a/archetypes/post.md b/archetypes/post.md index 2454f9f..6ffe550 100644 --- a/archetypes/post.md +++ b/archetypes/post.md @@ -3,7 +3,7 @@ math = false meta = true toc = true author = "AUTHOR NAME" - +type = "post" +++ diff --git a/exampleSite/config.toml b/exampleSite/config.toml index a1be4a1..d166384 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -1,9 +1,7 @@ -contentdir = "content" -layoutdir = "layouts" -publishdir = "public" -builddrafts = true +themesDir = "../../" + canonifyurls = true -baseurl = "https://github.com/shawnohare/hugo-tufte" +# baseurl = "https://github.com/shawnohare/hugo-tufte" theme = "hugo-tufte" title = "Hugo-tufte Theme Example Site" @@ -14,9 +12,11 @@ title = "Hugo-tufte Theme Example Site" tag = "tags" [params] + math = true subtitle = "Subtitle goes here." copyrightHolder = "Copyright Holder" showPoweredBy = true + hidedate = false # ----------------------------------------------------------------------- # Navigation menu @@ -55,3 +55,9 @@ title = "Hugo-tufte Theme Example Site" weight = -90 identifier = "twitter" url = "https://twitter.com" + + + +[markup] + [markup.goldmark] + unsafe = false \ No newline at end of file diff --git a/layouts/partials/opengraph.html b/exampleSite/content/_index.md similarity index 100% rename from layouts/partials/opengraph.html rename to exampleSite/content/_index.md diff --git a/exampleSite/content/post/tufte-features.md b/exampleSite/content/post/tufte-features.md index c467e2d..672bc6d 100644 --- a/exampleSite/content/post/tufte-features.md +++ b/exampleSite/content/post/tufte-features.md @@ -6,7 +6,7 @@ math = true title = "Hugo-Tufte Features" subtitle = "Fancy Subtitle" toc = true -categories = ["mathjax", "latex", "tufte-css"] +categories = ["katex", "latex", "tufte-css"] +++ @@ -16,23 +16,24 @@ of this theme. One of them is \\( \LaTeX \\) via MathJax. {{< section "begin" >}} ## A Bit About Mathematics -{{% epigraph pre="Shawn O'Hare, " cite="Math is Fun" %}} +{{< epigraph pre="Shawn O'Hare, " cite="Math is Fun" >}} This is an example of an epigraph with some math \\(\mathbb N \subseteq \mathbb R \\) to start the beginning of a section. -{{% /epigraph %}} +{{< /epigraph >}} ### Inline Some inline math: -{{% marginnote "mn-example" %}}This is a margin note.{{% /marginnote %}} -$e^{i \pi} = -1$ and \\(\sqrt{-1} = i \\) +{{< marginnote "mn-example" >}}This is a margin note.{{< /marginnote >}} +\\(e^{i \pi} = -1\\) + and \\(\sqrt{-1} = i \\) and \\( a_2 = 3 \\). ### Display And display math using escaped brackets `\\[`: -{{% sidenote "sn-example" %}}This is a sidenote!{{% /sidenote %}} +{{< sidenote "sn-example" >}}This is a sidenote!{{< /sidenote >}} \\[ -- \cdot_H -- \colon B(G,H) \times B(H, K) \to B(G, K), \quad ([X], [Y]) \mapsto [X \times_H Y]. \\] @@ -73,7 +74,7 @@ is produced from Some blockquotes. But first, we try to manually cite via This is between cite tags and has math: \\(e^x \\) -{{% blockquote cite="www.shawnohare.com" footer="Shawn O'Hare" %}} +{{< blockquote cite="www.shawnohare.com" footer="Shawn O'Hare" >}} This is a blockquote with two paragraphs, that employs the theme's `blockquote` shortcode. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. @@ -82,7 +83,7 @@ Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. -{{% /blockquote %}} +{{< /blockquote >}} ### New thoughts diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html new file mode 100644 index 0000000..e5e69a3 --- /dev/null +++ b/layouts/_default/baseof.html @@ -0,0 +1,13 @@ + + + {{- partial "header.html" . -}} + + + {{ block "main" . }}{{ end }} + + + + + \ No newline at end of file diff --git a/layouts/_default/home.html b/layouts/_default/home.html new file mode 100644 index 0000000..a52757e --- /dev/null +++ b/layouts/_default/home.html @@ -0,0 +1,23 @@ + + +{{ define "main" }} + + + +
+
+ {{ partial "brand.html" . }} + {{ range first 5 .Site.Pages }} + {{ partial "content.header.html" . }} +

{{ .Summary }}

+ {{ if .Truncated }} +

Read On →

+ {{ end }} + {{ end }} + {{ partial "footer.html" . }} +
+
+ +{{ end }} \ No newline at end of file diff --git a/layouts/_default/list.html b/layouts/_default/list.html index e1625b7..a535b82 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -1,5 +1,6 @@ -{{ partial "header.html" . }} + +{{ partial "header.html" . }}
diff --git a/layouts/_default/single.html b/layouts/_default/single.html index faa1bd8..fda5daa 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -1,3 +1,11 @@ +{{/* + + This template render single pages + +*/}} + + + {{ partial "header.html" . }} diff --git a/layouts/index.html b/layouts/index.html index 496e3c8..1bded08 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -1,17 +1,25 @@ -{{ partial "header.html" . }} - +{{ define "main" }}
-
-{{ partial "brand.html" . }} -{{ range first 5 .Site.Pages }} - {{ partial "content.header.html" . }} -

{{ .Summary }}

- {{ if .Truncated }} -

Read On →

- {{ end }} -{{ end }} -{{ partial "footer.html" . }} -
+
+ {{ partial "brand.html" . }} + {{ range where .Site.RegularPages "Type" "post"}} + +

+ {{ if .IsNode }} + {{ .Title}} + {{ else }} + {{ .Title }}{{ if .Draft }} :: Draft {{end}} + {{ end }} +

+ + +

{{ truncate 120 .Summary }}

+ {{/* {{ if .Truncated }} */}} +

Read On →

+ {{/* {{ end }} */}} + + {{ end }} + {{ partial "footer.html" . }} +
- - +{{ end }} \ No newline at end of file diff --git a/layouts/partials/content.header.html b/layouts/partials/content.header.html index 53fadb1..d47e048 100644 --- a/layouts/partials/content.header.html +++ b/layouts/partials/content.header.html @@ -1,39 +1,42 @@
-

- {{ if .IsNode }} - {{ .Title}} - {{ else }} - {{ .Title }}{{ if .Draft }} :: Draft {{end}} + +

+ {{ if .IsNode }} + {{ .Title}} + {{ else }} + {{ .Title }}{{ if .Draft }} :: Draft {{end}} + {{ end }} +

+ {{ if .IsPage }} + {{ if .Params.subtitle }} +

{{ .Params.subtitle }}

+ {{ end }} + {{ if or (eq .Type "post") (.Params.meta) }} + + {{ end }} {{ end }} - -{{ if .IsPage }} -{{ if .Params.subtitle }}

{{ .Params.subtitle }}

{{ end }} -{{ if or (eq .Type "post") (.Params.meta) }} - -{{ end }} -{{ end }} -
+ \ No newline at end of file diff --git a/layouts/partials/doctype.html b/layouts/partials/doctype.html deleted file mode 100644 index 6cab5bb..0000000 --- a/layouts/partials/doctype.html +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/layouts/partials/header.html b/layouts/partials/header.html index bc494d1..981da4b 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -1,7 +1,10 @@ -{{ partial "doctype.html" . }} {{ .Site.Title }} - {{ .Title }} - {{ partial "meta.html" . }} - {{ partial "opengraph.html" }} + + + + + {{ partial "header.includes.html" . }} diff --git a/layouts/partials/header.includes.html b/layouts/partials/header.includes.html index 0e6e8af..ab774f7 100644 --- a/layouts/partials/header.includes.html +++ b/layouts/partials/header.includes.html @@ -1,6 +1,6 @@ - + {{ if or .Params.math .IsHome }} - {{ partial "math.html" . }} + {{ partial "math.html" . }} {{ end }} @@ -23,6 +23,7 @@ + diff --git a/layouts/partials/math.html b/layouts/partials/math.html index 37f1595..caee35d 100644 --- a/layouts/partials/math.html +++ b/layouts/partials/math.html @@ -1,18 +1,4 @@ - + + + - diff --git a/layouts/partials/meta.html b/layouts/partials/meta.html deleted file mode 100644 index 0c1120f..0000000 --- a/layouts/partials/meta.html +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - -{{ hugo.Generator }} diff --git a/layouts/partials/subheader.html b/layouts/partials/subheader.html deleted file mode 100644 index e69de29..0000000 diff --git a/layouts/shortcodes/marginnote.html b/layouts/shortcodes/marginnote.html index 9de6d7b..57cc43e 100644 --- a/layouts/shortcodes/marginnote.html +++ b/layouts/shortcodes/marginnote.html @@ -1,3 +1,6 @@ -{{ $marginnoteDomIdSuffix := .Ordinal }} - -{{ .Inner }} +{{ $marginnoteDomIdSuffix := .Ordinal }} + + +{{ .Inner }} \ No newline at end of file diff --git a/static/js/main.js b/static/js/main.js new file mode 100644 index 0000000..4b7a7af --- /dev/null +++ b/static/js/main.js @@ -0,0 +1,14 @@ + \ No newline at end of file