fennecdjay / mdr

MDR, the markdown runner

Home Page:https://fennecdjay.github.io/mdr/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MDR, a markdown runner

Linux MacOs Windows Line Count

mdr is a small program and markup designed to facilitate documentation and testing.

logo

I started it to ease Gwion's devellopment, but it is not tied in any way to this project.

Let' walktrough... 😄

Hello World

let's write our first litterate progam.

Define program structure

hello_world.c

@[[ Includes ]]

int main(int argc, char** argv) {
  @[[ Print ]]
}

Add Headers

As we need the puts function, we need stdio headers.

Includes

#include <stdio.h>

Print function

Print

puts("Hello, World!");

Compile

let's compile hello_world.c.

exec: cc hello_world.c -o hello_world

Yes, there should be no output, and that good news.

Check

Let's look at hello_world.c

exec: cat hello_world.c

#include <stdio.h>

int main(int argc, char** argv) {
  puts("Hello, World!");
}

That's the content of the source file we generated (and compiled).

Test

Then we run it

exec: ./hello_world

Hello, World!

Do we read Hello World! ? Assuming yes, let's continue.

More test

exec: [ "$(./hello_world)" = "Hello, World!" ] && echo "OK" || echo "NOT_OK"

OK

Building

As a C program, it seemed natural to use make as a build system.

make

Testing

Also using make:

make test

You can also try

bash scripts/test.sh

Installing

As easy as before, just type.

make install

or just copy mdr somewhere in your path.


generated from this file

About

MDR, the markdown runner

https://fennecdjay.github.io/mdr/


Languages

Language:C 93.4%Language:Shell 3.7%Language:Makefile 2.8%