8 releases
0.1.6 | Mar 16, 2024 |
---|---|
0.1.5 | Feb 27, 2024 |
0.1.4-beta.1 | Jun 22, 2022 |
0.1.3 | Jan 26, 2022 |
0.1.2-alpha.2 | Oct 28, 2021 |
#1247 in Parser implementations
1.5MB
2.5K
SLoC
Mdmg
A scaffold prototype code tool.
Install
cargo install mdmg
Debian
- Dowload a latest deb package from https://github.com/himanoa/mdmg/releases
dpkg -i mdmg_[version]_amd64.deb
macOS
Use homebrew
brew install -s himanoa/tap/mdmg
Features
- Markdown driven
- Inspiration of scaffdog.
- Zero dependencies
- Zero configuration
- Don't use interactive shell.
- Easy to reuse from your script and text editor.
Usage
- Current Directory move to your project directory.
- Execute
mdmg setup
. - Create a file similar to the following
.mdmg/${plan_name}.md
.
## src/main.rs
```rust
fn main() -> Result<()> {
unimplemented!()
}
```
- Execute
mdmg generate ${plan_name} foo
.
Mdmg plan file format
Please write in the following format.
## file_name
```
file_body
```
The key points are as follows.
- Write a filename in h2 tag
- Write a file body in code block where the next line
- ↑ is ok write multiple
Template Engine
Mdmg plan markdown can be use handlebars template.
Functions and variables that can be used.
Supported variable
identify
The third argument of mdmg generate command.- Example.
mdmg generate foo bar
=> bar
- Example.
Supported functions
pascal_case
- Example
- identify: fooBarBaz
- template:
{{pascal_case identify}}
- output: FooBarBaz
- Example
camel_case
- Example
- identify: FooBarBaz
- template:
{{camel_case identify}}
- output: fooBarBaz
- Example
kebab_case
- Example
- identify: FooBarBaz
- template:
{{kebab_case identify}}
- output: foo-bar-baz
- Example
snake_case
- Example
- identify: FooBarBaz
- template:
{{snake_case identify}}
- output: foo_bar_baz
- Example
env
:- Example
- environment: FOO=12
- template:
{{env "FOO"}}
- output: 12
- Example
Implementation => https://github.com/himanoa/mdmg/blob/master/src/template.rs
Contributing
See https://github.com/himanoa/mdmg/blob/master/CONTRIBUTING.md
Dependencies
~12–20MB
~299K SLoC