codehike icon indicating copy to clipboard operation
codehike copied to clipboard

Enhancement: Determine syntax highlighting based on filename on Codeblocks

Open brianespinosa opened this issue 3 years ago • 4 comments

It would be great if when defining a codeblock and putting a filename, that our codeblocks could determine the language for syntax highlighting based on the filename alone.

This of course might be challenging if codeblocks are looking for these frontmatter values in an array.

brianespinosa avatar May 16 '22 17:05 brianespinosa

Do you mean

``` hello.py
print("Hello, world!")
```

should be highlighted as python? Or you have something different on your mind?

pomber avatar May 16 '22 17:05 pomber

@pomber yes, that is 100% what I am thinking.

brianespinosa avatar May 18 '22 17:05 brianespinosa

can you find/build a map from filename to language? I'll be happy to add the logic to the code

pomber avatar Jun 21 '22 11:06 pomber

This might be more than we need relative to available language syntax highlighting... but I think we might be able to start with this? https://gist.github.com/ppisarczyk/43962d06686722d26d176fad46879d41

brianespinosa avatar Jul 29 '22 18:07 brianespinosa