[react] feat: Added docs for components/Highlight
This commit is contained in:
parent
05ea157ef9
commit
32d08c923c
4 changed files with 40 additions and 10 deletions
|
@ -12,13 +12,17 @@ const defaultTitles = {
|
|||
/**
|
||||
* A React component to highlight code
|
||||
*
|
||||
* @params {object} props - All React props
|
||||
* @params {string} language - The language to highlight
|
||||
* @params {object} children - The React children
|
||||
* @params {bool} raw - Set this to true to not escape tags
|
||||
* @params {string} title - Title for the highlight
|
||||
* @params {string} copy - Content to copy to clipboard
|
||||
* @params {bool} noCopy - Do not add copy to clipboard
|
||||
* @component
|
||||
* @param {object} props - All React props
|
||||
* @param {string} [props.language = 'txt'] - The language to highlight
|
||||
* @param {JSX.Element} props.children - The React children (this is the code to highlight)
|
||||
* @param {bool} [props.raw = false] - Set this to true to not escape tags
|
||||
* @param {string} [props.title = false] - Title for the highlight. When
|
||||
* language is js, bash, sh, json, or yaml the title will be set accordingly
|
||||
* (but you can still pass in a custom one)
|
||||
* @param {string} [props.copy = props.children] - Content for the copy to clipboard button, by default this will use props.children
|
||||
* @param {bool} [props.noCopy = false] - Set this to true to not add the copy to clipboard button
|
||||
* @returns {JSX.Element}
|
||||
*/
|
||||
export const Highlight = ({
|
||||
language = 'txt',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue