{"by":"timz","descendants":65,"id":41825344,"kids":[41856232,41851201,41855954,41851389,41856935,41827118,41856157,41855062,41856059,41856596,41860326,41855129,41855073,41854837,41858724,41855384,41857391,41826876,41867900,41828216,41874541,41829324,41856857,41851256,41858672,41853693,41857742,41854969,41851952,41825768,41856433],"score":142,"text":"`makedown` allows you to organise your shell scripts in one or several markdown\nfiles, by mix and matching different scripting languages for various commands\nand needs.<p>zsh&#x2F;bash&#x2F;sh, python, javascript or anything else available on your system.<p>Handy for replacing one-line-based package.json scripts or shell-based\nMakefiles.<p>One can also write documentation and explanations to various commands in the same\n`.md` file.<p>Most editors highlight correctly most languages in the markdown code blocks,\neven when you use several scripting languages.<p>Here is a demo .md file <a href=\"https:&#x2F;&#x2F;github.com&#x2F;tzador&#x2F;makedown&#x2F;blob&#x2F;main&#x2F;DEMO.md\">https:&#x2F;&#x2F;github.com&#x2F;tzador&#x2F;makedown&#x2F;blob&#x2F;main&#x2F;DEMO.md</a><p>More information available in the\n<a href=\"https:&#x2F;&#x2F;github.com&#x2F;tzador&#x2F;makedown&#x2F;blob&#x2F;main&#x2F;README.md\">https:&#x2F;&#x2F;github.com&#x2F;tzador&#x2F;makedown&#x2F;blob&#x2F;main&#x2F;README.md</a><p>Provided the following `example.md` in the root of your project,\nthe defined commands are available to run from any of the projects subfolders:<p><pre><code>    --- Start of example.md ---\n\n    # hello\n\n    Prints &quot;Hello&quot; to `stdout` using Zsh.\n\n    ```zsh\n    echo &quot;Hello&quot;\n    ```\n\n    # world\n\n    Just prints &quot;World&quot; to `stdout` using JavaScript.\n\n    ```js\n    console.log(&quot;World&quot;);\n    ```\n\n    # weather-tomorrow\n\n    Prints the weather for tomorrow to `stdout` using Zsh.\n\n    ```zsh\n    curl wttr.in&#x2F;tomorrow\n    ```\n\n    # generate-password\n\n    Prints a random password to `stdout` using Python.\n\n    ```python\n    import random\n    import string\n\n    length = 16\n\n    characters = string.ascii_letters + string.digits + string.punctuation\n    password = &#x27;&#x27;.join(random.choice(characters) for _ in range(length))\n    print(password)\n    ```\n\n    --- End of example.md ---\n</code></pre>\nYou can run any of the commands from anywhere in the project,\njust by typing `makedown a-command-name` or a shorter `m a-command-name`.<p><pre><code>    $ makedown --help\n    hello                - Prints &quot;Hello&quot; to `stdout` using Zsh.\n    world                - Just prints &quot;World&quot; to `stdout` using JavaScript.\n    weather-tomorrow     - Prints the weather for tomorrow to `stdout` using Zsh.\n    generate-password    - Prints a random password to `stdout` using Python.\n\n    $ makedown hello\n    Hello\n\n    $ makedown world\n    World\n\n    $ m weather-tomorrow\n    Sunshine # prints more details actually\n\n    $ m generate-password\n    4444444444444444\n\n    $ m generate-password --help\n    Prints a random password to `stdout` using Python.\n</code></pre>\nThe commands have simple syntax, they start with a header with a link and stop\nwhen the next header starts.<p>Like so:<p><pre><code>    # [a-command-name]() A short description.\n\n    Some documentation.\n\n    ```bash\n    some command\n    ```\n</code></pre>\nYou can use other interpreters, like `python`, `node`, `ruby`, etc.<p>You can also use a custom interpreter specified using hashbang, like:<p><pre><code>    # [run-deno-script]() Runs a script using the Deno interpreter.\n\n    Deno has to be installed on your system.\n\n    ```typescript\n    #!&#x2F;usr&#x2F;bin&#x2F;env deno run\n\n    const message: string = &quot;hello, world&quot;;\n    console.log(message);\n    ```\n\n</code></pre>\nAll the .md files in the current directory and all the parents are examined\nwhen looking for commands.<p>Would be very grateful for any suggestions or other feedback.<p>Thank you.","time":1728796531,"title":"Show HN: Makedown – A Markdown powered Makefile alternative","type":"story","url":"https://github.com/tzador/makedown"}