
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
@loopmode/codeblock
Advanced tools
A react component for code highlighting - based on prismjs
This is a simple wrapper around prismjs. Some of its main goals:
prismjs, but without bloating the final bundle with unused onesyarn add @loopmode/codeblock
# or
npm install --save @loopmode/codeblock
import() syntax - we only load what's needed from prismjs, dynamicallyIf you want to use the URL-based loader via src prop in older browsers, you should either provide a window.fetch polyfill or your own loadExternal function that doesn't require window.fetch.
Note: In case your project is based on a recent version of create-react-app, you're good to go!
import React from 'react';
import Codeblock from '@loopmode/codeblock'
export default function CodeblockExamples() {
return (
<Codeblock>{`
class Foo {
constructor(value) {
this.value = value;
}
}
const a = new Foo('a');
const b = new Foo('b');
`}</Codeblock>
);
}
import React from 'react';
import Codeblock, { Code } from '@loopmode/codeblock'
export const Examples = () => (
<>
{/* load external content via src prop */}
<Codeblock src="http://my-website.com/my-file.js" />
{/* specify language and/or theme props */}
<Codeblock language="python" theme="twilight">
{'import base64, sys; base64.decode(open(sys.argv[1], "rb"), open(sys.argv[2], "wb"))'}
</Codeblock>
{/* inline styling */}
<p>We can use inline code: <Codeblock inline>const foo = 'foo'</Codeblock><p>
<p>Alternatively, use the Code component: <Code>const foo = 'foo'</Code><p>
</>
)
FAQs
React component to highlight code using prismjs
The npm package @loopmode/codeblock receives a total of 3 weekly downloads. As such, @loopmode/codeblock popularity was classified as not popular.
We found that @loopmode/codeblock 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
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.