Public
Edited
Mar 22, 2024
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
readWithLatex(" text ${and code} before $f(x)=x^2$ text and ${code} after ")
Insert cell
Insert cell
Insert cell
readNewCode(" text {{code ${more { `and ${more} ` } code} code}} text")
Insert cell
format.block(`

# Hello {{there}}!
Paragraph
one
- item {{one}}
- sub-{{item}}-1
- sub-{{item}}-2
- sub-{{two}}

## Sub-{{header}}
::: more=\${stuff}
`)
Insert cell
Insert cell
Insert cell
format.block(`<style>

body {
background: \${color};
}

</style>`)
Insert cell
t(`before <style>

body {
background: \${color};
}

</style> after`)
Insert cell
format.block(
`before <style>

body {
background: {{color}};
}

</style> after`
)
Insert cell
t(`before <style>

body {
background: {{color}};
}

</style> after`)
Insert cell
Insert cell
formatAst(ast)
Insert cell
Insert cell
ast = t(text)
Insert cell
viewof retryCount = Inputs.range([1, 100], {
label: "Number of retries:",
step: 1,
value: 1
})
Insert cell
// mdit(text)
Insert cell
Insert cell
format
Insert cell
t = {
const readToken = newMdReader();
return (...args) => {
const startTime = Date.now();
let token;
const count = retryCount;
for (let i = 0; i < count; i++) {
token = readToken(...args);
}
const endTime = Date.now();
token.time = endTime - startTime;
return token;
};
}
Insert cell
tknz
Insert cell
stylesMd
Insert cell
import {
tknz,
newMdReader,
format,
formatInlineAst,
formatAst,
stylesMd
} from "@kotelnikov/statewalker-tknz"
Insert cell
mdit = {
const markdownit = (await import("markdown-it")).default;
const md = markdownit();

return (str) => {
const startTime = Date.now();
let token;
const count = retryCount;
for (let i = 0; i < count; i++) {
token = md.render(str);
}
const endTime = Date.now();
const time = endTime - startTime;
return {
time,
content: token
};
};
}
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more