|
| 1 | +# Hyperlisp |
| 2 | + |
| 3 | +## What the heck is hyperlisp? |
| 4 | + |
| 5 | +- It's a markup language designed for the web |
| 6 | +- It transpiles directly into html |
| 7 | +- It's written in Rust therefore it can transpile quickly |
| 8 | +- It's inspired by Lisp and isn't too verbose |
| 9 | +- It's free to use for any purpose you wish |
| 10 | +- Feel free to modify and play around with how it's made |
| 11 | + - It's only 145 lines of code (excluding comments and blank lines) |
| 12 | + - The code is well commented |
| 13 | +<!-- It'll alert you to any errors in your markup, making it easier to debug --> |
| 14 | + |
| 15 | +## Installation |
| 16 | + |
| 17 | +You can run the following commands on linux to get it up and running |
| 18 | +```sh |
| 19 | +git clone https://github.com/curlpipe/hyperlisp.git |
| 20 | +cd hyperlisp |
| 21 | +cargo build --release |
| 22 | +sudo cp target/release/hyperlisp /usr/bin/ |
| 23 | +``` |
| 24 | + |
| 25 | +Or you can use the prebuilt binaries provided in the releases section and move it to `/usr/bin/` |
| 26 | + |
| 27 | +## Conversion from hyperlisp to html |
| 28 | +After installation, you'll be able to convert hyperlisp files into html |
| 29 | + |
| 30 | +To show the help menu: |
| 31 | +``` |
| 32 | +hyperlisp -h |
| 33 | +``` |
| 34 | + |
| 35 | +To convert `index.hp` file into html and print it out: |
| 36 | +``` |
| 37 | +hyperlisp -i index.hp |
| 38 | +``` |
| 39 | + |
| 40 | +To convert `index.hp` file into `index.html`: |
| 41 | +``` |
| 42 | +hyperlisp -i index.hp -o index.html |
| 43 | +``` |
| 44 | + |
| 45 | +## Syntax |
| 46 | +You can check out the examples folder to see some examples of how to write it. |
| 47 | + |
| 48 | +Below are some smaller snippets to help you quickly grasp the language. |
| 49 | + |
| 50 | +### Single tags |
| 51 | + |
| 52 | +```lisp |
| 53 | +(h1 Hello World) |
| 54 | +``` |
| 55 | + |
| 56 | +```html |
| 57 | +<h1>Hello World</h1> |
| 58 | +``` |
| 59 | + |
| 60 | +### Nested tags |
| 61 | +```lisp |
| 62 | +(h1 This is an example of (b Nested tags!) Pretty cool!) |
| 63 | +``` |
| 64 | + |
| 65 | +```html |
| 66 | +<h1>This is an example of <b>Nested tags!</b> Pretty cool!</h1> |
| 67 | +``` |
| 68 | + |
| 69 | +### Attributes |
| 70 | +```lisp |
| 71 | +(div id="background" class="container gradient" |
| 72 | + Here's a tag: (h1 This is a div) |
| 73 | +) |
| 74 | +``` |
| 75 | + |
| 76 | +```html |
| 77 | +<div id="background" class="container gradient"> |
| 78 | + Here's a tag: <h1>This is a div</h1> |
| 79 | +</div> |
| 80 | +``` |
| 81 | + |
| 82 | +### Multiple nested tags |
| 83 | +```lisp |
| 84 | +(body (h1 Tag number 1) (p Tag number 2)) |
| 85 | +``` |
| 86 | + |
| 87 | +```html |
| 88 | +<body><h1>Tag number 1</h1> <p>Tag number 2</p></body> |
| 89 | +``` |
| 90 | + |
| 91 | +### Comments |
| 92 | +```lisp |
| 93 | +(h1 This is a heading, it is displayed) !(This is a comment and it's not displayed) |
| 94 | +``` |
| 95 | + |
| 96 | +```html |
| 97 | +<h1>This is a heading, it is displayed</h1> |
| 98 | +``` |
| 99 | + |
0 commit comments