Skip to content
This repository has been archived by the owner on Sep 2, 2021. It is now read-only.

Variables #17

Open
bumper314 opened this issue Mar 10, 2016 · 5 comments
Open

Variables #17

bumper314 opened this issue Mar 10, 2016 · 5 comments

Comments

@bumper314
Copy link

I suggest implementing variables. There might be a header section where variables are defined:

product: GitHub

Then some way to reference in the MD doc, like {{product}}.

@leotrs
Copy link

leotrs commented Jul 1, 2016

+1

@leotrs
Copy link

leotrs commented Jul 22, 2016

@jreese if there's interest, I can work on a quick PR.

@amyreese
Copy link
Owner

If this is going to be implemented, I would like it to follow something like this:

  • Use YAML-style "documents" with separators:
    • if the first "document" parses as a valid YAML document, it defines variables, otherwise it's treated as MarkdownPP
    • all other "documents" are treated as pure MarkdownPP
  • MarkdownPP documents are rendered through a template library (I prefer Jinja using the variables from above
  • If no YAML/variables defined, then don't render templates at all
  • Have a good story for how variables are passed/rendered into sub documents via !INCLUDE[URL] and use the same process for defining/rendering variables in those sub documents.

I've actually done something more or less just like this in a different project (Nib), if you'd like inspiration for implementation, or if you'd like to factor that out into a library of some sort.

@julesmaregiano
Copy link

Anything new about this? Would really need something like that 👼

@joncamfield
Copy link

Over at https://github.com/SAFETAG/SAFETAG/ ; we use markdown-pp to compile together a ton of files into one guide for HTML/PDF/etc. construction. We'd love to move more content into a YAML-y metadata header; but this would be local to each sub-file rather than global. If there is movement here, it would be great to enable a few other paths for usage of YAML metadata/variables.

A likely difficult (if handy for my use case!), or at least likely to lead to confusing states option: YAML variables are valid until / reset by the next YAML block

A less powerful, but certainly much easier option would be to spit out a table (what github does; see https://github.com/SAFETAG/SAFETAG/blob/master/en/exercises/assessment_plan/index.md for an example of yaml rendered as a table)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants