
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.
@yozora/react-code
Advanced tools
This component is for rendering the Code data produced by
@yozora/tokenizer-indented-code and @yozora/tokenizer-fenced-code.
This component has been built into @yozora/react-markdown, you can use it directly.
npm
npm install --save @yozora/react-code
yarn
yarn add @yozora/react-code
Basic:
import React from 'react'
import Code from '@yozora/react-code'
const wrapper = (
<Code
lang="typescript"
value="let a: number = 1 + 2;"
/>
)
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
className | string | false | - | Root css class |
darken | boolean | false | - | Enable the darken mode |
lang | string | false | - | Language of the source codes |
meta | string | false | - | Meta data of the code block |
showCodeLineno | boolean | false | true | Display linenos in default |
runners | CodeRunnerItem[] | false | See below | Code runners. |
style | React.CSSProperties | false | - | Root css style |
value | string | true | - | Literal source codes |
runners:
import JsxRenderer from '@yozora/react-code-renderer-jsx'
const defaultRunners: CodeRunnerItem[] = [
{
title: 'jsx',
pattern: /^jsx$/,
runner: function JsxRunner(props: CodeRunnerProps): React.ReactElement {
const { value, scope, onError } = props
return (
<JsxRenderer
code={value}
inline={true}
scope={scope}
onError={onError}
/>
)
},
},
]
meta:
import type { ICodeMetaData as IBaseCodeMetaData } from '@yozora/core-react-renderer'
import type { ICodeRunnerItem, ICodeRunnerMetaData } from '@yozora/react-code-runners'
/**
* Meta data of the fenced-code.
*/
export interface ICodeMetaData extends IBaseCodeMetaData, ICodeRunnerMetaData {
/**
* Rendering mode.
*/
_yozoracodemode: 'live' | 'embed' | 'literal' | string
}
FAQs
render markdown code in react
We found that @yozora/react-code demonstrated a healthy version release cadence and project activity because the last version was released less than 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
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.