Skip to content

Repository files navigation

MarkEdit Citations

Citation-key completion for MarkEdit.

Type @ in a Markdown document and choose a citation from one or more local BibTeX/BibLaTeX files. Suggestions show the citation key, author, year, and title, and insert the selected key into the Markdown source.

Completed citations are shown compactly when the cursor is outside them:

  • [@smith2024, p. 12] appears as (Smith, 2024, p. 12).
  • @smith2024 [para. 4] appears as Smith (2024, para. 4).
  • Citation clusters such as [@smith2024; @doe2022] are supported.

Click a compact citation to reveal and edit its original Markdown.

Install

  1. Download markedit-citations.js from the latest release, or build dist/markedit-citations.js locally.

  2. In MarkEdit, use the main-menu command to open its Documents folder, then open the scripts subfolder. Alternatively, open:

    ~/Library/Containers/app.cyan.markedit/Data/Documents/scripts/
    
  3. Option-drag markedit-citations.js into that folder. Option-dragging avoids a macOS sandbox error that can occur with command-line copies.

  4. Restart MarkEdit.

The extension targets the current MarkEdit API and requires a MarkEdit release that provides userSettings, getFileInfo, getFileContent, and CodeMirror autocomplete.

Configure a document

Add a bibliography field to the YAML front matter:

---
title: "My Paper"
bibliography: references.bib
---

Previous work discusses this problem [@smith2024].

Multiple bibliographies are supported:

bibliography:
  - references.bib
  - ../shared/books.bib

Relative paths are resolved from the Markdown document. Save a new document before using a relative bibliography path.

Configure a global bibliography

MarkEdit's settings.json can provide fallback bibliography files. Open the settings file from MarkEdit's customization menu and add:

{
  "extension.markeditCitations": {
    "bibliography": ["~/Documents/references/library.bib"],
    "compactCitations": true,
    "maxResults": 100,
    "reloadIntervalMs": 1500,
    "showOnEmptyQuery": true
  }
}

Document bibliographies and configured global bibliographies are combined. Duplicate citation keys use the last occurrence.

The extension checks file modification times and reloads changed bibliographies. Use Extensions → Citations → Reload Bibliographies to force an immediate reload or Bibliography Status to see resolved paths and warnings.

If the bibliography lives outside the document folder, grant MarkEdit access using File → Grant Folder Access.

Supported behavior

  • Scalar and list-form bibliography YAML fields
  • Relative, absolute, ~/, and file:// local paths
  • Multiple .bib files
  • BibTeX and common BibLaTeX entry fields
  • Braced and quoted values, string macros, and # concatenation
  • Citation search by key, author, year, and title
  • Automatic reload after bibliography changes
  • Suppression inside email addresses
  • Compact parenthetical, narrative, locator, and clustered citation display

The compact display is editor-only and never changes the Markdown source.

Build

Requires Node.js 20 or later:

npm ci
npm run check

The installable single-file build is written to dist/markedit-citations.js.

License

MIT

About

Pandoc citation-key completion and compact academic citation rendering for MarkEdit.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages