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

MIT license

1.5MB
2.5K SLoC

Mdmg

Coverage Status

A scaffold prototype code tool.

mdmg-demo

Install

cargo install mdmg

Debian

  1. 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
  • Zero dependencies
  • Zero configuration
  • Don't use interactive shell.
    • Easy to reuse from your script and text editor.

Usage

  1. Current Directory move to your project directory.
  2. Execute mdmg setup.
  3. Create a file similar to the following .mdmg/${plan_name}.md.
## src/main.rs

```rust
fn main() -> Result<()> {
    unimplemented!()
}
```
  1. 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

Supported functions

  • pascal_case
    • Example
      • identify: fooBarBaz
      • template: {{pascal_case identify}}
      • output: FooBarBaz
  • camel_case
    • Example
      • identify: FooBarBaz
      • template: {{camel_case identify}}
      • output: fooBarBaz
  • kebab_case
    • Example
      • identify: FooBarBaz
      • template: {{kebab_case identify}}
      • output: foo-bar-baz
  • snake_case
    • Example
      • identify: FooBarBaz
      • template: {{snake_case identify}}
      • output: foo_bar_baz
  • env:
    • Example
      • environment: FOO=12
      • template: {{env "FOO"}}
      • output: 12

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