executablebooks / mdformat-myst

Mdformat plugin for MyST compatibility
MIT License
7 stars 2 forks source link

myst formatting directive with only 1 parameter #21

Open paugier opened 1 year ago

paugier commented 1 year ago

Context

```{exercise-start}
:label: ex1

is formatted as 
---
label: ex1
---


### Proposal

I think it is too verbose for this case, especially when we have several directives like that in a file.

When there is only 1 parameter, it should be kept with the syntax `:label: ex1`.

### Tasks and updates

_No response_
welcome[bot] commented 1 year ago

Thanks for opening your first issue here! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.
If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).
Welcome to the EBP community! :tada:

welcome[bot] commented 1 year ago

Thanks for opening your first issue here! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.
If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).
Welcome to the EBP community! :tada:

hukkin commented 1 year ago

Thanks for the issue!

Transferred this to mdformat-myst as mdformat core does not format myst directives.

I feel like the current style is best in line with how mdformat typically format's things: strict, simple, consistent. But I know that e.g. @chrisjsewell probably disagrees (see the discussion), and I understand their side as well.

paugier commented 1 year ago

Another case for which really I wish to have the shorter format

```{math}
:label: rayleigh_eq
\varphi'' - k^2 \varphi - \frac{U''}{U-c} \varphi = 0
instead of 
---
label: rayleigh_eq
---
\varphi'' - k^2 \varphi - \frac{U''}{U-c} \varphi = 0


I have files with several equations like that. Two more lines per equation make the whole file much longer and less readable.