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.
@mapbox/babel-plugin-transform-jsxtreme-markdown
Advanced tools
Transform Markdown interpolated with JS expressions and JSX elements at compile time
Transform Markdown interpolated with JS expressions and JSX elements into pure JSX, at compile time.
Uses jsxtreme-markdown to compile the interpolated Markdown.
For more information about jsxtreme-markdown features, read the README at the root of this monorepo.
npm install @mapbox/babel-plugin-transform-jsxtreme-markdown
Transforms a special tagged template literal.
require
or import
the (fake) package '@mapbox/babel-plugin-transform-jsxtreme-markdown/md'
, or whatever you've specified as packageName
in your Babel options.
Then use that (fake) module's export as a template literal tag, marking the template literals you'd like to be compiled at run time.
If React
is not already in the file's top-level scope, var React = require('react');
will be added to the beginning of the file.
// Input
const md = require('@mapbox/babel-plugin-transform-jsxtreme-markdown/md');
const foo = md`
# Title
This is **bold.**
Here is a [link](/some/url).
`;
// Output
('use strict');
var React = require('react');
var foo = (
<div>
<h1>Title</h1>
<p>
This is <strong>bold.</strong>
Here is a <a href="/some/url">link</a>.
</p>
</div>
);
Because this plugin uses jsxtreme-markdown, you can also interpolate JS expressions and JSX elements within special delimiters. Read more about this in the jsxtreme-markdown docs.
// Input
import md from '@mapbox/babel-plugin-transform-jsxtreme-markdown/md';
const text = md`
This is a paragraph {{<span className="foo">}} with a **markdown** span inside {{</span>}}
{{ <div style={{ margin: 70 }}> }}
And here is a _paragraph_ inside a div.
[Link](/some/url)
{{ </div> }}
`;
// Output
('use strict');
var React = require('react');
var text = (
<div>
<p>
This is a paragraph{' '}
<span className="foo">
{' '}
with a <strong>markdown</strong> span inside{' '}
</span>
</p>
<div style={{ margin: 70 }}>
And here is a <em>paragraph</em> inside a div.
<a href="/some/url">Link</a>
</div>
</div>
);
You can pass any of the options available to jsxtremeMarkdown.toJsx
.
Additional options:
Type: string
.
Default: '@mapbox/babel-plugin-transform-jsxtreme-markdown/md'
.
The name of the package that you will require
or import
to use this thing.
For example, with the value 'xtreme-markdown'
you should use
import md from 'xtreme-markdown';
FAQs
Transform Markdown interpolated with JS expressions and JSX elements at compile time
The npm package @mapbox/babel-plugin-transform-jsxtreme-markdown receives a total of 58 weekly downloads. As such, @mapbox/babel-plugin-transform-jsxtreme-markdown popularity was classified as not popular.
We found that @mapbox/babel-plugin-transform-jsxtreme-markdown demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 28 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
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.