realworldocaml / mdx

Execute code blocks inside your documentation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question: how to define bash functions in md files code blocks?

mbarbin opened this issue · comments

In OCaml code blocks, the environment enriches as you add more code, and you can even specify distinct environments. I wonder if there's an equivalent for sh code blocks. Can you define a function in one block, and use it in another subsequent block (in the same md file). Is there a similar notion of environment?

I couldn't find how to define a function, but I suspect this is simply because I failed at finding the right syntax for multi-lines sh blocks in the presence of curly brackets, and I'm getting it mixed up with the one for cram, which I suspect doesn't use the exact same quoting mechanism. I'm probably wrong and confused there.

Thank you for your help!