How to use <$include:/filepath/filename>

I am trying to use <$include:/filepath/filename> to programmatically load a table.

I am compiling from mmd to LaTeX. I have tried three tests.

When I explicitly defined the location for the source the file, it is included and the table is rendered as expected.
Source

<$include:/Users/mmynsted/projects/writing/tla-plus-for-scala/includes/c4model_levels.md>

Result
… the correctly rendered table…

When I use replacements to identify the source file location I get replaced text but no included file.
Source

<$include:%!includedirectory!/c4model_levels.md>

Result

<$include:/Users/mmynsted/projects/writing/tla-plus-for-scala/includes/c4model_levels.md>

When I use a custom metadata field of type, List, with the None value set to the includes path, I also get text replacement and no include.
Source

<$include:<$custom:includesdir>/c4model_levels.md>

Result

<$include:/Users/mmynsted/projects/writing/tla-plus-for-scala/includes/c4model_levels.md>

This is not working the way I would expect.

Section 24.2.8 of the User manual describes <$include> as a placeholder where compound placeholders can be used. There is even an example <$include:<$custom:Epigraph>> that would include the item with the binder name referenced by the custom metadata term Epigraph.

Here are the tests together showing the source file and the result. (The tests are not in the same order in the source file as shown above.)

Scrivener Source

Result (Rendered as a PDF, as I think this is easier to see than the LaTeX.)

How can I make this work?

I have a temporary work-around but it does not use <$include>. Because this is building LaTeX, I was able to use the \input command.

  1. Create a set of replacements (In this order)

  2. Use the replacements this way in the source

%!incTeX`c4model_levels`!

This works so long as the file to be included is TeX. This clearly has limitations.

As a side note… I did not see built-in metadata that designates the path of the current project. I see it’s name, title, and other details but not the path. Is there a way to find this?