From cc86136bcb4cc61219a8ee7573e792e6a6043dcd Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Sat, 2 Apr 2022 17:00:14 -0700 Subject: [PATCH] feat: basic latex support --- assets/styles/base.scss | 4 +-- content/_index.md | 16 +++++----- content/notes/CJK + Latex Test (ζ΅‹θ―•).md | 38 ++++++++++++++++++++++++ content/notes/Obsidian.md | 3 +- content/notes/obsidian.md | 3 +- content/notes/troubleshooting.md | 28 +---------------- data/config.yaml | 9 +++--- layouts/partials/head.html | 1 + layouts/partials/katex.html | 21 +++++++++++++ 9 files changed, 79 insertions(+), 44 deletions(-) create mode 100644 content/notes/CJK + Latex Test (ζ΅‹θ―•).md create mode 100644 layouts/partials/katex.html diff --git a/assets/styles/base.scss b/assets/styles/base.scss index 2eb2515..aa172d0 100644 --- a/assets/styles/base.scss +++ b/assets/styles/base.scss @@ -534,6 +534,6 @@ header { } li a { - padding: 5px 20px; + padding: 0 1em; } -} \ No newline at end of file +} diff --git a/content/_index.md b/content/_index.md index 62fbb6b..71f9b13 100644 --- a/content/_index.md +++ b/content/_index.md @@ -1,14 +1,16 @@ --- -title: πŸͺ΄ Quartz 3.1 +title: πŸͺ΄ Quartz 3.2 --- -Host your second brain and [digital garden](https://jzhao.xyz/posts/digital-gardening) for free. Quartz features +Host your second brain and [digital garden](https://jzhao.xyz/posts/networked-thought) for free. Quartz features + 1. Extremely fast full-text search by pressing `ctrl` + `k` 2. Wikilink support 3. Display for backlinks of each note -4. Fully customizable local graph view -5. Endlessly powerful page and theme customization using CSS -6. Automatically generated tag and section lists of content -7. Beautiful link previews +4. [CJK + Latex Support](notes/CJK%20+%20Latex%20Test%20(ζ΅‹θ―•).md) +5. Fully customizable local graph view +6. Endlessly powerful page and theme customization using CSS +7. Automatically generated tag and section lists of content +8. Beautiful link previews ## Get Started > πŸ“š [Setup your own digital garden using Quartz](notes/setup.md) @@ -19,7 +21,7 @@ Not convinced yet? Look at some [community digital gardens](notes/showcase.md) b If you prefer browsing the contents of this site through a list instead of a graph, you can find content lists here too: - [All Notes](/notes) -- [Setup-related Notes](/tags/set) +- [Setup-related Notes](/tags/setup) ## Troubleshooting - 🚧 [Troubleshooting and FAQ](notes/troubleshooting.md) diff --git a/content/notes/CJK + Latex Test (ζ΅‹θ―•).md b/content/notes/CJK + Latex Test (ζ΅‹θ―•).md new file mode 100644 index 0000000..fce6d91 --- /dev/null +++ b/content/notes/CJK + Latex Test (ζ΅‹θ―•).md @@ -0,0 +1,38 @@ +--- +title: "CJK + Latex Test (ζ΅‹θ―•)" +--- + +## Chinese, Japanese, Korean Support +ε‡ δΉŽεœ¨ζˆ‘δ»¬ζ„θ―†εˆ°δΉ‹ε‰οΌŒζˆ‘δ»¬ε·²η»η¦»εΌ€δΊ†εœ°ι’γ€‚ + +μš°λ¦¬κ°€ 그것을 μ•ŒκΈ°λ„ 전에 μš°λ¦¬λŠ” 땅을 λ– λ‚¬μŠ΅λ‹ˆλ‹€. + +η§γŸγ‘γŒγγ‚Œγ‚’ηŸ₯γ‚‹γ»γΌε‰γ«γ€η§γŸγ‘γ―εœ°ι’γ‚’ι›’γ‚Œγ¦γ„γΎγ—γŸγ€‚ + +## Latex + +Block math works with two dollar signs `$$...$$` + +$$f(x) = \int_{-\infty}^\infty + f\hat(\xi\),e^{2 \pi i \xi x} + \,d\xi$$ + +Inline math also works with single dollar signs `$...$`. For example, Euler's identity but inline: $e^{i\pi} = 0$ + +Aligned equations work quite well: + +$$ +\begin{aligned} +a &= b + c \\ + &= e + f \\ +\end{aligned} +$$ + +And matrices + +$$ +\begin{bmatrix} +1 & 2 & 3\\ +a & b & c +\end{bmatrix} +$$ \ No newline at end of file diff --git a/content/notes/Obsidian.md b/content/notes/Obsidian.md index e2d2cf9..c6dab06 100644 --- a/content/notes/Obsidian.md +++ b/content/notes/Obsidian.md @@ -16,9 +16,8 @@ The easiest way to use an existing Vault is to copy all of your files (directory ## Settings Great, now that you have your Obsidian linked to your Quartz, let's fix some settings so that they play well. -1. Under Options > Files and Links, set the New link format to always be Absolute Path in Vault and disabled WikiLinks so Obsidian generates regular Markdown links. +1. Under Options > Files and Links, set the New link format to always be Absolute Path in Vault. 2. Go to Settings > Files & Links > Turn "on" automatically update internal links. -3. Use [[Wikilinks]] should be off (Wikilinks are not officially supported yet) ![Obsidian Settings](/notes/images/obsidian-settings.png)*Obsidian Settings* diff --git a/content/notes/obsidian.md b/content/notes/obsidian.md index e2d2cf9..c6dab06 100644 --- a/content/notes/obsidian.md +++ b/content/notes/obsidian.md @@ -16,9 +16,8 @@ The easiest way to use an existing Vault is to copy all of your files (directory ## Settings Great, now that you have your Obsidian linked to your Quartz, let's fix some settings so that they play well. -1. Under Options > Files and Links, set the New link format to always be Absolute Path in Vault and disabled WikiLinks so Obsidian generates regular Markdown links. +1. Under Options > Files and Links, set the New link format to always be Absolute Path in Vault. 2. Go to Settings > Files & Links > Turn "on" automatically update internal links. -3. Use [[Wikilinks]] should be off (Wikilinks are not officially supported yet) ![Obsidian Settings](/notes/images/obsidian-settings.png)*Obsidian Settings* diff --git a/content/notes/troubleshooting.md b/content/notes/troubleshooting.md index d61cee7..765d582 100644 --- a/content/notes/troubleshooting.md +++ b/content/notes/troubleshooting.md @@ -7,33 +7,7 @@ Still having trouble? Here are a list of common questions and problems people en While you're here, join our [Discord](https://discord.gg/cRFFHYye7t) :) ### Does Quartz have Latex support? -Not by default! You can create a partial using something like Katex under `head/katex.html` and render the partial somewhere using `{{ partial "head/katex.html" . }}` (most likely in `layouts/_default/single.html`). - -```html - - - - -``` - -Example page: [jzhao.xyz/thoughts/object-classification](https://jzhao.xyz/thoughts/object-classification/) - -### My <\iframe\> is not rendering! - -Hugo's safeHTML enables this! This is disabled by default for security reasons but you can do this manually by changing `{{.Content}}` to `{{.Content | safeHTML}}` in `layouts/_default/single.html`. +Yes! See [CJK + Latex Test (ζ΅‹θ―•)](CJK%20+%20Latex%20Test%20(ζ΅‹θ―•).md) for a brief demo. ### Can I use \ in Quartz? Unless it produces direct Markdown output in the file, no. There currently is no way to bundle plugin code with Quartz. diff --git a/data/config.yaml b/data/config.yaml index a8f78bc..b10399b 100644 --- a/data/config.yaml +++ b/data/config.yaml @@ -1,13 +1,14 @@ name: Jacky Zhao enableToc: true enableLinkPreview: true +enableLatex: true description: - Here is the page description. This is an example Quartz site that details installation, - setup, customization, and troubleshooting for Quartz itself. + Host your second brain and digital garden for free. Quartz features extremely fast full-text search, + Wikilink support, backlinks, local graph, tags, and link previews. page_title: - "πŸͺ΄ Quartz 3.1" + "πŸͺ΄ Quartz .2" links: - link_name: Twitter link: https://twitter.com/_jzhao - link_name: Github - link: https://github.com/jackyzha0 \ No newline at end of file + link: https://github.com/jackyzha0 diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 8089301..7ccf81b 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -19,6 +19,7 @@ {{ $darkMode := resources.Get "js/darkmode.js" | resources.Fingerprint "md5" | resources.Minify }} + {{partial "katex.html" .}} {{$linkIndex := resources.Get "indices/linkIndex.json" | resources.Fingerprint "md5" | resources.Minify | }} diff --git a/layouts/partials/katex.html b/layouts/partials/katex.html new file mode 100644 index 0000000..f6477f8 --- /dev/null +++ b/layouts/partials/katex.html @@ -0,0 +1,21 @@ +{{if $.Site.Data.config.enableLatex}} + + + + +{{end}}