From 49b2d8b7a0a110b40f11679f5a26bc299660ec90 Mon Sep 17 00:00:00 2001 From: Dean Attali Date: Fri, 29 Mar 2024 21:53:28 +0000 Subject: [PATCH] add mathjax YAML parameter to support mathjax expressions; closes #195 --- CHANGELOG.md | 1 + README.md | 5 +++-- _includes/head.html | 1 + _includes/mathjax.html | 12 ++++++++++++ _posts/2020-02-28-sample-markdown.md | 4 ++++ 5 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 _includes/mathjax.html diff --git a/CHANGELOG.md b/CHANGELOG.md index c415f90..600a4ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## Unreleased version - BREAKING CHANGE: Allow changing the order of the social network links that appear in the footer (#1152) - BREAKING CHANGE: `google-scholar` social network link no longer requires the prefix `citations?user=`; if you previously set this parameter, it needs to be updated (#1189) +- Added `mathjax` YAML parameter to allow support for MathJax, used to write LaTeX expressions (#195) - Added explicit support for favicons, you only need to add a `favicon.ico` file to the root directory - The footer of a page always sticks to the bottom, even on short pages (#576) - Added `author` YAML parameter to allow specifying the author(s) of a post (#1220) diff --git a/README.md b/README.md index 11623b3..1ecc6e5 100644 --- a/README.md +++ b/README.md @@ -132,7 +132,7 @@ You can look at the top of [`aboutme.md`](https://raw.githubusercontent.com/daat # Supported parameters -Below is a list of the parameters that Beautiful Jekyll supports (any of these can be added to the YAML front matter of any page). Remember to also look in the `_config.yml` file to see additional site-wide settings. +Below is a list of the parameters that Beautiful Jekyll supports (any of these can be added to the YAML front matter of any page). Remember to also look in the `_config.yml` file to see additional site-wide settings. If there's a parameter that you want to apply to the entire site instead of one specific page, check out [this FAQ answer](https://beautifuljekyll.com/faq/#default-params). ## Main parameters @@ -146,6 +146,7 @@ tags | List of tags to categorize the post. Separate the tags with commas cover-img | Include a large full-width image at the top of the page. You can either provide the path to a single image (eg. `"/path/to/img"`) , or a list of images to cycle through (eg. `["/path/img1", "/path/img2"]`). If you want to add a caption to an image, then you must use the list notation (use `[]` even if you have only one image), and each image should be provided as `"/path/to/img" : "Caption of image"`. thumbnail-img | For blog posts, if you want to add a thumbnail that will show up in the feed, use `thumbnail-img: /path/to/image`. If no thumbnail is provided, then `cover-img` will be used as the thumbnail. You can use `thumbnail-img: ""` to disable a thumbnail. comments | If you want do add comments to a specific page, use `comments: true`. Comments only work if you enable one of the comments providers (Facebook, disqus, staticman, utterances, giscus, CommentBox) in `_config.yml` file. Comments are automatically enabled on blog posts but not on other pages; to turn comments off for a specific post, use `comments: false`. +mathjax | If you want to use LaTeX formulas, you need to enable MathJax. Note that in MathJax you need to use `$$` and `\\(` to start and end expressions ## Parameters for SEO and social media sharing @@ -210,7 +211,7 @@ Congratulations on making it this far! You now have all the tools to easily buil - After you get comfortable with the basics of writing in markdown, I suggest taking a look at this [sample post](https://beautifuljekyll.com/2020-02-28-sample-markdown/) and [the code that created it](https://raw.githubusercontent.com/daattali/beautiful-jekyll/master/_posts/2020-02-28-sample-markdown.md) to learn some more advanced tips about markdown. -- I highly recommend going over the [*Frequently Asked Questions*](https://beautifuljekyll.com/faq/) to find out answers to questions you may not even know you have. Every few months I suggest checking the [*What's New?*](https://beautifuljekyll.com/updates/) page to see if there are new features, and learn [how to update your site to the newest version](https://beautifuljekyll.com/faq/#updating) when it's time. +- I **highly recommend** going over the [*Frequently Asked Questions*](https://beautifuljekyll.com/faq/) to find out answers to questions you may not even know you have. Every few months I suggest checking the [*What's New?*](https://beautifuljekyll.com/updates/) page to see if there are new features, and learn [how to update your site to the newest version](https://beautifuljekyll.com/faq/#updating) when it's time. - You can also check out the [advanced installation methods](https://beautifuljekyll.com/getstarted/#install-steps-hard) that give you a little more control but are harder to use. Keep in mind that Beautiful Jekyll was primarily designed to be used as a GitHub theme, so you will not get any support if you choose one of the Ruby installation methods. diff --git a/_includes/head.html b/_includes/head.html index 55a3190..fa0cfd1 100644 --- a/_includes/head.html +++ b/_includes/head.html @@ -62,6 +62,7 @@ {% include gtm_head.html %} {% include google_analytics.html %} {% include cloudflare_analytics.html %} + {% include mathjax.html %} {% if layout.common-ext-css %} {% for css in layout.common-ext-css %} diff --git a/_includes/mathjax.html b/_includes/mathjax.html new file mode 100644 index 0000000..f8d7bea --- /dev/null +++ b/_includes/mathjax.html @@ -0,0 +1,12 @@ +{% if page.mathjax %} + + +{% endif %} diff --git a/_posts/2020-02-28-sample-markdown.md b/_posts/2020-02-28-sample-markdown.md index d46f9ba..6a59d6a 100644 --- a/_posts/2020-02-28-sample-markdown.md +++ b/_posts/2020-02-28-sample-markdown.md @@ -6,6 +6,7 @@ gh-repo: daattali/beautiful-jekyll gh-badge: [star, fork, follow] tags: [test] comments: true +mathjax: true author: Bill Smith --- @@ -27,6 +28,9 @@ Here's a table: | Seven | Eight | Six | | Two | Three | One | +You can use [MathJax](https://www.mathjax.org/) to write LaTeX expressions. For example: +When \\(a \ne 0\\), there are two solutions to \\(ax^2 + bx + c = 0\\) and they are $$x = {-b \pm \sqrt{b^2-4ac} \over 2a}.$$ + How about a yummy crepe? ![Crepe](https://beautifuljekyll.com/assets/img/crepe.jpg)