ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Pandoc Referencer

by scotartt ALL

This Sublime Text 3 plugin totes up the Pandoc/Markdown footnote references in a file ([^refno]) and checks there is an entry text for each footnote found. Also it allows easy insertions of footnotes.

Details

  • 2015.12.18.23.49.02
  • github.​com
  • github.​com
  • 9 years ago
  • 53 minutes ago
  • 11 years ago

Installs

  • Total 2K
  • Win 747
  • Mac 663
  • Linux 323
Oct 31 Oct 30 Oct 29 Oct 28 Oct 27 Oct 26 Oct 25 Oct 24 Oct 23 Oct 22 Oct 21 Oct 20 Oct 19 Oct 18 Oct 17 Oct 16 Oct 15 Oct 14 Oct 13 Oct 12 Oct 11 Oct 10 Oct 9 Oct 8 Oct 7 Oct 6 Oct 5 Oct 4 Oct 3 Oct 2 Oct 1 Sep 30 Sep 29 Sep 28 Sep 27 Sep 26 Sep 25 Sep 24 Sep 23 Sep 22 Sep 21 Sep 20 Sep 19 Sep 18 Sep 17
Windows 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
Mac 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Linux 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0

Readme

Source
raw.​githubusercontent.​com

PandocReferencr

This plugin totes up the Pandoc/Markdown footnote references in the current file and checks there is an entry for the reference. It also checks for orphaned footnote entries (i.e. footnote text that has no insert point in the main body).

A footnote in pandoc looks like this.[^footnoteid1]

[^footnoteid1]: And this is the text of the footnote.

There is also a very useful command for inserting footnotes, which prompts you for a footnote id (with defaults) and then the text for the footnote, which is inserted at the end of the file (soon to be a configurable location). See below for more information.

Installing it in Sublime Text

It's available from Package Control - https://sublime.wbond.net/packages/Pandoc%20Referencer

Invoking it

Default command palette (and key bindings):

  • 'Pandoc Footnotes: Check' (ctrl+super+alt+r)

  • 'Pandoc Footnotes: Insert New' (super+alt+r)

There are also menu items under “Tools -> Pandoc Footnotes”. See below for behaviour.

Settings

Select “Preferences -> Package Settings -> Pandoc Referencr -> Settings - User” to customised your settings. You can also override the keyboard bindings if you prefer other keystrokes to the ones I've provided.

Here are the default settings:

{
    // footnote_placement is either 'document' or 'paragraph'. 
    "footnote_placement": "document",

    // how many spaces to put before the footnote text. 
    // default is 0. Must be < 4. Values other than 0 not strictly
    // conformant to the Pandoc spec, but they work if < 4 (four spaces
    // or a tab, or more, would make the text block into a code block)
    "space_prepend_count": 0,

    // by default, what is the default prefix to use for footnotes 
    // when no other value can be computed. default is "fn".
    "default_footnote_prefix": "fn",
}

“Footnote placement” is not currently used; see below. Footnotes are currently always at the end of the document.

Inserting Footnotes (super+alt+r)

Command: insert_footnote

When you insert a footnote, you will be asked for the footnote id. If you have any selections, the first selection will pre-fill the footnote id field. The footnote id is inserted at the end of the selection, otherwise at the current cursor position.

After you enter the footnote id, you will be asked to supply the footnote text. The footnote text is inserted at the end of the document. It tries to insert the footnote cleanly. If there is no newline at the end of the file, it compensates for this. If there are multiple newlines at the end of the file, it inserts the footnote at the top of the newlines. If there is a complex mixture of whitespace and newlines at the end of the file, it acts fairly sensibly, but not as cleanly. You could try keeping the end of your file in a cleaner state ;-) … there are settings for this:

"default_line_ending": "unix",
"ensure_newline_at_eof_on_save": true,

There are a number of changes coming to this behaviour. Please see the comments on this issue for a description of how that behaviour will work.

Checking Footnotes (ctrl+super+alt+r)

Command: check_footnotes

This checks that each footnote id inserted in the text has a corresponding footnote text item, and that all footnote text items has a matching footnote id inserted in the text.

When you check the footnotes, if everything is OK in current buffer (open document), that is all the footnote ids and texts match, then the status line will say “All Footnotes OK!”

If there are errors, a warning dialog will tell you the footnote ids and line numbers where there are issues, up to five issues. If there are more than five issues with the footnotes, you are only shown the first four, plus additional line alerting you to the presence of more footnotes errors.

For example, this text has a footnote with a valid footnote 
text.[^footnote1] However this note is missing,[^missing1] if 
you invoke check_references on this file it will say there's 
TWO errors. The first one is 'missing1'.

[^hithere0]: The second error is that there is no 'hithere0'
footnote inserted anywhere in the main body text (Orphaned 
footnote text).

[^footnote1]: This is the valid footnote text.

Licence

This software is licensed using the GNU GPL version 2.

No warranty, responsibility, or liability is assumed by the author in any use of this software.