From b19db039d0f68c2bf982e12ac0590d0df8ff8aa2 Mon Sep 17 00:00:00 2001 From: Ryan Watters Date: Wed, 1 Mar 2017 03:19:14 -0600 Subject: [PATCH] Add styles for different languages in code blocks --- content/about-hugo/benefits.md | 2 +- .../content-management/cross-references.md | 56 +++++++++---------- content/functions/replace.md | 3 +- content/functions/safeHTMLAttr.md | 4 +- content/templates/base.md | 4 +- layouts/partials/site-footer.html | 4 +- pipeline/scss/components/_new-code.scss | 51 +++++++++++++++-- static/css/style.min.css | 2 +- 8 files changed, 85 insertions(+), 41 deletions(-) diff --git a/content/about-hugo/benefits.md b/content/about-hugo/benefits.md index f19cab3be..bad44d608 100644 --- a/content/about-hugo/benefits.md +++ b/content/about-hugo/benefits.md @@ -34,7 +34,7 @@ Not running a website generator on your HTTP server has many benefits. The most ["An Introduction to Static Site Generators", David Walsh]: https://davidwalsh.name/introduction-static-site-generators ["Static Site Generators", O-Reilly]: /documents/oreilly-static-site-generators.pdf -["Top 10 Static Website Generators," Netlify blog]: https://www.netlify.com/blog/2016/05/02/top-ten-static-website-generators/ +["Top 10 Static Website Generators", Netlify blog]: https://www.netlify.com/blog/2016/05/02/top-ten-static-website-generators/ [hugovwordpress]: https://gettingthingstech.com/hugo-vs.-wordpress-page-load-speed-comparison-hugo-leaves-wordpress-in-its-dust/ [StaticGen: Top Open-Source Static Site Generators (GitHub Stars)]: https://www.staticgen.com/ [dotcms]: https://dotcms.com/blog/post/the-resurgence-of-static diff --git a/content/content-management/cross-references.md b/content/content-management/cross-references.md index 6c5dfe05c..dd57d1ba8 100644 --- a/content/content-management/cross-references.md +++ b/content/content-management/cross-references.md @@ -33,8 +33,8 @@ The single parameter to `ref` is a string with a content `documentname` (e.g., ` The `documentname` is the name of a document, including the format extension; this may be just the filename, or the relative path from the `content/` directory. With a document `content/blog/post.md`, either format will produce the same result: ```golang -{{}} ⇒ `/blog/post/` -{{}} ⇒ `/blog/post/` +{{}} → `/blog/post/` +{{}} → `/blog/post/` ``` If you have the same filename used across multiple sections, you should only use the relative path format; otherwise, the behavior will be `undefined`. This is best illustrated with an example `content` directory: @@ -56,17 +56,17 @@ The potential for conflicting `documentname` is more likely in larger sites. Usi {{% code file="content/meta/my-article.md" copy="false" %}} ```golang -{{}} ⇒ `/events/my-birthday/` (maybe) -{{}} ⇒ `/posts/my-birthday/` (maybe) -{{}} ⇒ `/galleries/my-birthday/` (maybe) -{{}} ⇒ `/events/my-birthday/` -{{}} ⇒ `/galleries/my-birthday/` +{{}} → `/events/my-birthday/` (maybe) +{{}} → `/posts/my-birthday/` (maybe) +{{}} → `/galleries/my-birthday/` (maybe) +{{}} → `/events/my-birthday/` +{{}} → `/galleries/my-birthday/` ``` {{% /code %}} A relative document name must *not* begin with a slash (`/`). ```golang -{{}} ⇒ `""` +{{}} → `""` ``` ### Anchors @@ -74,27 +74,27 @@ A relative document name must *not* begin with a slash (`/`). When an `anchor` is provided by itself, the current page’s unique identifier will be appended; when an `anchor` is provided appended to `documentname`, the found page's unique identifier will be appended: ```golang -{{}} ⇒ `#anchors:9decaf7` -{{}} ⇒ `/blog/post/#who:badcafe` +{{}} → `#anchors:9decaf7` +{{}} → `/blog/post/#who:badcafe` ``` The above examples render as follows for this very page as well as a reference to the "Content" heading in the Hugo docs features pageyoursite ```golang -{{}} ⇒ `#who:9decaf7` -{{}} ⇒ `/blog/post/#who:badcafe` +{{}} → `#who:9decaf7` +{{}} → `/blog/post/#who:badcafe` ``` More information about document unique identifiers and headings can be found [below]({{< ref "#hugo-heading-anchors" >}}). ### Examples -* `{{}}` ⇒ `http://yoursite.com/blog/post/` -* `{{}}` ⇒ `http://yoursite.com/blog/post/#tldr:caffebad` -* `{{}}` ⇒ `/blog/post/` -* `{{}}` ⇒ `/blog/post/#tldr:caffebad` -* `{{}}` ⇒ `#tldr:badcaffe` -* `{{}}` ⇒ `#tldr:badcaffe` +* `{{}}` → `http://yoursite.com/blog/post/` +* `{{}}` → `http://yoursite.com/blog/post/#tldr:caffebad` +* `{{}}` → `/blog/post/` +* `{{}}` → `/blog/post/#tldr:caffebad` +* `{{}}` → `#tldr:badcaffe` +* `{{}}` → `#tldr:badcaffe` ## Hugo Heading Anchors @@ -148,22 +148,22 @@ The technique outlined above works well enough, but some documents have headings It’s easy to forget to do that all the time, and Hugo is smart enough to do it for you. It just adds `-x` to the end of each heading it has already seen. -* `### Example` ⇒ `example` -* `### Example` ⇒ `example-1` -* `### Example` ⇒ `example-2` +* `### Example` → `example` +* `### Example` → `example-1` +* `### Example` → `example-2` Sometimes it's a little harder, but Hugo can recover from those, too, by adding more suffixes: -* `# Heading` ⇒ `heading` -* `# Heading 1` ⇒ `heading-1` -* `# Heading` ⇒ `heading-1-1` -* `# Heading` ⇒ `heading-1-2` -* `# Heading 1` ⇒ `heading-2` +* `# Heading` → `heading` +* `# Heading 1` → `heading-1` +* `# Heading` → `heading-1-1` +* `# Heading` → `heading-1-2` +* `# Heading 1` → `heading-2` This can even affect specified heading anchors that come after a generated heading anchor. -* `# My Heading` ⇒ `my-heading` -* `# My Heading {#my-heading}` ⇒ `my-heading-1` +* `# My Heading` → `my-heading` +* `# My Heading {#my-heading}` → `my-heading-1` {{% note %}} This particular collision and override both unfortunate and unavoidable because Hugo processes each heading for collision detection as it sees it during conversion. diff --git a/content/functions/replace.md b/content/functions/replace.md index 61f89fb0a..0d1d10f5a 100644 --- a/content/functions/replace.md +++ b/content/functions/replace.md @@ -19,6 +19,7 @@ aliases: [] `replace` replaces all occurrences of the search string with the replacement string: ``` -`{{ replace "Batman and Robin" "Robin" "Catwoman" }}` → "Batman and Catwoman" +`{{ replace "Batman and Robin" "Robin" "Catwoman" }}` +→ "Batman and Catwoman" ``` diff --git a/content/functions/safeHTMLAttr.md b/content/functions/safeHTMLAttr.md index cd8637b1d..01b33df21 100644 --- a/content/functions/safeHTMLAttr.md +++ b/content/functions/safeHTMLAttr.md @@ -27,6 +27,6 @@ Example: Given a site-wide `config.toml` that contains this menu entry: url = "irc://irc.freenode.net/#golang" ``` -* `` ⇒ `` (Bad!) -* `` ⇒ `` (Good!) +* `` → `` +* `` → `` diff --git a/content/templates/base.md b/content/templates/base.md index 1f8ad1851..9520b4d8e 100644 --- a/content/templates/base.md +++ b/content/templates/base.md @@ -91,10 +91,10 @@ When using the `define` keyword, you do *not* need to use Go templates context r This replaces the contents of our (basically empty) "main" block with something useful for the list template. In this case, we didn't define a `"title"`` block, so the contents from our base template remain unchanged in lists. {{% warning %}} -Code that you put outside the block definitions *can* break your layout. This even include HTML comments. For example: +Code that you put outside the block definitions *can* break your layout. This even includes HTML comments. For example: ```html - + {{ define "main" }} ...your code here {{ end }} diff --git a/layouts/partials/site-footer.html b/layouts/partials/site-footer.html index 1644ab979..fbde4a241 100644 --- a/layouts/partials/site-footer.html +++ b/layouts/partials/site-footer.html @@ -7,8 +7,8 @@