Closed anutator closed 1 year ago
You can find some LUA filters here, but basically I'm facing the same problem.
This extension is supposed to be a general extension, not Obsidian specific. So, I'm wondering whether ! + wikilink = image in other markdown applications that support wikilinks (e.g. GitHub wiki).
Good question, I don't know either. So maybe a filter to convert wikilinks to MD links would be recommended? Or using only MD links?
On Mon, Jul 3, 2023, 17:48 John MacFarlane @.***> wrote:
This extension is supposed to be a general extension, not Obsidian specific. So, I'm wondering whether ! + wikilink = image in other markdown applications that support wikilinks (e.g. GitHub wiki).
— Reply to this email directly, view it on GitHub https://github.com/jgm/pandoc/issues/8853#issuecomment-1618740988, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADCL5FG2GZPW6PQBTZYZHZTXOLSUPANCNFSM6AAAAAAYBZH5J4 . You are receiving this because you commented.Message ID: @.***>
For an obsidian-specific solution, you just need a filter that finds the sequence
Str "!", Link {}
and converts this to an Image. That's not the easiest kind of filter to write but it's possible.
Wikilink images now supported.
Wikilink images now supported.
Great news! Has this already been released?
No, it will be in the next release. Probably within the next couple of weeks?
No, it will be in the next release. Probably within the next couple of weeks?
Okay, thanks for the answer. Looking forward to it!
I am running Pandoc 3.1.8, with Obsidian.md and Pandoc plugin 0.4.1
Simply running the pandoc MD to DOCX results in an error. The path of the image files are incorrect, regardless of --resource-path=files
; it is ignored.
What settings need to be configured to properly export to a Docx?
@Demon-tk Are you using the wikilinks_title_after_pipe
extension? Also, Do you have a proper path in your --resource-path
?
@FeralFlora Thanks for the response, where do I enable extensions? P.S. The path appears correct.
@FeralFlora Thanks for the response, where do I enable extensions? P.S. The path appears correct.
You add it to the input format (from) like so -f markdown+wikilinks_title_after_pipe
.
@FeralFlora Thanks for the response, where do I enable extensions? P.S. The path appears correct.
You add it to the input format (from) like so
-f markdown+wikilinks_title_after_pipe
.
Above I have put my Obsidian Pandoc settings. Additionally my extra arguments are:
--resource-path=files
--from=gfm+wikilinks_title_after_pipe
EDIT:
After checking the docx file it appears that the images are turned into words rather than the actual image. Any idea what I'm doing wrong?
@Demon-tk Since you edited you comment, I have to ask if you are still having errors or not, as you mentioned earlier?
I think you should consider switching to the Enhancing export plugin, since it is still maintained, and allows you to customize your whole command, not just add extra arguments. But regardless, I think image wikilink exports should work through the Pandoc plugin using extra arguments—it works for me.
I have a source file
# Test
![[Attachments/test.png]]
And Pandoc command like this: pandoc -f gfm+wikilinks_title_after_pipe -t gfm --resource-path='<my-attachments-path' --columns=120 -o out.md in.md
And the result is:
# Test
\![Attachments/test.png](Attachments/test.png "wikilink")
For some reason Pandoc comments out the image.
This will currently work with markdown
but not gfm
.
You can add a new issue requesting support for gfm
and commonmark
.
This shouldn't be too hard to add.
This will currently work with
markdown
but notgfm
.
Indeed! Thank you for a prompt response. I'll add an issue.
@jgm, I wonder if it's also possible to transform paths of wikilinks somehow? For example - if I have wikilinks pointing to a subfolder - can Pandoc rewrite them to point to the top-level folder?
You can use a filter to rewrite wikilink URLs. See the docs on pandoc.org for Lua filters.
I use Obsidian and Pandoc Plugin to export to epub, html, docx.
There are new extensions in Pandoc 3.0 for wikilinks: "Add new extensions wikilinks_title_after_pipe and wikilinks_title_before_pipe for commonmark and markdown".
They can't export Obdisian images with ! to markdown image links:
![[image1.png]]
— image wikilink in Obsidian.I get ! and an image URL, so images are not inserted. Besides I have two problems:
--resource-path=assets
.--from=gfm+wikilinks_title_after_pipe
text is exported from Obsidian without colors from Obsidian theme.I'd like to automatically export wikilinks to markdown links not only for URLs but also for images, with title from image file name if it is not specified. Please add features to your extensions and give examples.
Current alternative: At first I convert wikilinks to markdown links from every article I want to export with another plugin obsidian-link-converter . Or I can convert all wikilinks from my vault.