-
Notifications
You must be signed in to change notification settings - Fork 23
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
Make plugin compatible with wikilinks and all paths #74
Comments
Thanks. There are two ways to support wikilinks.
What do your think? |
I see. I'm way more familiar with the Typescript approach, as I help code another plugin. I might hold off on working on it for now, as exporting to standard markdown is on the Obsidian roadmap. Once that comes out, it will probably be the best solution. In the meantime, if anyone else is looking for ways to convert their notes for export, they can use the Link Converter plugin mentioned above to prepare their files for export. I personally use the Obsidian Commander plugin to create the following macro for exporting: I duplicate the note to be exported (so my export preparation doesn't affect the actual note), then use Link Converter to turn all links into standard markdown, then run Linter to standardize my note to match standard Markdown specs and avoid formatting issues with Pandoc, then export. |
@Comprehensive-Jason That's comprehensive alright! Thanks for the Commander macro suggestion! |
I talked with the Obsidian devs about whether exporting to standard markdown is still a planned feature. They told me the feature will come later and to go ahead with the workaround. I will start work on adding the conversion code. |
In any case, this plugin uses Pandoc, and it is not limited to conversion to Markdown, so it will be relevant even if the Obsidian devs implement .md export |
@vanem I'm not trying to convert just to standard Markdown, I'm trying to preprocess Obsidian notes into standard Markdown so that this plugin works correctly. The chief issue with this plugin right now is that it (and Pandoc) requires standard Markdown links with relative file paths in order to convert properly, while most users of Obsidian use wikilinks with just the file name. Extra code is needed to convert Obsidian wikilinks into standard Markdown so that the plugin works for everyday users. |
This plugin has been compatible with wikilinks for a while using Pandoc extensions, and yesterday, it also became compatible with wikilink images with the latest release of Pandoc! 🎉 The specific attribute that you need, to enable wikilink support, is:
To use it, change the default export command (for example to PDF) to:
You can also add other extensions like
Also note that I removed some bloat in the command, as mentioned in #115. |
This is pretty cool! I presume we still have to convert to relative file paths though? |
Nope, not as long as you supply the resource-path, as in my example above (which is included by default, I think), then it should work with only the filename. Upgrade to Pandoc 3.1.7 and give it a try! However, note that image sizing is not working yet, since you can't use link attributes with wikilinks. I've raised this issue on the Pandoc repo here, but the devs are reluctant to support the combination of Wikilinks + link attributes, since the apps that use wikilinks don't support the link attributes syntax. You're welcome to join the conversation over on the Pandoc repo! On the Obsidian side, there's discussion in Forum about supporting link attributes or expanding the existing image sizing syntax to support units here. |
@FeralFlora Gotcha. Currently I'm testing with the following:
Internal links and embedding works fine with the following folder structures:
When However, when I use a more normal folder structure, where
I think the issue is with how the plugin is replacing When I explicitly insert the full path "C:\Users\jason\AppData\Roaming\obsidian\Obsidian Sandbox\Attachments" instead of using All in all, I think this is quite a minor fix for the plugin. First, we replace |
For some reason, using these settings I can't export contents of an expanded link such as |
@mrlinuxfish This is a different issue tracked in #14 . |
For me, I can export with the command I shared, even though my files are located as follows:
I just realized that this is because I have the full resource path in my defaults file. This is what enhancing export prints in the console: So I guess it would fail for me without the defaults file too, and you are right that
I agree, such a toggle would be nice. |
@FeralFlora Sounds like a plan! I'll get working on a PR for it then. |
Thanks, i use the second way,it works here is the lua code:
|
@TimFruit Looks great, Are you willing to submit a PR? |
sorry,i don't want to submit a PR. Writing pandoc lua scripts is difficult for me, I asked chat gpt to get this code |
For standard markdown, wouldn't it be easier to just add the As is, Until then, the lua filter might be relevant for @Comprehensive-Jason mentioned making a PR to change the default command, not sure if there's any progress on that? This requires |
@Comprehensive-Jason I was wondering whether you need help with the PR? |
Just voicing my enthusiastic support for this |
Folks, I've been working on a similar problem, to get Obsidian style "|100" to set the width for images in pandoc beamer output. Thought I would share some code here in case it helps with this problem. The following works for wikilink images to propagate any given width/height attributes to resize the image:
e.g.
P.s. The approach is not perfect for my use case because I would like to remove the width attribute from the display figure caption. Problem is that even thought the element caption is updated, the figure remains showing the old caption. As a MWE to illustrate the problem, try this filter:
when applied to a document with:
we get: (image hidden; only caption shown) So the image caption is updated, but the figure text is not. It seems like pandoc generates the figure text before the lua filter sees element. The following for example updates no "Figure" captions, though the element is updated.
|
@Comprehensive-Jason @universvm I just submitted a PR which introduces this change: #174 |
Currently, the plugin is not compatible with wikilinks and only works on embeds with relative file paths.
The Obsidian Link Converter plugin can convert all the wikilinks in a file into Markdown, and all paths to relative file paths.
The Converter plugin's code could be integrated into this plugin to increase Obsidian compatibility. Wikilinks and paths could be automatically converted into markdown and relative paths.
If needed, I can help with this project. Could have a couple of pointers on where best to add the necessary code in this repo?
The text was updated successfully, but these errors were encountered: