Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

 
 

Repository files navigation

Moon Dancer cutie mark: purple crescent and three pink stars

Moondancer FN

CI

[^1] footnote syntax support to VS Code's Markdown editor and preview.

The extension icon and README emblem use Moon Dancer's purple-crescent-and-three-pink-stars cutie mark. The editable vector artwork is in assets/moondancer-cutie-mark.svg.

This repository is a maintained fork of houkanshan/vscode-markdown-footnote by Mai Hou. The upstream work was distributed under the MIT License; its original copyright and permission notice are retained in LICENSE-base. This fork and its modifications are distributed under the GNU Affero General Public License version 3 or, at your option, any later version; see LICENSE.

PDF-magic in independent VS Code tabs

Moondancer can display local .pdf documents through the existing local checkout of PDF-magic/viewer. The viewer's built JavaScript, CSS, PDF.js worker, images, and navigation features are loaded from that checkout at runtime; Moondancer does not vendor or fork the viewer.

Build the reader in its own checkout once:

cd /path/to/PDF-magic/viewer
npm install
npm run build

Set Moondancer: PDF Viewer Checkout (moondancer.pdfViewerCheckout) to the reader repository directory (not its dist directory). When unset, Moondancer checks common sibling and home paths. Rebuild the viewer there after changing its source, then reopen the PDF tab to use the new build.

Opening a local .pdf file creates a native VS Code editor tab using the PDF-magic UI. To open a remote PDF in its own editor tab, run Open Web PDF with PDF-magic from the Command Palette and supply its URL. The extension host downloads remote PDFs without forwarding your browser cookies or authentication tokens; protected websites may refuse the request. Local and remote PDFs are read-only. Each editor tab has its own viewer state.

The VS Code adapter supplies document bytes and translates existing reader asset URLs; Chrome-only MIME interception and native-messaging enhancement aren't available in the VS Code webview. Browser use is unaffected, and PDF-magic remains the single source of viewer code.

Features

  • Hover to preview and jump between footnote reference and content by cmd / ctrl + click.

    Hover preview

  • Peek editor for quick editing and preview.

    Peek footnote content

    Peek footnote references

  • Command for inserting new footnote

  • Quickly scaffold a numbered footnote from the caret with cmd + shift + 6 on macOS or ctrl + shift + 6 elsewhere. Moondancer inserts the next available [^n] reference, appends the matching [^n]: definition, and moves the cursor to the definition so you can type immediately.

    Click to create a new footnote

    Use command to insert a footnote

  • Blockquote selected Markdown with cmd + . on macOS or ctrl + . on Windows/Linux. The Blockquote Selection command prefixes each selected line with > (or > for blank lines) in a single undoable edit. It quotes full lines, handles multiple selections without duplicates, and leaves an unselected line after a trailing newline alone. This shortcut works only for selected Markdown text and can be turned off in Settings using vscode-markdown-footnote.blockquoteSelectionShortcut (enabled by default). With no selection or the option disabled, the existing Quick Fix shortcut remains available. You can also remap the command from Keyboard Shortcuts.

  • Edit footnotes in a synchronized side editor. Run Open Footnote Editor to keep the current Markdown file's footnotes open beside your draft. Inserting a new footnote keeps the Markdown cursor at the reference and moves focus directly to the new footnote in the side editor. The side editor remembers its scroll/cursor position, and new definitions are placed beside the last footnote you were editing instead of always being appended to the end. Multiline footnote content is supported, including indented continuation lines, as originally requested in upstream PR #14.

  • Optionally store footnote definitions in a separate sibling file. Enable vscode-markdown-footnote.separateFootnoteFile to keep references such as [^1] in the source document while definitions are read from and written to footnotes.md. The definition file is created automatically when a footnote is first inserted. vscode-markdown-footnote.footnoteFileName can change the file name. Hover, go-to-definition, reference lookup, clickable links, and the synchronized side editor follow the definitions across files.

  • Spellcheck highlighted Markdown from VS Code's lightbulb / Quick Fix menu. Spellcheck selection with Spellcheck Only opens ChatGPT with the selected text addressed to the installed @Spellcheck Only plugin. The plugin name can be changed with vscode-markdown-footnote.spellcheckPluginName.

  • Optionally make Enter exit closing punctuation in Markdown. Enable vscode-markdown-footnote.skipClosingPunctuationOnEnter (off by default) to move the caret past an immediately following ), ], or } instead of inserting a newline. If no closer follows the caret, Enter keeps its normal behavior. Suggestions, snippet editing, and rename prompts retain their original Enter handling. With multiple cursors, all cursors must precede a closing delimiter to skip; otherwise Enter inserts a newline normally.

  • Render footnotes in the built-in markdown preview.

    Preview

Separate footnote file

Separate-file storage is opt-in and defaults to off, so existing Markdown documents keep their current same-file behavior. VS Code's built-in Markdown preview only receives the source document text, so external definitions are not currently merged into preview rendering; editor navigation and the Footnotes side editor do resolve them.

TODO

Build and use this fork locally

This fork does not need to be published to the VS Code Marketplace. You can run it directly from the source checkout while developing, or package it as a local .vsix and install it into your normal VS Code profile.

Prerequisites

Install:

1. Clone and install dependencies

git clone https://github.com/pony-factor/moondancer-FN.git
cd moondancer-FN
npm install

2. Compile the extension

npx tsc -p .

The compiled JavaScript is written to the out/ directory.

3. Run it directly for development

Open the repository in VS Code:

code .

Then press F5, or open Run and Debug and choose Run Extension.

VS Code will compile the extension and open a separate Extension Development Host window with this checkout loaded. You can test the extension there without installing or publishing anything.

After changing the source, stop the development host and press F5 again to rebuild and relaunch it.

4. Install this fork into your normal VS Code

Package the current checkout as a local VS Code extension:

npx vsce package --out markdown-footnote-local.vsix

Install that file:

code --install-extension markdown-footnote-local.vsix --force

If the code command is not available in your shell, open VS Code, go to the Extensions view, open the ... menu, choose Install from VSIX..., and select markdown-footnote-local.vsix.

Reload VS Code after installation if prompted.

Rebuild after making changes

To replace the locally installed copy with a new build:

npx tsc -p .
npx vsce package --out markdown-footnote-local.vsix
code --install-extension markdown-footnote-local.vsix --force

No Marketplace publishing step is required.

Contributing

Dev

  • Fork this repository
  • npm install
  • Create your feature branch: git checkout -b my-new-feature
  • Make changes and add tests
  • npm run test:watch and check your changes by pressing F5
  • Commit your changes: git commit -am 'feat: Add some feature'
  • Push to the branch: git push origin my-new-feature
  • Submit a pull request

Thanks

License

This fork is licensed under the GNU Affero General Public License v3.0 or later.

The upstream code by Mai Hou was originally distributed under the MIT License. Its original copyright and permission notice are preserved in LICENSE-base.

Changelog

See changelog here.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages