{"action":"created","issue":{"url":"https://api.github.com/repos/assemble/assemble/issues/685","labels_url":"https://api.github.com/repos/assemble/assemble/issues/685/labels{/name}","comments_url":"https://api.github.com/repos/assemble/assemble/issues/685/comments","events_url":"https://api.github.com/repos/assemble/assemble/issues/685/events","html_url":"https://github.com/assemble/assemble/issues/685","id":67473089,"number":685,"title":"YAML within markdown as includes/partials","user":{"login":"briantjacobs","id":786463,"avatar_url":"https://avatars.githubusercontent.com/u/786463?v=3","gravatar_id":"","url":"https://api.github.com/users/briantjacobs","html_url":"https://github.com/briantjacobs","followers_url":"https://api.github.com/users/briantjacobs/followers","following_url":"https://api.github.com/users/briantjacobs/following{/other_user}","gists_url":"https://api.github.com/users/briantjacobs/gists{/gist_id}","starred_url":"https://api.github.com/users/briantjacobs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/briantjacobs/subscriptions","organizations_url":"https://api.github.com/users/briantjacobs/orgs","repos_url":"https://api.github.com/users/briantjacobs/repos","events_url":"https://api.github.com/users/briantjacobs/events{/privacy}","received_events_url":"https://api.github.com/users/briantjacobs/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-04-09T23:36:20Z","updated_at":"2015-04-10T03:54:38Z","closed_at":null,"body":"Hi, assemble has been great so far! But I've run into some confusing behavior when it comes to using markdown as partials...\r\n\r\nI have this as an option in my assemble config\r\n```\r\npartials: '<%= yeoman.app %>/{_content,_includes}/*.{hbs,html,md}',\r\n```\r\n\r\nIf I use this in a page thats being used in a layout...\r\n```\r\n{{md \"app/_content/test.md\" }}\r\n```\r\nThe html gets rendered, but if there's YAML frontmatter in there, it's parsed as markdown\r\n\r\nIf I use this...\r\n```\r\n{{md test }}\r\n```\r\nNothing gets rendered at all\r\n\r\nIf I use this...\r\n```\r\n{{> test }} \r\n```\r\nThe raw markdown gets rendered\r\n\r\nAnd then if I use this...\r\n```\r\n{{#markdown}}\r\n  {{> test }}\r\n{{/markdown}}\r\n```\r\nThe markdown gets rendered as HTML, and any YAML frontmatter within can be used as variables.\r\n\r\nSo, a few issues here:\r\n1. I can't use YAML frontmatter if I'm using the md handlebars helper. Is this expected behavior? Is it wrong to want to use frontmatter within a markdown partial?\r\n2. It's a little confusing that if I want to use markdown as a partial I have to use a different syntax.\r\n"},"comment":{"url":"https://api.github.com/repos/assemble/assemble/issues/comments/91420052","html_url":"https://github.com/assemble/assemble/issues/685#issuecomment-91420052","issue_url":"https://api.github.com/repos/assemble/assemble/issues/685","id":91420052,"user":{"login":"jonschlinkert","id":383994,"avatar_url":"https://avatars.githubusercontent.com/u/383994?v=3","gravatar_id":"","url":"https://api.github.com/users/jonschlinkert","html_url":"https://github.com/jonschlinkert","followers_url":"https://api.github.com/users/jonschlinkert/followers","following_url":"https://api.github.com/users/jonschlinkert/following{/other_user}","gists_url":"https://api.github.com/users/jonschlinkert/gists{/gist_id}","starred_url":"https://api.github.com/users/jonschlinkert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonschlinkert/subscriptions","organizations_url":"https://api.github.com/users/jonschlinkert/orgs","repos_url":"https://api.github.com/users/jonschlinkert/repos","events_url":"https://api.github.com/users/jonschlinkert/events{/privacy}","received_events_url":"https://api.github.com/users/jonschlinkert/received_events","type":"User","site_admin":false},"created_at":"2015-04-10T03:54:38Z","updated_at":"2015-04-10T03:54:38Z","body":"> assemble has been great so far! \r\n\r\nThanks! \r\n\r\nThe behavior your describing is all expected. Keep in mind that the markdown helper is \"dumb\" from the standpoint that it just wants to parse markdown. If we want to also parse front-matter, it's probably better to use a different helper alongside the markdown helper. (see below)\r\n\r\nHere's what's happening in your setup, so you can see how some of this works (fwiw this is mostly handlebars conventions, not really assemble per se).\r\n\r\nThe following is just reading the file path and returning a string since the path doesn't match up directly with the basename of any of the partials that were loaded in the assemble config. \r\n\r\n```handlebars\r\n{{md \"app/_content/test.md\" }}\r\n```\r\n\r\nsince it's just a string and not a registered partial or template, assemble doesn't do anything special to it and the markdown parser thinks that `---` is either a horizontal rule (I prefer using `***` for this reason), or a Setext-style markdown header, like:\r\n\r\n```markdown\r\nFoo\r\n---\r\n```\r\n\r\n**Solutions**\r\n\r\n> 1. I can't use YAML frontmatter if I'm using the md handlebars helper. \r\n\r\nYou can, but the `md` helper won't do anything with front matter. You need to parse the front matter before the string gets to the markdown helper. This is exactly why markdown is parsed by helpers and not by an engine. Sometimes you need fine-grained control over exactly where markdown is parsed.\r\n\r\nTo show you how to parse the front matter with a helper, I created [this helper](https://github.com/helpers/helper-front-matter) as an example. It most likely will need to be customized for your use case. If so and I have time before I leave for vacation this weekend I'll put something together for you.\r\n\r\n> Is this expected behavior? Is it wrong to want to use frontmatter within a markdown partial?\r\n\r\nYes, and no. :)\r\n\r\n> 2. It's a little confusing that if I want to use markdown as a partial I have to use a different syntax.\r\n\r\nYour using handlebars, so we have to work within the constructs of the syntax. IMHO it makes total sense to use `{{md \"foo/bar\"}}` for including external content a block helper for wrapping inline content. But this is probably a taste thing.\r\n\r\nFwiw, if you have the ability to use Assemble v0.6.0, none of these challenges are present. \r\n"}}