Giter Club home page Giter Club logo

jquery-markdown-footnotes's Introduction

Here's a demo.

This is a JS snippet that adds functionality to the footnote implementation in Markdown.

Markdown automatically adds footnotes that work: Click the superscript footnote number, the page jumps to the bottom, you read the footnote, you jump back up. This can be annoying for readers, since they often want to refer to the main text while reading the footnote. It's also ugly and jarring.

This snippet replaces that functionality. When someone clicks the superscript footnote number, an overlay appears from the bottom of the screen with the requested footnote:

Screenshot of the snippet in action!

How to use it

The snippet requires jQuery, so make sure you have that.

Then download it and include the "jquery.markdownFootnotes.min.js" file on whatever page you want to add the functionality to. I just stuck it in the layout for my site, since I never know when I'll be using footnotes. There is no additional work needed.

FYI - the default footnotes aren't removed. They remain at the bottom of an article as usual.

Customize it

The display of the footnote is easily editable. Just alter the properties of the footnoteContentCSS object:

var footnoteContentCSS = {
	'background': '#000',
	'opacity': '.9',
	'color': '#fff',
	'-webkit-box-shadow': '0px 0px 5px #000',
	'-moz-box-shadow': '0px 0px 5px #000'
}

"Uh... How do you do footnotes in Markdown?"

Like this:

Here is my paragraph[^1], here is my spout[^2].

[^1]: A paragraph is many sentences.
[^2]: Just keep adding references and text to build your footnotes.

Also

Feel free to submit pull requests - I'm sure this can be optimized in a thousand different ways.

When I had the idea to do this, I did a quick search to see if anyone already had. I found one from Lukas Mathis, but I wanted to implement it differently. If you want this kind of footnote behavior but don't like my approach to it, check his out - you might prefer his tooltip-like method.

jquery-markdown-footnotes's People

Contributors

kriwil avatar sumeetjain avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

kriwil andytlr

jquery-markdown-footnotes's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.