jgm / djot

A light markup language
https://djot.net
MIT License
1.71k stars 43 forks source link

Normalize names of inline/block flavors #225

Open matklad opened 1 year ago

matklad commented 1 year ago

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 1 year ago

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.

matklad commented 1 year ago

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;
}