mirror of
https://github.com/phuoc-ng/csslayout.git
synced 2025-08-06 22:26:33 +02:00
Add SampleCode component
This commit is contained in:
@@ -6,7 +6,7 @@ const SampleCode = ({ code, lang }) => {
|
|||||||
return code === ''
|
return code === ''
|
||||||
? <></>
|
? <></>
|
||||||
: (
|
: (
|
||||||
<pre className="lh-copy mh0 mv3" dangerouslySetInnerHTML={{ __html: highlight(code, lang) }} />
|
<pre className="h-100 lh-copy ma0" dangerouslySetInnerHTML={{ __html: highlight(code, lang) }} />
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -5,7 +5,7 @@ const highlight = (input, language) => {
|
|||||||
const { value } = hljs.highlight(lang, input);
|
const { value } = hljs.highlight(lang, input);
|
||||||
const highlighted = value.replace('&', '&').trim();
|
const highlighted = value.replace('&', '&').trim();
|
||||||
|
|
||||||
return `<code class="hljs ${lang}">${highlighted}</code>`;
|
return `<code class="hljs h-100 ${lang}">${highlighted}</code>`;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default highlight;
|
export default highlight;
|
||||||
|
Reference in New Issue
Block a user