jgm/djot

Normalize names of inline/block flavors

matklad opened this issue · 2 comments

Right now we have

code_block
verbatim
raw_block
raw_inline
inline_math
display_math

This is highly inconsistent (it took awhile for me today to find an inline version for code block). Perhaps we should normalize the terms to

verbatim_block
verbatim_inline

raw_block
raw_inline

math_block
math_inline
jgm commented

I'm with you on verbatim_block.

Less sure about the math case. Display math is often not regarded as a separate block; it is a part of the paragraph content (inline), but it is presented in a special way. So e.g. in LaTeX you can write

Einstein show that $$e=mc^2$$, but ....

and you have a displayed equation that is part of a paragraph.

One option would be to just have math and add a boolean parameter for display.

Ah, right, math is extra confusing because both inline_math and display_math are inline in terms of djot syntax, inline in inline_math is a false friend.

A Boolean parameter indeed seems appropriate here! Or maybe

type MathStyle = “inline” | “display”
interface Math extends HasAttributes {
  tag: "math";
  style: MathStyle;
  text: string;
}