package
0.2.0
Repository: https://github.com/szkiba/mdcode.git
Documentation: pkg.go.dev

# README

fibonacci

An example of how to use mdcode

In this example, the examples consist of 4 code blocks each. Of course, any markdown text can be included between individual code blocks. The code block describing the outline of the source file is an invisible code block, just like the test code required for testing.

If you look at the source of this document, you can see how the embedding is done.

JavaScript

function fibonacci(n) {
    if (n < 1) {
        return 0
    }
    if (n == 1) {
        return 1
    }
    return fibonacci(n - 1) + fibonacci(n - 2)
}

go

func fibonacci(n uint64) uint64 {
	if n == 0 {
		return 0
	}
	if n == 1 {
		return 1
	}
	return fibonacci(n-1) + fibonacci(n-2)
}

Tasks

To try mdcode here are some easy tasks

extract

You can extract the example code and the test code using the following command:

mdcode extract

test

After extractiong, you can run the test using the following commands:

go test
node --test

update

After modifying the files, you can update the code blocks in the document using the following command:

mdcode update