-
Notifications
You must be signed in to change notification settings - Fork 92
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
File Transclusion doesn't work when reading stdin #181
Comments
I'm using the macOS build of 6.5.1 from here. |
Is there a way to set the transclude base as a command-line argument? That would avoid the need to create a temporary file to work around this. |
Transclude base can be a relative path, which would still not work from stdin. (In fact, some of the most useful (and challenging!) ways of transcluding makes use of relative paths.) And the files that you pull in from the "virtual file" on stdin could, themselves, transclude other files which could use relative paths, even if you forced an absolute path the first time. Transclusion without starting from a fixed location on disk opens up a lot of edge cases that I worry would not work properly. I'll keep this open as a reminder to reconsider periodically, but for the moment I still think of transclusion as a feature that should require working from a fixed file on disk. |
Thanks for the quick response, @fletcher! I understand the dilemma. Please feel free to put this on the someday/maybe list. I will use temporary files as a workaround for now. Just a suggestion: could you mention this in the docs? I spent quite a while trying to figure out why it wasn't working. I'd hope other users don't run into the same problem. |
That's fair -- can add to documentation when I get a chance. Thanks! |
We just caught a customer case about this; BBEdit 13.1 and later allow specifying a custom Markdown processor for previewing and HTML exports. There are several built-in options that are explicitly supported, including Multimarkdown. In BBEdit, preview generation works by supplying the document's text on stdin (for various reasons), so transclusion unexpectedly (to the user) doesn't occur. I won't pretend to know how Multimarkdown works internally; but I think there's probably a viable solution that includes one or more of the following strategies (any or all of which might only apply when reading from stdin):
|
I'll need to keep considering this. Something about the proposed solutions doesn't "feel right" -- I worry about there being further edge case bugs if done incorrectly. Based on the way that MultiMarkdown handles absolute and relative path determination and prevents infinite loops, what might be workable would be a way to specify a "virtual" path to the file when it passed on stdin. It should be the path to a specific file (that doesn't necessarily have to exist), NOT a directory. In the case described in BBEdit, it should be the path to the user file, even if the file text is sent via stdin instead of being read directly from the file.
|
As a reference, the combination of Cause: markdown-mode.el sends info to |
After I read the Transclusion Preprocessing section in the MultiMarkdown User Guide, I tried configuring |
File transclusion doesn't work, even if
Transclude Base
is included at the top offile1.mmd
with an absolute path.The text was updated successfully, but these errors were encountered: