Git Product home page Git Product logo

sublime-alphanumericmarkdownfootnote's Introduction

Alphanumeric Markdown Footnote

A Sublime Text 3 plugin.

When a shortcut is pressed, inserts footnotes where the cursor is.

If the cursor is inside a footnote, you can hit a different shortcut to go back to where the footnote marker is in the document.

Similar to MarkdownFootnotes, having these shared features:

  • Adds a footnote label to the cursor position and a corresponding footnote entry to the bottom of the file.
  • Automatically handles footnote numbers, keeping them consecutive, like Microsoft Word.
  • Automatically places cursor in the footnote entry so you can just start typing away at your note.

It differs from MarkdownFootnotes by:

  • handling non-integer footnote ids
  • ignoring your currently selected text when creating the footnote
  • not bothering to validate all of your footnotes
  • when footnote ids end with a number, use that prefix for the new footnote, but adjust all the numbers to line up
  • having a "go back to the footnote marker" shortcut
  • less code
  • tests

Example

This is a test paragraph

And here is another[^chapter1-1]

[^chapter1-1]: Totally a footnote

With the cursor at the end of the first line, hitting the shortcut produces this:

This is a test paragraph[^chapter1-1]

And here is another[^chapter1-2]

[^chapter1-1]: 

[^chapter1-2]: Totally a footnote

with the cursor on the footnote line immediately after [^chapter1-1]: .

Keybinding

Insert footnote

  • ctrl+f (OS X)
  • ctrl+alt+f (Linux, Windows)

Move to footnote

  • ctrl+alt+f (OS X)
  • ctrl+alt+super+f (Linux, Windows)

To run tests

python3 test.py

License

WTFPL

sublime-alphanumericmarkdownfootnote's People

Contributors

artskydj avatar tehshrike avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

artskydj

sublime-alphanumericmarkdownfootnote's Issues

Broken on Windows

Hey,

I successfully tested my install w/ test.py (console said Passing!)but AlphanumericMarkdownFootnote doesn't seem to work : nothing happens when I press ctrl+alt+f and no trace of it in the Package Settings Menu

I'm under windows&linux installs, using AcademicMarkdown, MarkdownEditing, Citer & Pandoc. Installed AlphanumericMarkdownFootnote through PackageControl and then manually.

Looking at the Sublime console on startup, got this meaningful output :

File "C:###\Roaming\Sublime Text 3\Packages\Sublime-AlphanumericMarkdownFootnote-master\test.py", line 1, in
from FootnoteFunctions import insert_footnote, find_enclosing_footnote_id, find_footnote_marker_position, get_footnote_marker_id_at_position, get_footnote_body_position
ImportError: No module named 'FootnoteFunctions'

As it look quite great, I do hope for an answer :D
Cheers !

Alphanumeric Markdown Footnote ImportError: No module named 'FootnoteFunctions'

Linux Ubuntu 20.04
Sublime Text 4 b4077

Alphanumeric Markdown Footnote ImportError: No module named 'FootnoteFunctions'

File "/opt/sublime_text/Lib/python33/sublime_plugin.py", line 1425, in load_module
reloading plugin Default.transpose
    exec(compile(source, source_path, 'exec'), mod.__dict__)
  File "/home/ashed/.config/sublime-text/Installed Packages/Alphanumeric Markdown Footnote.sublime-package/test.py", line 1, in <module>
ImportError: No module named 'FootnoteFunctions'

Would you tell me how can I fix it?

Chapter references are inserted out of order if the file does not end in a newline

Add this to test.py, and you'll see that it fails

assert_equal(insert_footnote("""This is a test paragraph

And here is another[^chapter1-1]

[^chapter1-1]: Totally a footnote""", 24)['body'], """This is a test paragraph[^chapter1-1]

And here is another[^chapter1-2]

[^chapter1-1]:

[^chapter1-2]: Totally a footnote""")

Red is what was expected, green is what I got:

This is a test paragraph[^chapter1-1]

And here is another[^chapter1-2]

- [^chapter1-1]: 

[^chapter1-2]: Totally a footnote

+ [^chapter1-1]: 

EDIT:
I just noticed that if you add a newline to the end of the file, it does transform as expected.

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.