edulinq / quizgen

MIT License
4 stars 0 forks source link

General Styling in Parsed Strings (Text) #35

Open eriq-augustine opened 6 months ago

eriq-augustine commented 6 months ago

We want to create some ability to style text that is in parsed strings. The most critical styling is the size (width) of images.

eriq-augustine commented 6 months ago

I have some general plans on this.

We can introduce the concept of a "block". A block is just a section of a parsed string that has a common style. A sections in a document start in a default/root block. You can define subblocks and nest as deep as you want. (Block do not have any names/ids associated with them.)

Styling information can be associated with each block. Styling entries from subblocks override entries of the same key from outer blocks. Inner blocks can also cancel a parent's style (and revert to default behavior) by setting a key to null.

Style can be set at a quiz, group, question, or block level. The semantics will be the same as block/subblocks: quiz -> group -> question -> block -> subblock*.

Use JSON (maybe even more simplified) syntax for styling rules.

To denote a block, we can use {- -}. (I would have liked to use < > since we do not allow HTML, but block quotes use >.) To denote a style section, we can use {{ }}.

In the documentation for styling, note that for fined grained control a user can just edit the output (tex, html, etc) directly.

Note that for images, we will only allow sizes relative to the container (not absolute or relative to the original size).