A macro in the context of fleck is a snippet starting with @
.
The preprocessor (if enabled) will check if the macro is known and if so replaces / expands the macro with the corresponding value.
macro name
|
v
@today{2006-01-02}
^
|
macro argument
Info
Macros are expanded via fleck's preprocessor. For performance reasons the preprocessor is disabled by default, to enable the preprocessor and macros, supply fleck with the
--preprocessor-enabled
flag:fleck --preprocessor-enabled test.md
## Test.md:
@include{test.md}
The above includes the whole content of the test.md.
Warning
fleck
does currently not support import nesting, this means the root filefleck
processes can use the@include
macro, any file already included can not.
Today is @today{2006-01-02}.
@today
gets replaced with the current date, according to the format specified in its argument, here it would result in Today is 2023-04-08
.
The @today
macro accepts go format strings, read more here.
Warning
This macro is very dangerous and needs to be enabled via the
--shell-macro-enabled
flag, like so:fleck --preprocessor-enabled --shell-macro-enabled test.mdThe preprocessor will execute any command specified as a parameter, this includes each and every command available on your system, such as removing whole directories or stealing data from your system.
Author: @shell{whoami}
@shell
is replaced with the output of the command specified in the argument, here it would result in Author: teo