GeezerVison is showing tiptap.dev — Code and math | Tiptap Docs
When you use them
- Code samples. Code block adds fenced code blocks, wrapped in
pre and code tags.
- Highlighted code. Code block lowlight adds code blocks with syntax highlighting from the lowlight library.
- Formulas. Mathematics inserts LaTeX formulas, inline in a line of text or as a block, and renders them with KaTeX.
How they work
- They are nodes. Code blocks and math formulas are nodes in the document. Mathematics adds two of them, one for inline math and one for block math. Nodes and marks
- Code block comes with the StarterKit. Code block is part of the StarterKit; Code block lowlight and Mathematics you add yourself.
- Highlighting is separate. Code block has no styling and no syntax highlighting. Code block lowlight highlights code, and you pass it the
lowlight module with the languages you load.
- Mathematics needs KaTeX. You install
katex with the extension and import the KaTeX styles.
- Markdown shortcuts. Typing three backticks and a space starts a code block. Add a language after the backticks, such as
css, to set it.
Related
- Text formatting includes the Code mark for a name or a command inside a sentence.
- Text blocks are the paragraphs and headings around your code.