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

https://github.com/ruivieira/crystal-vesta

Crystal executable Markdown
https://github.com/ruivieira/crystal-vesta

crystal literate-programming markdown

Last synced: 2 months ago
JSON representation

Crystal executable Markdown

Awesome Lists containing this project

README

          

[![tests](https://github.com/ruivieira/crystal-vesta/actions/workflows/main.yml/badge.svg)](https://github.com/ruivieira/crystal-vesta/actions/workflows/main.yml) [![builds.sr.ht status](https://builds.sr.ht/~ruivieira/crystal-vesta/commits/.build.yml.svg)](https://builds.sr.ht/~ruivieira/crystal-vesta/commits/.build.yml?)

# crystal-vesta

![vesta](./docs/vesta.png)

Crystal executable Markdown.

## installation

Add the dependency to your `shard.yml`:

```yaml
dependencies:
holst:
github: ruivieira/crystal-vesta
```

and run `shards install`.

### command line

To install the CLI, clone this repository and run

```shell
crystal build vestacli.cr
```

The basic usage to render a markdown file `foo.md` is

```shell
vestacli -i foo.md -o bar.md
```

## examples

Given a Markdown file with `crystal` code block, _e.g._

# Title

This is a test, and with
a code block (`Crystal`)

```crystal
a = [1, 2, 3]
b = a.map{ |x| x*2 }
b
```

Let's try with another one

```crystal
c = 4
c
```

And ... the end.

`vesta` will execute the code block and add the result after the block:

```crystal
require "vesta"

vesta = Vesta::Renderer.new("test_file.md")
result = vesta.render
```

will result in:

# Title

This is a test, and with a code block (`Crystal`)

``` crystal
a = [1, 2, 3]
b = a.map{ |x| x*2 }
b
```

[2, 4, 6]

Let's try with another one

``` crystal
c = 4
c
```

```
4
```

And ... the end.

## documentation

API documentation is available [here](https://ruivieira.github.io/crystal-vesta/).

A git mirror is available at [https://git.sr.ht/~ruivieira/crystal-vesta](https://git.sr.ht/~ruivieira/crystal-vesta).

## mailing lists

- Announcements: [https://lists.sr.ht/~ruivieira/crystal-announce](https://lists.sr.ht/~ruivieira/crystal-announce)
- Discussion: [https://lists.sr.ht/~ruivieira/crystal-discuss](https://lists.sr.ht/~ruivieira/crystal-discuss)
- Development: [https://lists.sr.ht/~ruivieira/crystal-devel](https://lists.sr.ht/~ruivieira/crystal-devel)

Please prefix the subject with `[crystal-vesta]`.