SilasBerger / teaching-website

My teaching website 👨‍🏫
https://teach.silasberger.ch
1 stars 0 forks source link

Create shorthand for DefinitionList #24

Open SilasBerger opened 7 months ago

SilasBerger commented 7 months ago
:::DefList
  <dt>Some title</dt>
  <dd>Some text</dd>
  <dd>Some more text</dd>
::

or

:::DefList
:::DT
Some title
::DD
Some text
::DD
Some more text
SilasBerger commented 7 months ago

Probably start with the first option: it's quicker to implement and looks cleaner. If the HTML syntax becomes too tedious, we can always add shorthands for <dt> and <dd>.

lebalz commented 7 months ago

What do you think about the Pandoc syle of deflists?:

Definition
: Foobar
: BooCar
Def2
: FizzBuzz

results in

<dl>
  <dt>Definition</dt>
  <dd>Foobar</dd>
  <dd>BooCar</dd>
  <dt>Def2</dt>
  <dd>FizzBuzz</dd>
</dl>

For this kind i already wrote a plugin: https://github.com/lebalz/ofi-blog/tree/docusaurus-v3/src/plugins/remark-deflist

SilasBerger commented 7 months ago

What do you think about the Pandoc syle of deflists?:

Definition
: Foobar
: BooCar
Def2
: FizzBuzz

results in

<dl>
  <dt>Definition</dt>
  <dd>Foobar</dd>
  <dd>BooCar</dd>
  <dt>Def2</dt>
  <dd>FizzBuzz</dd>
</dl>

For this kind i already wrote a plugin: https://github.com/lebalz/ofi-blog/tree/docusaurus-v3/src/plugins/remark-deflist

Very nice, I like that a lot! Might be a somewhat rare case, but can it handle hard line breaks like

Def
inition
: Fo
obar
: Bo
oCar
Def2
: Fi
zzBuzz

I'm asking because I'm currently in the mode of trying to fit my MD code nicely into the editor using hard breaks (although I may give up on that soon, since it's a pain if you need to edit a paragraph 😆 )

lebalz commented 7 months ago

Not directly, only if you add a colon on the start of the next line (so an even bigger pain when you need to edit a paragraph, but still possible)

Def
inition
: Fo
: obar
: Bo
: oCar
Def2
: Fi
; zzBuzz

For the first "Def\n inition" i think its possible but looks like a hack - and i guess this usecase is pretty rare anyway?