executablebooks / markdown-it-docutils

A markdown-it plugin for implementing docutils style roles/directives.
https://executablebooks.github.io/markdown-it-docutils/
MIT License
12 stars 9 forks source link

Flag directive options should resolve to something truthy? #43

Open rowanc1 opened 2 years ago

rowanc1 commented 2 years ago

In a directive, setting an option_spec to directiveOptions.flag will result in the result being null if the flag is set. This is strange, as the flag is truthy.

Passing this onto mdast currently requires, for example,

const mdastOptions = {
  open: t.meta.open === null || undefined,
};

Ideally the value coming out of this library is truthy for a "flag". It would also be great to have the flag be able to be set with a "true" in the markup.

```{dropdown}
:open: true


Currently this gets parsed into a directive error, see #42.