invicticide / fractive

Fractive is a free, open-source, Markdown-based hypertext authoring tool for writing interactive fiction.
http://fractive.io
Other
37 stars 5 forks source link

Call functions with Bash-style arguments #85

Open NQNStudios opened 6 years ago

NQNStudios commented 6 years ago

I think there should be a little bit more flexibility in calling JavaScript functions from within Markdown. My proposal is a syntax like this: {#function arg1 arg2 ...} where functions can optionally be defined with a signature like this:

function mFunc(args) where args will be an array of strings containing one token each.

hyakugei commented 6 years ago

Can the arguments be the output of other functions? expanded js variables?

{#function {$myVar}}

NQNStudios commented 6 years ago

My thinking was that they shouldn't be. Josh has said in the past that a core design principle is keeping complicated logic outside of markdown files altogether, and adding recursion to this would definitely add the temptation to be doing crazier things with macros. I'm thinking the only arguments allowed should be string or number literals.