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

Added support for @@include tag which will allow embedding html files from the '_partial' folder #27

Closed
wants to merge 1 commit into from

Conversation

seemantr
Copy link
Contributor

@seemantr seemantr commented Mar 5, 2016

Include tag allows embedding file into the generated document. This is very useful if you want to embed the same text more than once across different pages. This is a very simplistic implementation which does not require changes to the underlying Markdown parser and uses regex expression.

@FransBouma
Copy link
Owner

Ah I was under the impression it included markdown snippets :) (so it would parse the markdown file first for includes, parse those for includes using a set of already includes to avoid cycles etc. till no includes are found, merge included markdown in-place, then return that as the markdown to use). (which would require markdown parser adjustments)

Having @@include include literal fragments would make that of course not possible anymore. Hmm... Not sure what the best option is. @@include-html or @@includeliteral or @@includefragment all sound verbose.

It also might be done on-the-fly though: @@include("bla.md") is included into the markdown as-is, but so is @@include("bla.htm"). So before parsing/handling markdown. The markdown parser can deal with html, so that's not a problem (although I haven't tested that in full, e.g. a markdown pre block whether that's still converted or not I don't know). IF the markdown parser can deal with it without a problem, a recursive include is best, before parsing.

What are your thoughts on this?

@seemantr
Copy link
Contributor Author

seemantr commented Mar 6, 2016

I feel @@include on the fly is the best option as it is very simple to implement without touching the markdown parser. I really like the idea of embedding the source content before handing things over to markdown parser, that way the same include block can support both html and markdown.

Should be a very simple change. I will make it and submit a new pr. I can use the same approach for adding support for @@render tags also.

@FransBouma
Copy link
Owner

Sounds good! Your regexp version does a 1 level include I think? (the included markdown isn't parsed for include statements again). That's fine though, it can always be extended to be a recursive include :)

@seemantr seemantr closed this Mar 7, 2016
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

Successfully merging this pull request may close these issues.

2 participants