Skip to content

Code ​

<Code language="wolfram" value="Binomial[n, k]"> -- a small code box for source in a named language (wolfram, python, javascript, latex, json, glsl, …). Read-only by default (a <pre>), or an editable <textarea> that emits notatio-code-change with { value }. Syntax highlighting is a planned enhancement -- #render is the single seam where a highlighter would turn the value into markup.

packages/components/src/notatio-code.ts

Props

PropTypeDefaultNotes
languagestring""Syntax highlighting to apply, e.g. wolfram, python, javascript, glsl, wgsl.
valuestring""The source text. Editable unless readonly.reflects
readonlybooleantrueShow the code without allowing edits.reflects
rowsnumber0Visible height, in lines.
hideLang
attribute hide-lang
booleanfalseHide the corner language tag, when the form is already indicated elsewhere.

As a web component

Plain custom elements, no framework required: import @enumeratio/frontend for the side effect and write <notatio-code> in any HTML. Attributes are kebab-case and always strings; the props table above names each one's attribute where it differs from its prop.