# Support Multimarkdown File Transclusion / Import

#### feek

08 Feb, 2015 11:54 AM

Hi Brett,

I've set Marked2 to compile / process with Multimarkdown.

Multimarkdown supports file import (see File Transclusion using the following code:

{{relative/path/to/some_other_file.md}}


But this code is not processed and remains {{test.md}}.

I know Marked imports files via:

<<[relative/path/to/some_other_file.md]

But it would be nice the Multimarkdown file import is also supported.

Regards,
Feek

1. Support Staff Posted by Brett on 08 Feb, 2015 03:33 PM

I had intended this from the day it was added, but MMD uses a different
method for inclusions that isn't compatible with what Marked needs.
Because Marked watches every included file, and any files included in an
included file (nested, or images), the MMD transclusion option cripples
Marked's functionality in that area. It would be easy enough to just
read the transclusion syntax as Marked's own and treat it that way, but
and it hasn't been worth the time to rebuild it as such yet. No one had
ever requested the functionality, so it hasn't been on the top of my
list.

It is still on the todo list, though.

-Brett

2. Posted by feek on 08 Feb, 2015 04:49 PM

Hi Brett,

I do understand your considerations according the rebuilding! However I hope you can implement this ToDo-item sometime in the future. Because mostly I process a MMD file via Marked, but sometimes also directly via Terminal (and/or TextMate).

Regards,
Feek

3. Support Staff Posted by Brett on 08 Feb, 2015 07:28 PM

I had a bit while waiting for some beta feedback, so I implemented a basic handling of the transclude syntax. It bypasses MMD's built-in handling for the sake of integration, but {{filename}} can be used the same way as <<[filename] in the next update. Works with paths relative to the parent file, as well as absolute paths.

It also now recognizes Transclude Base: as well as Include Base: in MMD metadata headers for both transclude and Marked's include syntax (interchangeable with either). The metadata is handled only for the original (parent) file, and is not interpreted in nested files.

It doesn't (at this point) handle the backtick (fenced) syntax for including files without processing. This still requires <<(filename) syntax.

4. Posted by feek on 08 Feb, 2015 07:44 PM

Hi Brett,

Nice!!

Regards,
Feek

5. Brett closed this discussion on 09 Feb, 2015 04:10 PM.

6. Feek re-opened this discussion on 14 Feb, 2015 03:04 PM

7. Posted by Feek on 14 Feb, 2015 03:04 PM

Hi Brett,

tnx for fixing this issue so quickly!

Issues with exporting to paginated PFD and custom css in also seems to be fixed!!!
regards,
Feek

8. Posted by sylvaticus on 15 Jul, 2019 02:35 PM

Heya, Brett,

I am trying to create a demo for my manager to convince him that creating a multimarkdown workflow is the way to go. In my demo, I created some product definitions files. When I add the syntax to my demo Marked 2 only expands the file's text if it starts a new line:

{{filename}}

But if I need to combine two definitions into a paragraph, it only expands the first file:

{{filename1}} and then the user can use {{filename2}}.

Only filename1 gets expanded. Is this something I have done wrong, or just something Marked can't do (yet)?

9. Support Staff Posted by Brett on 15 Jul, 2019 03:09 PM

Marked implements its own version of the file transclusion syntax that does require transclusions to be on their own line. I'll be honest, I just never thought of the possibility that someone would have a use for them inline.

- Brett

10. Posted by sylvaticus on 15 Jul, 2019 03:26 PM

Ahhh…. Thanks!

I admit that most of the examples I see are along the lines of chapters and such:

Filename.md
{{chapter01.md}} {{chapter02.md}} {{chapter03.md}} [these are supposed to be one line each; not sure how to do that with formatting on]

But I LOVE the idea of transclusion! Never knew about it till I read a blog post by the developer of iA Writer.

One way I'd like to use the ability is to maintain a directory of definition files:
/defs /defs/product1 /defs/product2 /defs/product3 /defs/feature1 /defs/feature2 /defs/feature3

etc.

That's why they might occur mid-paragraph:

Donec sed odio dui. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent commodo cursus magna, vel {{/defs/feature1}} scelerisque nisl consectetur et. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec ullamcorper nulla non metus auctor fringilla.

Then, when a feature gets an update or someone changes the name of a feature or product, all I have to do is edit the definition.md file and all the documents are automatically updated; no need to edit each article separately!

Perhaps someday in the future, inline transclusions will be a possibility?

Regardless, thanks SO much for the response and the awesomeness that is Marked!! (I'm creating a demo for my new manager that we should be using a multimarkdown writing workflow (hopefully on GIT) and use Marked (and MultiMarkdown Composer's preview for inline transclusion).

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

### »

#### Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

# Keyboard shortcuts

### Generic

? Show this help Blurs the current field

### Comment Form

r Focus the comment reply box Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

## Recent Discussions

 13 Feb, 2020 09:22 PM Markdown Formatting 11 Feb, 2020 11:53 AM Custom themes not working 10 Feb, 2020 06:48 PM KaTex Preview Update 06 Feb, 2020 04:32 PM Using mermaid in Marked 2 29 Jan, 2020 12:45 AM MathJax rendering errors - Scrivener

## Recent Articles

 Using JavaScript in Marked Custom CSS: Writing custom CSS for Marked License code has already been utilized Highlight sentences longer than a certain number of words How do I retrieve a lost license (direct version)