-
Notifications
You must be signed in to change notification settings - Fork 1
Description
There should be a way to define and call helper functions like "log in" or "today's date", etc.
However, we need to define:
Where should the functions be defined?
We could search some "base" directory for a literapi.js file, or similar. Or we could have a -I "include" flag for literapi that points to a file to be included.
How should the functions be called from the LiterAPI doc?
Simply having some special syntax seems like it would defeat the human-readability of LiterAPI, and obscure the meaning. Since there are no comments in Markdown, there's no good way to embed a function call (unless added to the opening fence of a code block, but that feels... hacky).
We could do some kind of text-matching a la cucumber, so something like
> NB: We assume a logged-in user. See [[Authentication]] for more details.
Would be matched by
literapi.match(/^We assume a logged-in-user./, function(){ ... })
(In this case, assuming "NB" is a well-defined scope prefix so it's easy to find all LiterAPI directives in a document.)