codimd
codimd copied to clipboard
Makefile syntax highlight
It would be great if makefile highlighting is supported in code block.
Thanks @yangyang95 Makefile is popular format , we will support it.
That's a good news. Thanks a lot.
I found we have already support makefile syntax highlighting.
Please use cmake in the code block language.
This is what I got using cmake, code block at right doesn't display properly.
And it would be better if the code display same as the Prism which I know hackmd is using.
Attached the code here for testing
ifeq ($(strip $(THREAD_TEST)),1)
CFLAGS_opt += -D THREAD_TEST
endif
thread_test: main.c
for i in `seq 1 128`; \
do $(MAKE) phonebook_opt THREAD_TEST=1 THREAD=$$i --silent; \
./phonebook_opt; echo "\n"; \
rm -rf phonebook_opt; \
done;
And I found out github display it good, too. lol Thanks.
@yangyang95 Actually we use both highlight.js and Prism both for different code languages.
Shame on highlight.js not handle that properly, you could raise a issue for them.
I will change the cmake highlighting to Prism for now.
Changed in b2985085d011cad374c76ae75f548fdefb15c258
Oh, mind that cmake and makefile seems to be different. Though I had no idea, since I have never used cmake.
reference:
- Difference between using Makefile and cmake to compile the code
- Cmake vs make sample codes?
No wonder
hightlight.jscan't display properly.
Hmm, but our editor CodeMirror seems only support cmake in the official release.
highlight.js supports cmake and makefile.
Prism supports only makefile.
This should be consider again.
This might able to give us some hint https://github.com/notepadqq/CodeMirror/blob/d790fc39c1a5f06aa66415110b8ebe3026df665a/mode/makefile/makefile.js
Makefile highlighting has different appearances in editor view mode and in production view mode.
Here is the code for testing:
```makefile $(CC) -c $(CPPFLAGS) $(CFLAGS) ```
In editor view mode, it looks like this:

While in production view mode, it looks like this:
