Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

README.MD is not recognized as markdown #807

Closed
HakubJozak opened this issue Jan 20, 2020 · 3 comments
Closed

README.MD is not recognized as markdown #807

HakubJozak opened this issue Jan 20, 2020 · 3 comments
Labels
question Further information is requested syntax-highlighting

Comments

@HakubJozak
Copy link

README.MD is not recognized as markdown while README.md is. I suppose there is a case sensitive pattern for checking the file extension. Is it a bug or a feature?

I am willing to submit a PR but I am not Rust developers so pointers to the right lines would be appreciated ;)

@eth-p
Copy link
Collaborator

eth-p commented Jan 20, 2020

I can confirm this bug.

I believe the issue is caused by how Sublime syntaxes specify their applicable file extensions. The highlighting library used by bat (Syntect) determines the syntax for a file extension using a case-sensitive comparison. I'm not sure if the Sublime syntax file_extensions field is intended to be case-insensitive or not, but depending on the answer to that, either Syntect or sublimehq/Packages is doing something incorrectly.

Unfortunately, it looks like the Markdown syntax file that we use only specifies lowercase file extensions. I'm not sure how @sharkdp would prefer to handle it, but there's a couple options that I can think of:

  1. Include --map-syntax MD:md in your bat config file.
    This can be done without any changes to bat or the Sublime Packages repository.

  2. Create a patch file for the Markdown syntax and patch it during the build process.
    While it could work, I don't think it's an ideal solution.

  3. Create an upstream issue about it.

@eth-p eth-p added bug Something isn't working syntax-highlighting labels Jan 20, 2020
@sharkdp
Copy link
Owner

sharkdp commented Jan 20, 2020

@HakubJozak Thank you for your feedback.

I'm not sure if the Sublime syntax file_extensions field is intended to be case-insensitive or not, but depending on the answer to that, either Syntect or sublimehq/Packages is doing something incorrectly.

Third possible option: the uppercase .MD file extension should not really be supported because it's non standard(?).

I think it's correct that the file_extensions field is case-sensitive. The field is also use to match against full filenames, and some of these are case-sensitive (PKGBUILD, CMakeLists.txt, Dockerfile). Apparently, there are also some file extensions which are case-sensitive (.M for Objective C, see https://en.wikipedia.org/wiki/Objective-C).

So if this should be fixed, it has to be added to the Markdown syntax file.

@sharkdp sharkdp added question Further information is requested and removed bug Something isn't working labels Feb 28, 2020
@sharkdp
Copy link
Owner

sharkdp commented Feb 28, 2020

I'm going to close this for now. @HakubJozak If you feel that .MD should be supported, please open a bug report at https://github.com/sublimehq/Packages

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested syntax-highlighting
Projects
None yet
Development

No branches or pull requests

3 participants