A Markdown-based Makefile alternative.
Project description
makedown - A Markdown powered Makefile alternative
makedown (aka Makefile + Markdown) is motivated by developers need to define
multiple scripts in one file next to their documentation, and have a handy way
to trigger them from terminal.
Makefiles are great for this, but are lucking some of the
makedown features, such as syntax
highlighting, hierarchical scanning and embedded documentation.
There are also package.json scripts in node.js world, but users are forced
to write script commands in one line.
It is implemented in Python for portability reasons, since most Unix-like systems already have a Python interpreter installed.
Key Features
- Executable Markdown Scripting: Use markdown files (.md) to organize commands and their documentation.
- Multilingual Execution: Supports
zsh,bash,javascript,pythonand infinitely many more. - Syntax Highlighting: Leverages markdown code blocks for readability.
- Flexible Code Blocks: Support for triple backtick code blocks.
- Autocomplete Support: ZSH completions for a smoother workflow.
How to use
Install
pip install makedown
Define commands in a .md file
# my_scripts.md
Here are a few examples of commands:
## [hello]() Prints a welcome message
```bash
echo "hello, world!"
```
Executing commands
To run commands in a markdown file, execute makedown from the same directory
or any subdirectory:
makedown hello
A shorter version is also available:
m hello
Printing help
To see all the available commands with their documentation, use one of the following:
makedown --help
or just run it without any arguments:
makedown # just `m` also works
Using other languages
print("hello, world!")
Upgrade
pip install --upgrade makedown
Uninstall
pip uninstall makedown
DEMO.md
Here are a few examples of commands:
## [welcome]() Prints a welcome message
By default bash is used as interpreter for the commands.
```
echo "Welcome to makedown.sh"
```
## [interpreter-chain]() Choose a specific interpreter
When several code blocks are present, they are executed in order.
```sh
echo "step 1: I run in sh"
```
```bash
echo "step 2: I run in bash"
```
```zsh
echo "step 3: I run in zsh"
```
```python
#!/opt/homebrew/bin/python
print("step 4: I run in python")
```
```javascript
#!/opt/homebrew/bin/node
console.log("step 5: I run in node");
```
### Some handy helpers
A set of handy file system helpers is available.
### [dirsize]() Prints the total size of a directory
```bash
du -sh "$2"
```
### [find-files]() Finds files in a directory recursively
```zsh
find "$1" -type f
```
### [kill-port]() Kills a process listening on a port
```zsh
kill -9 $(lsof -t -i:$1)
```
```ruby
#!/usr/bin/env ruby
def is_prime?(number)
return false if number <= 1
(2..Math.sqrt(number)).none? { |i| number % i == 0 }
end
def first_n_primes(n)
primes = []
number = 2
while primes.length < n
primes << number if is_prime?(number)
number += 1
end
primes
end
# Print the first 100 prime numbers
first_100_primes = first_n_primes(100)
puts first_100_primes
```
### [argv]() command line arguments test
```python
#!/usr/bin/env python
import sys
print(sys.argv)
```
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file makedown-0.0.2.tar.gz.
File metadata
- Download URL: makedown-0.0.2.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cd3849126bca6191fc4c4a1219a033d2ff73991d733fdb6501d7f9c887f576c4
|
|
| MD5 |
060b6fec8d32863b4bc7de3050a9caf1
|
|
| BLAKE2b-256 |
53d4023c3760ed71392bffa55530e9d6b018684a52b9d8f81622192dcf9891f7
|
File details
Details for the file makedown-0.0.2-py3-none-any.whl.
File metadata
- Download URL: makedown-0.0.2-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bd2b5d6af8764d841f14ee5f425151366c743c44938c2c6cf08c97c125f804fc
|
|
| MD5 |
175c3c0bd8902c6f59b1a3f4a29e3bfd
|
|
| BLAKE2b-256 |
7256a4b561fe7734705a067ab239633f0c116e1ea911818922c70e9b22ad6b03
|