Skip to content

Commit

Permalink
Merge pull request maximevaillancourt#53 from maggiedelano/fix-footnotes
Browse files Browse the repository at this point in the history
Treat footnotes as internal links
  • Loading branch information
maximevaillancourt authored Mar 15, 2021
2 parents 6ab7bae + 561462d commit fb1ec4a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
10 changes: 8 additions & 2 deletions _notes/your-first-note.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: Your first seed

### Welcome!

This is your first note. You'll find it in the [`notes/`](https://github.com/maximevaillancourt/digital-garden-jekyll-template/tree/master/_notes) directory.
This is your first note. You'll find it in the [`notes/`](https://github.com/maximevaillancourt/digital-garden-jekyll-template/tree/master/_notes) directory.

### Link syntax

Expand All @@ -21,7 +21,9 @@ Alternatively, you can use regular [Markdown syntax](https://www.markdownguide.o

Since the Web is all about HTML, you can always use plain HTML if you want, like this: <a class="internal-link" href="/cats">This is a link to the note about cats with HTML</a>.

Of course, you can also link to external websites, like this: [this is a link to Wikipedia](https://wikipedia.org/). Again, you can use plain HTML if you prefer.
Of course, you can also link to external websites, like this: [this is a link to Wikipedia](https://wikipedia.org/). Again, you can use plain HTML if you prefer. Footnotes are also supported and will be treated like internal links.[^1]

[^1]: This is a footnote. For more information about using footnotes, check out the [Markdown Guide](https://www.markdownguide.org/extended-syntax/#footnotes).

### Site configuration

Expand Down Expand Up @@ -91,3 +93,7 @@ This digital garden template is free, open-source, and [available on GitHub here
The easiest way to build your own digital garden based on this template is to read this [step-by-step guide explaining how to set this up from scratch](https://maximevaillancourt.com/blog/setting-up-your-own-digital-garden-with-jekyll). If you need any help, my [DMs are open on Twitter (@vaillancourtmax)](https://twitter.com/vaillancourtmax). 👋

Go forth, have fun, and learn new something every day! ✌️

### Footnotes


2 changes: 1 addition & 1 deletion _plugins/open_external_links_in_new_tab.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

if open_external_links_in_new_tab
parsed_doc = Nokogiri::HTML(doc.content)
parsed_doc.css("a:not(.internal-link)").each do |link|
parsed_doc.css("a:not(.internal-link):not(.footnote):not(.reversefootnote)").each do |link|
link.set_attribute('target', 'blank')
end
doc.content = parsed_doc.to_html
Expand Down
4 changes: 3 additions & 1 deletion _sass/_style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ a {
content: "";
color: #aaaaaa;
}
&.internal-link:after {
&.internal-link:after,
&.footnote:after,
&.reversefootnote:after {
content: "";
}
}
Expand Down

0 comments on commit fb1ec4a

Please sign in to comment.