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.
- Host: GitHub
- URL: https://github.com/coolreader18/github-markdown-syntax
- Owner: coolreader18
- License: mit
- Created: 2018-04-16T04:38:14.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-06-11T23:08:30.000Z (over 7 years ago)
- Last Synced: 2025-06-27T21:47:32.068Z (7 months ago)
- Language: JavaScript
- Size: 17.6 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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.