[ANN] Enhanced Markdown template processor(emd): helper to generate README file

213 views
Skip to first unread message

mhh...@gmail.com

unread,
Feb 22, 2017, 4:40:27 PM2/22/17
to golang-nuts
Hi,

I made this package to spare me some efforts
while maintaining README files of my projects.

Its a binary written in go which take advantages
of text/template to allow dynamic generation
of the README file with help of
 some fine grained helpers.

Just check the README file of the project
and compare it with the e.md file
I created for this project.

With help of emd, now i can invoke
   emd gen -out README.md

to generate an updated version of the README file
(for most of what is doable to automate).

Find the list of helpers here

I think its a good companion with godoc,
each other being strong in the companion weaknesses.
godoc is better for structured text for api documentation,
markdown is better at loosely structured text.

Find the repo at https://github.com/mh-cbon/emd

That s it!

Tong Sun

unread,
Mar 4, 2017, 5:32:39 PM3/4/17
to golang-nuts
Looks really good, thanks. 

Is it possible to support the codeship.com badges? They are ID based. e.g., 


BTW, just to clearly understand the command line:

emd gen -out README.md
to generate an updated version of the README file. 

Will emd always assume the input file to be README.e.md, or something else? 

Thanks

mhh...@gmail.com

unread,
Mar 6, 2017, 6:19:46 AM3/6/17
to golang-nuts
Hi there!


> Is it possible to support the codeship.com badges?

Yes its possible to add support for this badge,

It is just a template registered to the generator like this,

https://github.com/mh-cbon/emd/blob/master/std/emd.go#L43

The codeship badge look likes this,
https://codeship.com/projects/YOUR_PROJECT_UUID/status?branch=master

The only problem is this UUID value.
Which i dont know where the program can fetch it without involving manual operation.

Even an http redirect from codehip.com/<my poject> => codehip.com/<uuid>
could solve that small problem.

One solution to that is to allow injection of variable from the command line,
I don t like it very much because the resulting command line is ugly,
emd --vars '{some: "value"}'

On the other hand, when the command is dropped into a sort of makefile,
it hurts once only, acceptable ?

Also, on longer term with multiplicity of badges, such capability seems to be a must have.

Let me know your thoughts.

BTW, i can t access your two links.


> Will emd always assume the input file to be README.e.md, or something else?

Nop, the gen sub command takes an -in argument,

$ emd gen -help

emd - 0.0.0

Command "gen": Process an emd file.
  -data string
        JSON map of data
  -help
        Show help
  -in string
        Input src file (default "README.e.md")
  -out string
        Output destination, defaults to stdout (default "-")

Given the Q i should assume the README is not so clear,

bad xD


>What file types are supported

For instance its a simple extension value extraction,
https://github.com/mh-cbon/emd/blob/master/std/emd.go#L18

It will need some work to properly handle some extensions like .bat .cmd,
but until then, it works!

mhh...@gmail.com

unread,
Mar 6, 2017, 6:34:18 AM3/6/17
to golang-nuts
too early in the morning, and forgot to RTFM,
i forgot the --data argument (see ~~~~ emd gen --help | grep data)

So basically, just few code additions and you are good to go.

(Hope for a better plugin deployment support in golang,
that small program definitely will benefit of it
and untie it with its hard coded templates,
until then, it works ; )


On Saturday, March 4, 2017 at 11:32:39 PM UTC+1, Tong Sun wrote:

mhh...@gmail.com

unread,
Apr 12, 2017, 11:30:32 AM4/12/17
to golang-nuts
Hi,

I wanted to announce this update of emd

Several updates summarized here,
https://github.com/mh-cbon/emd/releases/tag/0.0.9-beta

Its a beta because you might be debugging few small corner cases parsing issues, sorry >.<

You can check the newly resulting md https://github.com/mh-cbon/emd#emd
made with this template https://github.com/mh-cbon/emd/blob/master/README.e.md

Note, there are 2 template funcs deprecated, but not removed, please update, so they can be cleaned in future.

mhh...@gmail.com

unread,
Apr 17, 2017, 1:22:35 PM4/17/17
to golang-nuts
Hi,

some more updates

there has been several beta since last time, last one is
https://github.com/mh-cbon/emd/releases/tag/0.0.9-beta7

changes

  • new functions:
    -yaml(file string, keypaths ...string): parses and build new yaml content of given file.
    -preline(pre , content string): prepends pre for every lines of content.
    -echo(s ...string): echo every string s.
    -read(file string): returns file content.
  • toc: multiple fixes
  • prelude: multiple fixes
  • fix #13: add new template to show a license badge.
  • fix #14: improved badge output, removed useless whitespace.
  • fix #2: codeship badge template, added a CsProjectID parameter.
  • exec/shell/cat/gotest: avoid pre defined formatting, old behavior can be reset via new options defined into the prelude data.
Reply all
Reply to author
Forward
0 new messages