myitcv / x

Mono-repo for all myitcv.io/... Go code
MIT License
103 stars 20 forks source link

proposal: cmd/mdreplace: introduce concept of "last block" shorthand #79

Open myitcv opened 5 years ago

myitcv commented 5 years ago

It's awkward to have to put the entire template for the output of a __TEMPLATE or __JSON block inside a comment, particularly if the bulk of the comment contains non-template material.

<!-- __JSON: go list -json encoding/json
Package `{{.Out.ImportPath}}` has name `{{.Out.Name}}` and the following doc string:

```
{{.Out.Doc}}
```
-->
<!-- END -->

Instead if would be nice to be able to reference the previous block's output in a shorthand way:

<!-- __JSON: go list -json encoding/json -->

There is no template provided in the previous block. Instead
we can reference the previous block's output using shorthand
<!--!! `{{.Out.Name}}` --><!-- END -->.