Getting started
Make a documentation project, build it, and open the site.
Install#
ringpm install ringdoc copies the package into the Ring folder: the program ringdoc.exe (made with Ring2EXE) goes to ring/bin, and its files to ring/tools/ringdoc. Then ringdoc build works from any folder.
The program finds its own files from its place: ringdoc.exe in ring/bin uses ring/tools/ringdoc, and ring tools/ringdoc/ringdoc.ring (from the source folder) uses the folder of the script. The Ring interpreter for the programs of {{output:}} is ring/bin/ring next to a ringdoc.exe, the running interpreter otherwise, or :ringexe of the project.
Make a project#
In the folder of your package:
ringdoc new docs "My Package"This makes docs/docproject.ring and two pages, docs/src/index.md and docs/src/guide.md.
Build#
cd docs
ringdoc buildThe site is in docs/docs/ by default (the :output key); open index.html. The first build runs the Ring programs shown by {{output:}}; later builds use the saved outputs. Use --refresh to run them again.
The commands#
| Command | Does |
|---|---|
build [docproject.ring] [--refresh] | makes the HTML site and the search index |
pdf [docproject.ring] [--html-only] | makes one PDF (the site is built first when needed) |
new <folder> [name] | makes the files of a new project |
help | lists the commands |
The project file is the docproject.ring of the current folder when none is given. The commands work from any folder because ringdoc finds its own files from its place.
A complete small example#
samples/UsingRingDoc/hello of the package is a project with a guide, a program with its output and a reference page:
# The example project of ringdoc: a tiny package (hello.ring) with a guide and a reference page made from its source.
#
# ringdoc build
aDocProject = [
:name = "Hello",
:tagline = "an example",
:logo = "H",
:description = "A tiny Ring package that shows what ringdoc makes",
:footer = "Hello - an example of a documentation made with ringdoc.",
:source = "src",
:output = "docs",
:directives = [ ["greeting","greetingHtml"] ],
:prebuild = "makeGenerated",
:galleries = [
[ :name = "samples", :folder = "samples", :prefix = "hello-", :run = "ring samples/{file}" ]
],
:pages = [
["index","Overview","Start"],
["guide","Guide","Start"],
["samples","Samples","Start"],
["reference","Reference","Reference"],
["generated","A generated page","Extras","hidden"]
]
]
# {{greeting:Ring}} in a page: the HTML that this function returns
func greetingHtml cText
return '<p class="greeting">Hello, ' + cText + '!</p>'
# called before the pages are made: writes a page as HTML (a page of the project that is not in the sidebar)
func makeGenerated
writeText(hereFolder() + "/src/generated.html","<h2 id=" + '"generated"' + ">Made by the project</h2><p>This page was written by the function makeGenerated of docproject.ring.</p>")Pages are listed in :pages as [file, title, group]. The groups, in the order of first use, are the sections of the sidebar.