-
-
Notifications
You must be signed in to change notification settings - Fork 56
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
When exporting all my notes to Markdown, denote:
links point to .org
files
#417
Comments
Hello @unindented! Can you please show me some sample files that I can use? I want to check what is happening here. We do not have any code for the various Org export backends though. |
Thanks for your help @protesilaos. I've created a minimal repro at https://github.com/unindented/denote-417-repro.
I think Lines 4822 to 4831 in 3ae863f
|
Thank you for this! I now see that this is specific to the Note that here we are not testing just for the ((eq format 'ascii) (format "[%s] <denote:%s>" desc path)) Plus, with the |
You'll see the same behavior if you run I've updated the repro repo to show the difference in behavior between
For Lines 4792 to 4795 in d3e3762
I don't know... And
Yup, I think that's the mismatch between the built-in In Not sure what the right path is here. Maybe |
From: Daniel Perez Alvarez ***@***.***>
Date: Sun, 1 Sep 2024 00:43:52 -0700
> I now see that this is specific to the `org-publish` case which goes through all the files
You'll see the same behavior if you run `org-md-export-to-markdown` or
`org-md-export-as-markdown` on an individual file with `denote:`
links. That is, those links will maintain the `.org` extension, while
`file:` links will not. I believe `org-publish` is built on top of
`org-export`, so they should show behave the same in this regard.
[... 19 lines elided]
Not sure what the right path is here. Maybe `denote` could expose an
option equivalent to `org-html-link-org-files-as-html`, which would
cause it to change the extension of links to match the exporting
backend? So if you're exporting with `'md` backend all links to `.org`
would get translated to `.md`, et cetera?
The introduction of a variable is a reasonable approach. Though I am
curious to understand why 'file:' links behave this way, as you note
above. In principle, 'denote:' should be the same as 'file:' in this
regard.
I know there are places where Org hardcodes the assumption that a link
is 'file:' or 'id:', such as with image previews. This is not good,
because it defeats the purpose of custom hyperlink types (I have been
meaning to file a bug for image previews, but have not found time to do
it).
So we can add the variable to fix the immediate problem, but it is best
we also fix Org in the process to help us make 'denote:' links first
class citizens.
…--
Protesilaos Stavrou
https://protesilaos.com
|
I think when you call Line 4819 in d3e3762
I don't know if there's a way to call the "parent" export function, as maybe that'd be a more elegant approach. In that hypothetical, |
From: Daniel Perez Alvarez ***@***.***>
Date: Sun, 1 Sep 2024 08:51:46 -0700
> In principle, 'denote:' should be the same as 'file:' in this regard.
I think when you call `org-link-set-parameters` with an `:export`
option, you're overriding the behavior of the Org export backend in
use:
https://github.com/protesilaos/denote/blob/d3e3762fe4ac5e3ac664bdeb49ea811d11d345ac/denote.el#L4819
Yes, that makes sense. We need to do this to guarantee the desired
behaviour of converting the link to a file path. But then we have the
problem you have identified.
I don't know if there's a way to call the "parent" export function, as
maybe that'd be a more elegant approach. In that hypothetical,
`denote` converts the `denote:` link into a `file:` link with the
right path, and then calls the parent export function with it. Does
that make any sense?
Sounds good, though I am not aware of a way to do this. If you know,
then I am happy to go ahead with it.
Though, again, I suspect part of the issue here is with Org hardcoding
some logic for 'file:' links. I have not checked for this case, though I
have seen it before. If there was some passlist that packages could
register themselves to and then, perhaps, define all the extra functions
they need, it would make all custom link types equally good.
…--
Protesilaos Stavrou
https://protesilaos.com
|
The
ox-md
export engine, whenever it finds a link to a.org
file, it replaces its extension with.md
:https://github.com/emacsmirror/org/blob/master/lisp/ox-md.el#L545-L548
The
ox-html
export engine does a similar thing (iforg-html-link-org-files-as-html
is non-nil):https://github.com/emacsmirror/org/blob/master/lisp/ox-html.el#L3266-L3274
It seems like denote translates to
.html
when the backend is'html
:https://github.com/protesilaos/denote/blob/main/denote.el#L4792-L4795
But it doesn't do the same for
'md
:https://github.com/protesilaos/denote/blob/main/denote.el#L4799
Is there a way to get
denote:
links to behave like normal links to.org
files when in'md
?The text was updated successfully, but these errors were encountered: