Ver Fonte

Merge pull request #84 from poole/footnotes

Add footnotes
Mark Otto há 10 anos atrás
pai
commit
188b972fb5
2 ficheiros alterados com 38 adições e 0 exclusões
  1. 19 0
      _posts/2014-01-01-example-content.md
  2. 19 0
      _sass/_type.scss

+ 19 - 0
_posts/2014-01-01-example-content.md

@@ -27,6 +27,22 @@ HTML defines a long list of available inline tags, a complete list of which can
 
 Most of these elements are styled by browsers with few modifications on our part.
 
+## Footnotes
+
+Footnotes are supported as part of the Markdown syntax. Here's one in action. Clicking this number[^fn-sample_footnote] will lead you to a footnote. The syntax looks like:
+
+{% highlight text %}
+Clicking this number[^fn-sample_footnote]
+{% endhighlight %}
+
+Each footnote needs the `^fn-` prefix and a unique ID to be referenced for the footnoted content. The syntax for that list looks something like this:
+
+{% highlight text %}
+[^fn-sample_footnote]: Handy! Now click the return link to go back.
+{% endhighlight %}
+
+You can place the footnoted content wherever you like. Markdown parsers should properly place it at the bottom of the post.
+
 ## Heading
 
 Vivamus sagittis lacus vel augue rutrum faucibus dolor auctor. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.
@@ -136,3 +152,6 @@ Nullam id dolor id nibh ultricies vehicula ut id elit. Sed posuere consectetur e
 -----
 
 Want to see something else added? <a href="https://github.com/poole/poole/issues/new">Open an issue.</a>
+
+[^fn-sample_footnote]: Handy! Now click the return link to go back.
+

+ 19 - 0
_sass/_type.scss

@@ -88,6 +88,25 @@ blockquote {
 }
 
 
+// Markdown footnotes
+//
+// See the example content post for an example.
+
+// Footnote number within body text
+a[href^="#fn:"],
+// Back to footnote link
+a[href^="#fnref:"] {
+  display: inline-block;
+  margin-left: .1rem;
+  font-weight: bold;
+}
+
+// List of footnotes
+.footnotes {
+  margin-top: 2rem;
+  font-size: 85%;
+}
+
 // Custom type
 //
 // Extend paragraphs with `.lead` for larger introductory text.