Bat: [request/suggestion] Treat Rmarkdown as Markdown

Created on 2 Sep 2018  路  12Comments  路  Source: sharkdp/bat

Apologies for requesting something that I should probably figure out myself -- but couldn't yet ...

bat is so awesome and addictive that I want to work on Rmarkdown files too. You already support Markdown in many variants, so could the .Rmd extension be aliased? These files often contain code snippets, predominantly in R though other languages are supported as well. Some tools such as Emacs polymode cover both and switch -- that is too much too ask here. But it would be really really nice to see the standard text markup in .Rmd rendered as Markdown.

Thanks for considering this.

duplicate question

All 12 comments

Thank you for your feedback!

You could try to follow the steps in the README concerning customization and add something like this Sublime Text package.

Let me know if that works for you!

I saw those hints but backed off as I think I want something simpler. Ie in

edd@rob:~$ bat --list-languages | grep markdown
Markdown                  md, mdown, markdown, markdn
edd@rob:~$ 

I "merely" want another trigger for files ending in .Rmd to also get the existing markdown treatment. That should be simpler than adding a whole language definition, no?

That should be simpler than adding a whole language definition, no?

Yes. In this case, this request is a duplicate of #169.

Apologies, did not spot that when I was looking for '*markdown' topics.

No worries :+1:

This is now supported in v0.8.0. Add this to your config file:

--map-syntax Rmd:md

Works nicely!

Could you maybe add a default config file in the .deb and other packages?

Thank you for checking!

What would you expect from such a default config file?

The way things usually work (and "usually" for me means from a .deb, or from source) is that the binary either has default beahviour baked in, or ships with (or install) a resource file, or both.

Here, in order to see Rmd content, I had to create a new directory (bat worked fine before), look through help outout to learn how to have it write a config stanza and then add the line you recommended in your post from two days ago. Not terrible, simply more manual than usual.

You could just ship a sample config file, and/or post one on the website. I didn't add anything besides that line (and a theme setting).

Am I making sense to you, or are we on different wavelength here?

I think we should definitely add more documentation on how bats configuration file works. I didn't want to add this to the README until #367 is fixed.

I'm not sure if I want to ship a "default" config with bat, but we could certainly add an example config file to the README. The bat --config-file command shows you the path to the configuration file, but it's currently a "hidden feature". Maybe we should make this visible.

Visible is good. Right now it is a weeee bit hidden.

Tracking here: #377

Was this page helpful?
0 / 5 - 0 ratings

Related issues

HakubJozak picture HakubJozak  路  3Comments

tomgoren picture tomgoren  路  3Comments

samuelcolvin picture samuelcolvin  路  3Comments

niedzielski picture niedzielski  路  3Comments

adamtabrams picture adamtabrams  路  3Comments