If you want require syntax in Markdown, use it. :-)
OKReadme change README.ok.md
file to README.md
. it's very simple.
(see, README.ok.md. understand what this project)
$ git clone https://github.com/wan2land/okreadme.git
$ cd okreadme
$ make
$ make install PREFIX=/your/path # default PREFIX=/usr/local, then install /usr/local/bin path!
type okreadme -v
, the output is as follows:
OK Readme v0.1.0
Is Your Readme OK? :-)
create README.ok.md
file, then write the flowing.
@code("templates/hello.c")
the command is also very easy.
$ okreadme > README.md
$ okreadme README.ok.md > README.md # default input is README.ok.md
Result
#include<stdio.h>
int main() {
// hello world :-)
printf("Hello World\n");
return 0;
}
show templates/hello.c file.
@code("templates/hello.c")
Result
#include<stdio.h>
int main() {
// hello world :-)
printf("Hello World\n");
return 0;
}
show templates/hello.c file.
@code("templates/hello.c:4-8")
Result
// hello world :-)
printf("Hello World\n");
return 0;
i made it because i needed it. have you noticed that that the open source package has been updated,
but your README.md
has not been updated? use it in your test code and README.md
.
(show templates/hello.php file)
@code("templates/hello.php@code-by-section-name")
Result
function codeBySectionName() {
bar();
}
and, it automatically adjusts when there is a tab index over several lines.
(show templates/hello.php file)
@code("templates/hello.php@code-indent-multiline")
Result
if (something()) {
return false;
}
return true;
use the second parameter. it's very simple.
show templates/hello.unknown file.
@code("templates/hello.unknown", "go")
Result
package main
import "fmt"
func main() {
fmt.Println("hello world")
}
install okreadme, then copy the following and paste it into .git/hooks/pre-commit
.
#!/bin/sh
if [ -f "README.ok.md" ]; then
okreadme > README.md
git add README.md
fi
that's all. manage only README.ok.md
.