mdformat icon indicating copy to clipboard operation
mdformat copied to clipboard

Configure default language for fenced code blocks

Open varac opened this issue 1 year ago • 1 comments

Context

When reformatting indented code blocks, I'd like to have an option to set the default language added to the fenced code block that mdformat creates. I habe a lot of old documentation with indeded code blocks, and 99% of them are sh lang, which I manually need to add after reformatting.

Proposal

Add an option to the config file like:

fenced_lang = sh

Which will automatically use

```sh 

instead of

```

when reformatting indented code blocks.

Tasks and updates

No response

varac avatar May 05 '24 06:05 varac

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] avatar May 05 '24 06:05 welcome[bot]

Hey thanks for the issue!

I don't think this is a generally useful enough feature to be added. I think mdformat should be helpful to you anyways: run it to normalize all code blocks, and then it should be fairly trivial to come up with a sed script to add the sh language tags.

hukkin avatar Oct 18 '24 11:10 hukkin