Sno Station
Sno Station is your agents' workstation: open-source software that turns the AI agents you already run into one squad on your own machine. Two heads are better than one, and they get better with every
Radiopaedia cite (userscript) — a citation picker in the article editor's toolbar: type to cite a reference the article already has, or paste a DOI/PMID and it is looked up, added as the next numbered
PluginsJavaScript · HTMLGitHub @gmadevsOnlineOwner unconfirmed
Have you tried it? One tap is enough. No sign-in needed.
Radiopaedia cite (userscript) — a citation picker in the article editor's toolbar: type to cite a reference the article already has, or paste a DOI/PMID and it is looked up, added as the next numbered reference, and cited in the same press.
Taken from the repository README
Loading the full README. The saved excerpt is shown below.
A citation picker in the article editor's own toolbar, right beside H3.
Press it and type. The references the article already has, filtered as you write — one press puts
the number in the text, exactly where the caret was, in the shape the house style asks for: spaced,
inside the sentence, joined to the marker beside it rather than doubled. Paste an identifier the
article has not got yet — a DOI, a PMID, a URL — and it is looked up on
radiopaedia.work/cite, shown to you in full, and on your say-so
added as the next numbered reference and cited in the same press.Read the full README ↗A citation picker for the Radiopaedia article editor. It adds a button to the editor's toolbar, next to H3.
Press the button and type. The panel lists the article's references and filters them as you type. Return inserts the number at the caret in the house style: with a space before it, inside the sentence, and merged with an adjacent marker. If you paste an identifier the article does not cite yet (a DOI, a PMID, a URL), the script looks it up on radiopaedia.work/cite and shows you the result. When you confirm, it adds the reference as the next numbered entry and cites it.
A second button, Ω, inserts characters that are not on the keyboard (≤ ≥ ± × ≈ °
µ ² ³ → β Δ), which you find by name.
caret in the text → ❝ → ⏎ → the reference you added last
type a word, ⏎ → the reference that matches it
paste a DOI, ⏎ ⏎ → looked up, added as N, cited as N
Ω → type a name, ⏎ → ≤ ≥ ± × ≈ ~ ° µ ² ³ → β Δ …
…haemangioblastoma) <sup>1</sup>. a space before, inside the sentence
<sup>2</sup> + 3 → <sup>2,3</sup> merged, never doubled
<sup>2,3</sup> + 4 → <sup>2-4</sup> and closed up into a range
This is a userscript, not a browser extension. You install a userscript manager once (every major browser has one, Safari included), and the manager then keeps the script up to date from this repository. The same file works in every browser.
1. Install a userscript manager.
| browser | what to install | notes |
|---|---|---|
| Chrome | Tampermonkey | none |
| Edge | Tampermonkey | none |
| Firefox | Tampermonkey | none |
| Safari | Userscripts (free, macOS and iOS) | enable it in Safari → Settings → Extensions, and give it permission on radiopaedia.org |
Violentmonkey also works in Chrome, Edge and Firefox. The script
uses only GM_xmlhttpRequest, GM_addStyle and unsafeWindow, which all of these managers
provide.
2. Open radiopaedia-cite.user.js.
The manager recognises any URL ending in .user.js and offers to install it. It then checks the
same URL for updates. If it does not offer to install: Dashboard → + (new script) → paste the
file → save.
3. Open any article's Edit page. Two buttons appear in the editor's toolbar, next to H3.
There is nothing to configure, and no account or key is needed. The script does nothing on other pages.
It can be installed together with
Radiopaedia Lint, and the two do not
overlap: Lint checks the text of a reference, and this script manages its number. A citation added
here comes from the same radiopaedia.work/cite that Lint's Lint citation chip checks against,
so the two agree.
Put the caret where the citation belongs and press [1] (or altshiftC).
The panel opens and shows, along the top, the words just before the caret, so you can see where the
marker will go.
The reference you added last. The panel opens with this row selected, because it is usually the one you are citing. Press return.
A reference the article already has. Type any word of it: an author, the journal, the year, or the number. The list narrows as you type and the matching text is highlighted. Return cites it.
A new reference. Paste an identifier and it is looked up.
If you paste an identifier that is already cited, the panel shows Already reference 7 and offers that number instead of adding a second copy. This is also a quick way to find which number a paper has. The script matches the paper by its DOI, PMID, PMCID, or a link in the existing reference.
A marker is <sup>1</sup>, with a space before it, placed inside the sentence:
…distinguished from other enhancing spinal cord lesions (e.g. ependymoma, astrocytoma and haemangioblastoma) 1.
The script handles both of these:
e.g., i.e., Fig.) is not the end of a sentence, and the caret stays where it is.Two patterns: solid and cystic) the marker goes before
the colon, as with a comma. At the end of a line the colon introduces the list below it, the
source applies to the list, and the marker goes after the colon:
several patterns are described: <sup>1</sup>.When the caret is next to an existing marker, the number is merged into it:
| existing marker | you cite | result |
|---|---|---|
<sup>2</sup> | 3 | <sup>2,3</sup> |
<sup>2,3</sup> | 4 | <sup>2-4</sup> |
<sup>4,2</sup> | 9 | <sup>2,4,9</sup> |
<sup>2</sup> | 2 | <sup>2</sup>, unchanged |
The marker is rewritten from its list of numbers, so the numbers are also sorted and duplicates are removed.
A superscript without a space before it, such as cm<sup>3</sup>, is an exponent and is left
alone. A superscript that already contains 1,2 or 2-4 is treated as a citation wherever it is.
The script accepts any identifier that radiopaedia.work/cite accepts:
| DOI | 10.3174/ajnr.A3292, doi:10.3174/…, or a doi.org link |
| PMID | 23079405 |
| PMCID | PMC7964488 |
| PII | Elsevier's item identifier, such as S0140-6736(20)30183-5, with or without punctuation |
| ISBN | 9780323393041, with or without hyphens |
| Google Books | a volume id, such as zyTCAlFPjgYC |
| URL | a link to the paper, a Wikipedia page, or any other website |
Any other text is treated as search words. The script first searches the article's references, and offers a search on the citation tool as the last row of the list. Most searches are for a reference the article already has, so return on the first row never sends a web request.
When you paste an identifier and press return, it is sent to radiopaedia.work/cite, which resolves it against Crossref, PubMed, Google Books or Elsevier and returns the formatted citation.
The result is shown before anything is written: the title, journal and year, and below them the full citation with the number it will get. Check that it is the paper you meant, because a mistyped PMID can resolve to a different paper.
Press return again, and the script:
N. …, so the form fields are numbered the way the server expects;<sup>N</sup> at the caret;On a case's edit page the reference is usually not added for you. The lookup, the preview and the number work the same way, but when the script cannot create a new reference box on the case form, it leaves the citation on the clipboard and the panel tells you. Add the reference with the page's own controls, paste it in, and then cite it: the marker is not inserted until the reference is there. When the box can be created, it is filled in and cited as on an article.
N is the next free number: the number of reference boxes or the highest number written in them,
whichever is larger. A number that is already taken would point the marker to the wrong paper, so
the script uses the higher value.
If the reference list is numbered inconsistently (for example 1, 2, 2, 4), the panel shows a
warning along the bottom and uses the number written in front of each reference, not its position
in the list. The script does not renumber the list (see Out of scope).
To cite three papers in one marker, such as <sup>2,5,9</sup>: ⌘⏎
(ctrl⏎ on Windows) adds the selected number to the tray above the search box
and clears the box for the next search. ⏎ cites everything in the tray as one marker, in
order. ⌫ in an empty search box removes the last number from the tray.
The second button, Ω, inserts characters such as ≤, ±, ³, β and →, which otherwise
need the system character palette or a key combination that depends on the keyboard layout.
It uses the same panel, search and return key, with a grid instead of a list. Each character can be
found by the words you would type for it: lt and smaller find <, cm2 finds ², at least
finds ≥, leads to finds →, sd finds ±. Pasting a character finds that character. There are
six groups (maths and comparison, units and fractions, arrows, typography, Greek, signs). The
characters you used recently are shown first, and the list is kept between sessions.
↑↓←→ move through the grid, and ⏎ inserts the
character at the caret. The bottom of the panel shows the name of the selected character, which
helps with characters that look alike, such as ′, ″, ‘ and ’.
| altshiftC | open the citations panel (works from inside the editor) |
| altshiftX | open the characters grid |
| ↑ ↓ | select |
| ⏎ | cite, look up, or confirm a lookup result |
| ⌘⏎ | add to the tray and keep searching |
| ⌫ | in an empty search box: remove the last number from the tray |
| esc | close |
The script inserts the marker through the editor's own input methods. Editors such as TinyMCE keep
their own model of the document and render the page from it. A <sup> added directly to the DOM is
not in that model, and the next time the editor renders, the tag is removed and the number stays in
the text at full size. Typed text is kept, because the editor processes typing.
The script tries these methods in order and stops at the first that works:
| the editor's insert command | mceInsertContent, where the page runs TinyMCE. The marker passes through the editor's schema and goes on its undo stack. |
| typing the number | insertText, then ⌘. (ctrl-. on Windows and Linux) with the number selected, which is the editor's superscript shortcut |
| the browser's command | superscript, for a plain contenteditable without an editor |
| adding the tag directly | a <sup> around the characters just written, when none of the above raised them |
Merging a number into an existing marker also uses typing: the marker's contents are selected and the new list is typed over them, so it stays superscript.
The space before the marker is always written directly, whichever method is used, because
insertText with a space produces a non-breaking space in most browsers, and that would end up as
in the saved article.
The script changes two things, and you can undo both:
<sup> in the editor, which you can select and delete like any other text. On TinyMCE it is
on the undo stack, so ⌘Z removes it;Nothing is saved. The form is not submitted; you still press Save yourself.
The script never edits the text of a reference, including one it has just added. Checking a
reference against the databases is done by the Lint citation chip of
Radiopaedia Lint.
The script sends one request to radiopaedia.work for each lookup you confirm, and a lookup only
happens when you paste an identifier and press return. Reading the existing references needs no
request, because they are in the form. Results are kept for the browser tab, so pasting the same
PMID twice sends one request.
The script first finds the contenteditable that holds the article text, then walks up the page from
it until it reaches an element that contains rows of controls placed before the text. From those
rows it picks the one that contains a heading control. Choosing the largest row would not work:
Radiopaedia's toolbar has four groups, and the largest is the first one (B I x₁ x¹ T̶).
Within that row, the button is placed:
| next to H3 | recognised by its text, or by its accessible label (aria-label, title, data-mce-name) |
| next to H2 or H1 | when H3 is not found |
| at the end of the row | when no heading control is found. On Radiopaedia the headings are at the end of the row. |
| in the corner of the window | when there is no row of controls at all |
The button copies the control next to it: same tag, classes, padding and hover style. Every
attribute except class and style is removed from the copy and from the elements inside it. This
matters because editors bind their commands through data- attributes and ids, and a copy that kept
them would also run the heading command.
The contents of the copy are replaced. Icon toolbars often hide the button's text (with a background
sprite and a text-indent, an icon font and a ::before glyph, or font-size: 0), so a copy with
text written into it could be invisible. The button shows an inline SVG of a number in brackets,
drawn with strokes that do not depend on the page's stylesheet.
No button. Open the browser console. The script prints one line on every edit page it runs on:
[Radiopaedia Cite] v1.5.7 active · /articles/…/edit · editor page: true · editable fields: 1
· buttons: beside H3 · references: 11
The line includes the installed version. Userscript managers check for updates on their own
schedule, so after a release, check that the version is the new one. The script still prints its
old name, Radiopaedia Cite.
radiopaedia.org.editable fields: 0: the script is running but cannot find the editor.buttons: NONE: the script found the text but could not place a button. This should not happen,
because the corner of the window is always available.For other problems, run this in the console:
radiopaediaCite.look()
It prints what the script sees: the version, the editable fields, the toolbar it chose, the names of the controls in that toolbar, and which one it placed the button next to. It does not change anything. Include its output when you open an issue about a missing button.
The output also includes lastMarker, which describes the last marker inserted:
through: which of the methods above wrote it (merge for a number merged into an existing
marker);raised: whether it was superscript when inserted;after: its state half a second later: raised, flat, or gone (removed from the document).after tells apart an editor that did not raise the number from one that raised it and then removed
the tag. The two look the same on screen and need different fixes.
"click in the text first". The panel inserts the marker at the last caret position in the article text. Click in the text, then press the button.
"The citation tool could not be reached" or a Cloudflare notice. Open radiopaedia.work in a tab, complete the check, and try again.
The number was inserted but is not superscript. A message says so when it happens: the editor
accepted the text but not the superscript. Select the number and press x¹. Please open an issue
with the output of radiopaediaCite.look().
The number was inserted as superscript and then returned to full size. The console shows a
warning half a second later. The editor rebuilt the paragraph from its own model, which did not
include the tag. radiopaediaCite.look().lastMarker will show after: "gone" or after: "flat".
Include that, and the editor the page uses, in the issue.
The reference box did not appear. The citation is on the clipboard. Add a box with Radiopaedia's own button and paste it in. The marker is not inserted in this case; cite the reference once it is in the list.
tools/test/ builds a mock edit page (toolbar, contenteditable, reference boxes and an "Add another
reference" button) and runs the real script on it with simulated clicks and key presses, checking
the resulting HTML. The radiopaedia.work response is a saved copy of a real one, so the citation
parser is tested against real output. The tests make no network requests.
./tools/test/run.sh
The tests need Node, and download jsdom on the first run. The userscript has no dependencies and
no build step: you install the file in this repository as it is.
Renumbering. When a reference list is numbered 1, 2, 2, 4, the fix is to renumber the list in
the order the markers appear and rewrite every marker to match. That changes the whole article at
once and is hard to check and to undo. Whether an article's numbering should be changed is also a
decision for Radiopaedia's editors. The script therefore shows a warning when the numbering is
inconsistent and uses the numbers written in front of each reference. If renumbering is added, it
should show a preview of every change before making any.
Links to other articles. Radiopaedia's editor already has a picker for them.
Style checks. Radiopaedia Lint checks the style of references and text. This script handles only numbers and characters, so the two do not give conflicting advice.
There are three settings, at the top of the script:
RANGE_FROM | how many consecutive numbers are closed up into a range. Default 3: 2,3 stays as it is and 2,3,4 becomes 2-4. With 2, a pair is closed up too. |
HOP_PUNCTUATION | whether a caret just after a full stop moves back inside the sentence. Default true. |
CITE_URL | the address of the citation service. |
MIT © Giorgio Maria Agazzi
Not affiliated with Radiopaedia.org. Citations are resolved by radiopaedia.work. This script provides the picker, the numbering and the marker in the text.