Skip to main content

module lang::rascal::tutor::apidoc::GenerateMarkdown

rascal-0.40.13-BOOT2
rascal-tutor-0.19.9

Usage

import lang::rascal::tutor::apidoc::GenerateMarkdown;

Dependencies

import List;
import String;
import util::Reflective;
import Location;
import Message;
import lang::rascal::tutor::apidoc::DeclarationInfo;
import lang::rascal::tutor::apidoc::ExtractInfo;
import lang::rascal::tutor::Output;
import lang::rascal::tutor::Indexer;
import lang::rascal::tutor::Compiler;
import lang::rascal::tutor::repl::TutorCommandExecutor;
import lang::rascal::tutor::Names;
import IO;
import Node;

function generateAPIMarkdown

Generate markdown documentation from the declarations extracted from a Rascal module.

list[Output] generateAPIMarkdown(str parent, loc moduleLoc, PathConfig pcfg, CommandExecutor exec, Index ind)
This function takes Rascal files as input, first extracts all declarations including their
embedded (markdown) documentation tags, and then generates on-the-fly the output markdown
as a list of lines and error messages.

This generator reuses the markdown compiler
to implement Rascal shell execution and concept linking, etc. This compilation is applied inside of the
documentation tags that are written by the author of the Rascal code. The trick is to track the
current line number inside those documentation tags to provide valuable feedback to the user
of the tutor compiler.

function declInfo2Doc

list[Output] declInfo2Doc(str parent, d:moduleInfo(), list[str] overloads, PathConfig pcfg, CommandExecutor exec, Index ind, list[str] dtls, bool demo)

list[Output] declInfo2Doc(str parent, d:functionInfo(), list[str] overloads, PathConfig pcfg, CommandExecutor exec, Index ind, list[str] dtls, bool demo)

list[Output] declInfo2Doc(str parent, d:testInfo(), list[str] overloads, PathConfig pcfg, CommandExecutor exec, Index ind, list[str] dtls, bool demo)

list[Output] declInfo2Doc(str parent, constructorInfo(), list[str] overloads, PathConfig pcfg, CommandExecutor exec, Index ind, list[str] dtls, bool demo)

list[Output] declInfo2Doc(str parent, d:dataInfo(), list[str] overloads, PathConfig pcfg, CommandExecutor exec, Index ind, list[str] dtls, bool demo)

list[Output] declInfo2Doc(str parent, d:syntaxInfo(), list[str] overloads, PathConfig pcfg, CommandExecutor exec, Index ind, list[str] dtls, bool demo)

list[Output] declInfo2Doc(str parent, d:aliasInfo(), list[str] overloads, PathConfig pcfg, CommandExecutor exec, Index ind, list[str] dtls, bool demo)

default list[Output] declInfo2Doc(str parent, DeclarationInfo d, list[str] overloads, PathConfig pcfg, CommandExecutor exec, Index ind, list[str] dtls, bool demo)

function tags2Markdown

list[Output] tags2Markdown(list[DocTag] tags, PathConfig pcfg, CommandExecutor exec, Index ind, list[str] dtls, bool _demo, bool descriptionHeader=false)

function basename

str basename(str cn)

function removeNewlines

str removeNewlines(str x)