Skip to content
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

Embedded notes are not exported #14

Open
cloo opened this issue Jul 31, 2022 · 12 comments
Open

Embedded notes are not exported #14

cloo opened this issue Jul 31, 2022 · 12 comments

Comments

@cloo
Copy link

cloo commented Jul 31, 2022

When exporting a note, which contains embedded another note, the embedded note is not rendered.
Instead, only the link is shown:
![[another note]]

@mokeyish
Copy link
Owner

mokeyish commented Aug 1, 2022

Hi, what's your expectation? export together? This doesn't seem like a good idea. Notes may be nested in loops.

@mokeyish
Copy link
Owner

mokeyish commented Aug 1, 2022

It is strongly recommended that you use standard markdown syntax instead of obsidian-extended wiki links. Non-standard markdown parsing requires additional custom development.

@cloo
Copy link
Author

cloo commented Aug 1, 2022

It is natural to expect that contents of exported doc match the one you are exporting, isnt it? You dont expect any markdown code to show up, but the content. Yet the opposite happens.

Embedding other notes is a flexible way to compose complex documents (no idea why else would you nest files). Obsidian seems to be aimed at academic research, which usually involves complex content.

If exporting fails, it makes little sense to use nesting. Also diminishes its usability for publishing.

@nikhildr22
Copy link

Hi @mokeyish ,
Can we use a list or similar data structure to find all nested embedded links and then export all of those embedded files as well?
My thought logic would be:

  1. Find all embedded markdown links if any.
  2. go through those embedded links just like any other linked markdown file.
  3. and This has to be done recursively on those embedded files.

The only condition we need to take care of is that a particular file is not exported multiple times if already exported.
we can use the list we had initially to track these exported files.

ps. I haven't gone through the code base of this repo yet

@mokeyish
Copy link
Owner

@nikhildr22 Hi, which export format that you want to apply this rules? Finding all embeded markdown links just like find all images. here is the code https://github.com/mokeyish/obsidian-enhancing-export/blob/master/lua/markdown.lua

@abserari
Copy link

abserari commented Feb 7, 2023

#14 (comment)
@nikhildr22
Unfortunately, the author is right, recursion is a problem.

Of course, if you are looking for a plugin that can support the export of embedded Notes, you can see this OliverBalfour/obsidian-pandoc#5

But this library and plug-in still cannot be supported! [[Xxx^d83ds]] This type of block reference forming export. according to:OliverBalfour/obsidian-pandoc#23

However, even more, unfortunately, the repo has not been updated for a long time, and the author of the library is very busy according to OliverBalfour/obsidian-pandoc#139, so it is expected to make your own rules and merge with this library. It looks like the best choice.

@FeralFlora
Copy link
Contributor

FeralFlora commented Aug 26, 2023

Mgmeyers Easy Bake plugin handles this issue without infinite loops:

The recursion will end if a note links to a parent note (so it can't go into an infinite loop) or all links have been processed. In theory this could mean easy bake could turn your whole vault into a single note
Although your notes would have to be linked in a way that creates a hierarchy rather than graph for that to happen
[...]
Yeah, it keeps track of all the ancestors and doesn't embed links to any of them

Source: https://discord.com/channels/686053708261228577/969644355042287717/1143309258675453962

@schiessle
Copy link

I have a quite similar issue. I hope it is not to much off-topic, but I think at the root it is the same issue. For me it is not that much about embedded notes but about other auto-generated content like a dataview which creates a table or the output of the task plugin which shows my completed tasks. From time to time also a embedded note.

At the moment the exporter exports the source code of the note, while I assume most people want to export the content they see on the screen in reading mode. No matter what they use to generate it.

I don't see the issue of infinite loops. I think for regular users this is hardly a issue because this would also create the same loop within Obsidian and break their note. But I get that a tool like the exporter also want to prevent malicious behaviour by a bad actor. I think this could be addressed by adding a (configurable) max number of links you follow. Similar like tools such as wget which allows you to fetch websites and follow links.

@mrlinuxfish
Copy link

I have a meta note which is effectively a table of contents for around 20 other notes. I'd like to export all these notes together and set styling with pandoc (the builtin export works ok, but the way it exports themes is not great).

I am able to send my links past a linter to format them in standard markdown, but this only creates a link to a place on disk where the original .md files are.

Is there any way to export the contents of links inline as if they were in the same note?

@FeralFlora
Copy link
Contributor

FeralFlora commented Sep 12, 2023

@mrlinuxfish Transclusion is not supported by Pandoc at the moment, but the issue is tracked here (since 2012!): jgm/pandoc#553. There are some scripting workarounds mentioned there that might be viable to implement in Enhancing export.

For now, you could give Easy bake together with Pandoc reference list a try. The former enables transclusion exports, and the latter renders citations in the export.

@mrlinuxfish
Copy link

@FeralFlora Thanks, it looks like Easy bake is exactly what I'm looking for

@kerim
Copy link

kerim commented May 10, 2024

Forgive me, I'm not a programmer, but I don't understand the problem. If recursion is a problem, can't you simply not do it? That is, only read embeds in a top level merge document, not on the ones that are embedded? For instance, if I have:

Merge Document

[[File 1]]
[[File 2]]
[[File 3]]

And, for some reason, [[File 3]] has a link to [[File 4]], can't that just be ignored? That is, only read embeds in the document the command is run on, not in the embedded files linked from that document.

This would be good enough for my needs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants