An open API service indexing awesome lists of open source software.

https://github.com/coolreader18/github-markdown-syntax

An easy way to syntax highlight any language supported by GitHub into HTML.
https://github.com/coolreader18/github-markdown-syntax

Last synced: 27 days ago
JSON representation

An easy way to syntax highlight any language supported by GitHub into HTML.

Awesome Lists containing this project

README

          

# github-markdown-syntax
An easy way to syntax highlight any language supported by GitHub into HTML.

## Installation
```bash
yarn add github-markdown-syntax
# or
npm i github-markdown-syntax
```

## Usage
```js
const GFMSyntax = require("github-markdown-syntax");
GFMSyntax([
{
code: 'console.log("Hello World!");',
lang: "js"
},
{
code:
`edit : main.o kbd.o command.o display.o \
insert.o search.o files.o utils.o
cc -o edit main.o kbd.o command.o display.o \
insert.o search.o files.o utils.o

main.o : main.c defs.h
cc -c main.c
kbd.o : kbd.c defs.h command.h
cc -c kbd.c
command.o : command.c defs.h command.h
cc -c command.c`, // from https://www.gnu.org/software/make/manual/html_node/Simple-Makefile.html
lang: "makefile"
},
{
code:
`ScriptName MyFirstScript extends Quest
{This is my first script.
It prints the message "Hello, World!" to the screen once.}

Event OnInit()
Debug.Notification("Hello, World!")
EndEvent`, // just random languages taken from linguist/linguist/grammars.yml,
// code from http://www.cipscis.com/skyrim/tutorials/beginners.aspx
lang: "papyrus"
},
{
code:
`: main[ -- ]
me @ "Hello world!" notify
exit
;`,
lang: "muf"
}
]).then(console.log); // logs:
[ '

console.log("Hello World!");
',
'
edit : main.o kbd.o command.o display.o        insert.o search.o files.o utils.o\n        cc -o edit main.o kbd.o command.o display.o                    insert.o search.o files.o utils.o\n\nmain.o : main.c defs.h\n        cc -c main.c\nkbd.o : kbd.c defs.h command.h\n        cc -c kbd.c\ncommand.o : command.c defs.h command.h\n        cc -c command.c
',
'
ScriptName MyFirstScript extends Quest\n{This is my first script.\nIt prints the message "Hello, World!" to the screen once.}\n\nEvent OnInit()\n\tDebug.Notification("Hello, World!")\nEndEvent
',
'
: main[ -- ]\nme @ "Hello world!" notify\nexit\n;\n
' ]
```

## License
This project is licensed under the MIT license. For more information, see the [LICENSE](LICENSE) file.