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

[MINOR] org-transclusion support #105

Open
tefkah opened this issue Oct 12, 2021 · 6 comments
Open

[MINOR] org-transclusion support #105

tefkah opened this issue Oct 12, 2021 · 6 comments
Labels
minor feature Feature request inline with current graphing capabilites

Comments

@tefkah
Copy link
Contributor

tefkah commented Oct 12, 2021

** Have you checked whether this feature is not already on the project board?

Yes

Is your feature request related to a problem? Please describe.

Org-roam-ui doesn't do anything with transclusion made with org-transclusion atm, which is a shame.

Describe the solution you'd like

a) Have these transclusions recognized by uniorg
b) Show transclusions as a special link which can be expanded into the current text (probably should set it to auto-expand)

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

@tefkah tefkah added the minor feature Feature request inline with current graphing capabilites label Oct 12, 2021
@rasendubi
Copy link
Contributor

a) Have these transclusions recognized by uniorg

I think the easiest way to implement this is to add a unified plugin after uniorg-parse that would traverse all #+transclude: keywords and process them (keywords are already recognized by uniorg). Probably, convert them to hast element nodes. uniorg-rehype will pass them forward untouched. Then you can use a custom component in rehype-react to implement expansion.

I don’t think I can support this from uniorg side as uniorg does not have access to other org files (unfortunately). Looking through org-transclusion, one thing that is missing in uniorg parser is targets. I’ll try to add this soon.

@tefkah
Copy link
Contributor Author

tefkah commented Oct 12, 2021

Wow that's a faster response than I could even hope for! Yes that would be my ideal solution as well, as long as I can have access to them after uniorg-rehype is done with them I will figure out the rest!
Thank you so much!

@rasendubi
Copy link
Contributor

The key is to add a unified plugin between uniorg-parse and uniorg-rehype.

Something like this:

unified()
  .use(parse)
  .use(() => (node) => {
    // visit from unist-util-visit
    visit(node, 'keyword', (keyword) => {
      if (keyword.key.toLowerCase() === 'transclusion') {
        // h from hastscript. or manually as { type: 'element', tagName: 'transclusion', properties: { value: keyword.value } }
        Object.assign(keyword, h('transclusion', { value: keyword.value }));
      }
    })
  })
  ...
  .use(uniorg2rehype);

@meedstrom
Copy link

meedstrom commented Feb 11, 2022

I do not know what unified or uniorg are. I don't suppose someone could advise me on how to learn enough to implement this?

@rasendubi
Copy link
Contributor

rasendubi commented Feb 12, 2022 via email

@Zerogaku
Copy link

Zerogaku commented Dec 25, 2023

It's the only thing currently stopping me from fully using org-transclusion 😅, wouldn't org transclusion act as a reference node of sorts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
minor feature Feature request inline with current graphing capabilites
Projects
None yet
Development

No branches or pull requests

4 participants