Information
- Language:
TOML
- Plugins:
none
Description
Prism create punctuation element for [[section]] in toml
Code snippet
App.js
import React from "react";
import Prism from "prismjs";
import "prismjs/components/prism-toml";
const App = () => {
return (
<PrismCode language="toml">
{`[[redirects]]
from = ""
to = ""
status = 301`.trim()}
</PrismCode>
);
};
export default class PrismCode extends React.Component {
constructor(props) {
super(props)
this.ref = React.createRef()
}
componentDidMount() {
this.highlight()
}
componentDidUpdate() {
this.highlight()
}
highlight = () => {
if (this.ref && this.ref.current) {
Prism.highlightElement(this.ref.current)
}
}
render() {
const { children, plugins, language } = this.props
console.log(children);
return (
<pre className={!plugins ? "" : plugins.join(" ")}>
<code ref={this.ref} className={`language-${language}`}>
{children}
</code>
</pre>
)
}
}
it render :

Information
TOMLnoneDescription
Prism create punctuation element for
[[section]]in tomlCode snippet
App.js
it render :
