Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Markdown content it's not being rendered as HTML #345

Closed
zenorocha opened this issue Nov 18, 2012 · 2 comments
Closed

Markdown content it's not being rendered as HTML #345

zenorocha opened this issue Nov 18, 2012 · 2 comments

Comments

@zenorocha
Copy link

Hey guys,

I have a list of markdown files under /documents folder.
And I want to list them inside of a layout, like:

<% for item in @getCollection('documents'): %>
    <%= item.content %>
<% end %>

But the markdown content it's not being rendered as html.
I'm using docpad-plugin-marked and here's the project structure.

  • /documents
    • abc.html.md
    • def.html.md
    • ghi.html.md
  • /layouts
    • default.html.eco

Full project link.

Thanks!

@balupton
Copy link
Member

Hey mate, few things could be going on:

<% for item in @getCollection('documents'): %>
    <%= item.content %>
<% end %>

will need to be:

<% for item in @getCollection('documents').toJSON(): %>
    <%= item.content %>
<% end %>

or

<% @getCollection('documents').forEach (item) ->: %>
    <%= item.get('content') %>
<% end %>

as we are dealing with backbone collections and models.

The other thing is that you'll probably want to use contentRenderedWithoutLayouts or contentRendered instead of content as the content variable is subject to change during the rendering process. More on the available properties and their meanings here: http://bevry.me/learn/docpad-meta-data

@zenorocha
Copy link
Author

Great! It worked with <%- item.contentRenderedWithoutLayouts %>.

Thanks a lot @balupton =D

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

No branches or pull requests

2 participants