Learn Before
Relation

Language-Specific Code Blocks / Code Editors

Basic Usage:

Type 3 backticks followed by the name of a programming language to create code blocks / code editors with syntax highlighting for a given language.

For example a Python code block can be created like this:

class PyCodeEditorDemo(object): def __init__(self, var=3.7): self.var = str("function and var are not a python keywords but def, str and return are.") def function(self) -> str: return self.var

Another example using Javascript this time:

function jsCodeEditorDemo(editor) => { var str = "str is not a Javascript keyword but function and var are" console.log(str) return <div>{str}<div/> }

Note: use "js" to highlight Javascript syntax

0

2

Updated 2020-04-05

Tags

1Cademy