0.1.5 • Published 9 months ago

@phase2/outline-code-block v0.1.5

Weekly downloads
-
License
BSD-3-Clause
Repository
github
Last release
9 months ago

outline-code-block

The OutlineCodeBlock component

Properties

PropertyAttributeTypeDefaultDescription
codecodestring"Hello World"The code snippet to be displayed - default 'Hello World'
codeSlotHTMLElement
formatCode() => string"() => {\n if (\n this.language.toLowerCase() === 'jsx' ||\n this.language.toLowerCase() === 'html'\n ) {\n return this.innerHTML;\n } else {\n return this.textContent!;\n }\n }"
languagelanguageCodeLanguages"typescript"Language of code block - default 'typescript''css' | 'graphql' | 'html' | 'javascript' | 'json' | 'markdown' | 'reactjsx' | 'reacttsx' | 'svg' | 'typescript' | 'xml'
lineNumbersline-numbersbooleanWhether or not to display the line numbers for code block
prismCodeLookup() => string"() => {\n let prismCode = '';\n\n switch (this.language) {\n case 'css':\n prismCode = Prism.highlight(this.code, Prism.languages.css, 'css');\n break;\n case 'graphql':\n prismCode = Prism.highlight(\n this.code,\n Prism.languages.graphql,\n 'graphql'\n );\n break;\n case 'html':\n prismCode = Prism.highlight(this.code, Prism.languages.html, 'html');\n break;\n case 'javascript':\n prismCode = Prism.highlight(\n this.code,\n Prism.languages.javascript,\n 'javascript'\n );\n break;\n case 'json':\n prismCode = Prism.highlight(this.code, Prism.languages.json, 'json');\n break;\n case 'markdown':\n prismCode = Prism.highlight(\n this.code,\n Prism.languages.markdown,\n 'markdown'\n );\n break;\n case 'jsx':\n prismCode = Prism.highlight(this.code, Prism.languages.jsx, 'jsx');\n break;\n case 'tsx':\n prismCode = Prism.highlight(this.code, Prism.languages.tsx, 'tsx');\n break;\n case 'svg':\n prismCode = Prism.highlight(this.code, Prism.languages.svg, 'svg');\n break;\n case 'typescript':\n prismCode = Prism.highlight(\n this.code,\n Prism.languages.typescript,\n 'typescript'\n );\n break;\n case 'xml':\n prismCode = Prism.highlight(this.code, Prism.languages.xml, 'xml');\n break;\n\n default:\n break;\n }\n return prismCode;\n }"
templateHTMLElement
0.1.4

10 months ago

0.1.3

10 months ago

0.1.5

9 months ago

0.1.2

12 months ago

0.1.1

1 year ago

0.1.0

2 years ago

0.0.2

2 years ago

0.0.4

2 years ago

0.0.1

2 years ago