hackmdio / codimd

CodiMD - Realtime collaborative markdown notes on all platforms.
https://hackmd.io/c/codimd-documentation
GNU Affero General Public License v3.0
9.3k stars 1.06k forks source link

Makefile syntax highlight #401

Open yangyang95 opened 7 years ago

yangyang95 commented 7 years ago

It would be great if makefile highlighting is supported in code block.

a60814billy commented 7 years ago

Thanks @yangyang95 Makefile is popular format , we will support it.

yangyang95 commented 7 years ago

That's a good news. Thanks a lot.

jackycute commented 7 years ago

I found we have already support makefile syntax highlighting. Please use cmake in the code block language.

yangyang95 commented 7 years ago

This is what I got using cmake, code block at right doesn't display properly. make 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.

jackycute commented 7 years ago

@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.

jackycute commented 7 years ago

Changed in b2985085d011cad374c76ae75f548fdefb15c258

yangyang95 commented 7 years ago

Oh, mind that cmake and makefile seems to be different. Though I had no idea, since I have never used cmake. reference:

jackycute commented 7 years ago

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.

jackycute commented 7 years ago

This might able to give us some hint https://github.com/notepadqq/CodeMirror/blob/d790fc39c1a5f06aa66415110b8ebe3026df665a/mode/makefile/makefile.js

wdzeng commented 2 years ago

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: image

While in production view mode, it looks like this: image