Open Dvergar opened 10 years ago
Hi, great to hear that generate-md
has been useful!
I've been thinking along similar lines re: extending the capabilities of the layouts engine. I think it would be even better to add (optional) Ghost theme support http://docs.ghost.org/themes/ because that blogging engine has a lot of good themes and a specified language that people have been using for a while. Haven't looked into it in detail yet but will probably add support eventually, which will both expand the abilities of the templating system and add hundreds of compatible themes.
Just to update this fantastic issue:
meta.json
file is now loaded from the input folder instead of process.cwd
, which is more sensible as you pointed out. In addition, individual markdown files can override the values set in it.if
operator was added in v2.0
as part of the move to a fully featured templating system (Handlebars)--sample
CLI option does not exist, the --exports
CLI option makes it a bit easier to get started by copying a builtin layout as a starting point.So thanks for filing the issue, many of the features in v2.0 were inspired or influenced by it.
First, thanks for this tool. I've been trying to create a portfolio and i stumbled upon this after fighting with premade templates, bootstrap & co.
I've been customizing a theme of mine and the more i worked on this the more i thought it would be cool to give a bit more power to the
meta.json
.I'll give a few of the ideas i got, more as a todo list that anything if i find the time, but also in the case someone want to have an eye on this.
Parsing the css looking for meta.json variables It would be great to give the layout user a way to customize a few things without diving into the css itself (or the layout folder).
e.g.
"background" : "red"
and using abackground-color : {{background}}
in the css.Allowing a default meta.json in the layout folder In my theme i use the
meta.json
to set my profile image and a few contact links. If i can give a defaultmeta.json
in my theme and if it's copied into the markdown project itself it would be easier for a user to understand what's possible to do with the theme.Adding an if operator Maybe, by design, you want to keep things simple and i like the idea that a layout doesn't need more than just the default command without necesarily looking into the
meta.json
- but a{{if variable equals value}}
and/or{{if variable exists}}
would allow for a more dynamic theme without requiring the user to edit/add anything into the meta file. It would be possible to create more powerful themes as well. In my theme above i have a{{github}}
,{{twitter}}
and{{email}}
variable which are links associated to the little icons but i can't hide them depending on if the variable exists or not.e.g.
{{if github exists}} <a href="{{github}}">My github repo</a>{{endif}}
Adding a sample command Since my two last points are not entirely compatible a
--sample
command would create a dummy project with a defaultmeta.json
showing all the features the theme can offer. A normal markdown parsing would still work giving the simple version of the theme. (without the profile image and the contact links in mine)