Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
mdx-annotations
Advanced tools
npm install mdx-annotations
To maximise compatibility mdx-annotations
is provided as three separate plugins that must be used together:
import { compile } from '@mdx-js/mdx'
import { mdxAnnotations } from 'mdx-annotations'
let mdx = `# Hello, world! {{ id: 'intro' }}`
await compile(mdx, {
remarkPlugins: [mdxAnnotations.remark],
rehypePlugins: [mdxAnnotations.rehype],
recmaPlugins: [mdxAnnotations.recma],
})
Note
It is recommended to include each plugin first in their respective plugin arrays.
An annotation is a JavaScript object associated with an MDX node. The object properties are passed to the resulting JSX element as props.
Input:
# Hello, world! {{ id: 'intro' }}
Output:
<h1 id="intro">Hello, world!</h1>
# Hello, world! {{ id: 'intro' }}
## Hello, world! {{ id: 'intro' }}
### Hello, world! {{ id: 'intro' }}
#### Hello, world! {{ id: 'intro' }}
- Hello, world! {{ id: 'intro' }}
When a list item contains multiple children the annotation is attached to the child:
Input:
- Hello, world! {{ className: 'text-lg' }}
Lorem ipsum {{ className: 'text-sm' }}
Output:
<ul>
<li>
<p className="text-lg">Hello, world!</p>
<p className="text-sm">Lorem ipsum</p>
</li>
</ul>
```{{ title: 'Example' }}
Hello, world!
```
```php {{ title: 'Example' }}
echo 'Hello, world!';
```
--- {{ className: 'my-10' }}
*** {{ className: 'my-10' }}
To annotate an inline element ensure that there is no whitespace between the element and the annotation:
**Hello world**{{ className: 'text-red-500' }}
_Hello world_{{ className: 'text-red-500' }}
`Hello world`{{ className: 'text-red-500' }}
[Hello world](#){{ className: 'text-red-500' }}
![](/img.png){{ className: 'object-cover' }}
FAQs
Markdoc-style annotations for MDX
We found that mdx-annotations demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.