
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
remark-marginnotes
Advanced tools
A Remark plugin to handle margin note (side note) definitions and references.
A Remark plugin to parse inline footnote definitions and references, transforming them into nodes suitable for creating accessible margin notes, often styled like Tufte sidenotes. Includes Rehype handlers for HTML conversion.
This package provides a unified (Remark) plugin that finds footnote definitions written inline immediately following their first reference. Standard Markdown footnotes require definitions to be placed at the bottom of the document. This plugin allows a syntax like:
Some text with a reference [+note1].
[+note1]: This is the definition for the first note. It appears right here in the source.
Some more text, maybe referencing the same note again [+note1] or a new one [+note2].
[+note2]: This is the second note.
It transforms these into custom MDAST nodes (asideFootnoteReference, asideFootnoteDefinition). When used with remark-rehype and the included handlers, it generates HTML suitable for styling as inline tooltips, sidenotes, or margin notes.
npm install remark-marginnotes
import { unified } from 'unified';
import remarkParse from 'remark-parse';
import remarkMarginnotes, { rehypeMarginnotesHandlers } from 'remark-marginnotes';
import remarkRehype from 'remark-rehype';
import rehypeStringify from 'rehype-stringify';
import { VFile } from 'vfile';
const markdown = `
This is some text with a reference[+ref1].
[+ref1]: This is the definition for the first reference.
Here is another reference [+ref2].
[+ref2]: And its definition. Note that this is the *first* appearance.
You can reference the first one again [+ref1].
`;
async function processMarkdown() {
const file = await unified()
.use(remarkParse)
.use(remarkMarginnotes) // Use the remark plugin
.use(remarkRehype, {
// Pass the handlers to remark-rehype
handlers: rehypeMarginnotesHandlers
})
.use(rehypeStringify)
.process(new VFile({ path: 'input.md', value: markdown }));
console.log(String(file));
}
processMarkdown();
[+identifier]
[+note-1], [+figure_a].[+identifier]: Definition text...
:), optionally separated by whitespace.Given the Markdown in the Use section, the approximate HTML output would be:
<p>This is some text with a reference</p>
This plugin outputs semantic HTML with specific classes and ARIA attributes, but provides no CSS. You need to style it yourself.
.aside-footnote-ref-wrapper: The <sup> wrapping the reference link..aside-footnote-ref: The <a> link for the reference number (e.g., [1])..aside-footnote-def: The <span> containing the definition..aside-footnote-number: The <span> containing the number within the definition (e.g., 1.)..aside-footnote-backref: The <a> link (↩) inside the definition pointing back to the first reference..hidden: Class for the accessible label inside the definition span. You should hide this visually (e.g., using common sr-only CSS techniques).FAQs
A Remark plugin to handle margin note (side note) definitions and references.
The npm package remark-marginnotes receives a total of 3 weekly downloads. As such, remark-marginnotes popularity was classified as not popular.
We found that remark-marginnotes demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.