Internal links are using wrong file names
matboehmer opened this issue · comments
I am testing yarle 5.7.0 for migrating from Evernote to Markdown and like it a lot so far. However, I am having an issue that yarle 5.7.0 is using an arbitrary file name. Example:
[FOO, BAR, MeetingSerie, 1. Dezember 2022](enexfolder/abitraryfilename.md)
The title FOO, BAR, MeetingSerie, 1. Dezember 2022
is fine, but enexfolder/abitraryfilename.md
does not exist. Interestingly, the "enexfolder/abitraryfilename.md" somehow makes sense since it uses words and strings which I sometimes use in my notes, but I cannot surely relate it easily to a single note item. Clicking on the link in Obsidian creates a new file.
My config.json
{
"enexSources": [
"/.../enex-exports/"
],
"templateFile": "/.../template.md",
"outputDir": "/.../Obsidian Vault/_Evernote",
"isZettelkastenNeeded": true,
"useZettelIdAsFilename": false,
"plainTextNotesOnly": false,
"skipWebClips": false,
"useHashTags": false,
"outputFormat": "StandardMD",
"taskOutputFormat": "ObsidianMD",
"keepImageSize": "ObsidianMD",
"urlEncodeFileNamesAndLinks": true,
"skipEnexFileNameFromOutputPath": false,
"monospaceIsCodeBlock": true,
"keepMDCharactersOfENNotes": false,
"keepOriginalAmountOfNewlines": false,
"addExtensionToInternalLinks": true,
"nestedTags": {
"separatorInEN": "_",
"replaceSeparatorWith": "/",
"replaceSpaceWith": "-"
},
"replacementCharacterMap": {
" ": "-",
",": "-",
"<": "-",
">": "-",
":": "-",
"\"": "-",
"/": "-",
"\\": "-",
"|": "-",
"?": "-",
"*": "-"
},
"resourcesDir": "_attachments",
"turndownOptions": {
"headingStyle": "atx"
},
"dateFormat": "YYYY-MM-DD",
"haveEnexLevelResources": true,
"haveGlobalResources": false,
"useUniqueUnknownFileNames": true,
"logseqSettings":{
"journalNotes": false
},
"obsidianSettings": {
"omitLinkDisplayName": false
}
}`
my template
---
{created-at-block}created-at: {created-at}{end-created-at-block}
{updated-at-block}updated-at: {updated-at}{end-updated-at-block}
{source-url-block}source-URL: []({source-url}){end-source-url-block}
{tags-block}Tags: {tags}{end-tags-block}
{location-block}latlong: {location}{end-location-block}
---
{title-block}# {title}{end-title-block}
{content-block}{content}{end-content-block}
I am running yarle from command line
npx -p yarle-evernote-to-md@5.7.0 yarle --configFile ./config.json
Yihaa, thank you for reporting me this issue and to let me improve Yarle!
I have created a small demo set for replication. This is the content of yarletest.enex
:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE en-export SYSTEM "http://xml.evernote.com/pub/evernote-export4.dtd">
<en-export export-date="20231020T230501Z" application="Evernote" version="10.61.10">
<note>
<title>second note</title>
<created>20230920T225715Z</created>
<updated>20230920T230026Z</updated>
<note-attributes>
<author>Matthias Böhmer</author>
</note-attributes>
<content>
<![CDATA[<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml2.dtd"><en-note><div><a href="evernote:///view/12752282/s96/7648fa9c-4cff-7651-ab00-cc4089058883/e68db5e0-11ee-55b5-bed6-af6a365a4efd/" rel="noopener noreferrer" rev="en_rl_none">second note</a> self </div><div><a href="evernote:///view/12752282/s96/180970fd-f387-6b70-6405-a9ba33dcab4a/e68db5e0-11ee-55b5-bed6-af6a365a4efd/" rel="noopener noreferrer" rev="en_rl_none">first note</a> other</div></en-note> ]]>
</content>
</note>
<note>
<title>first note</title>
<created>20230920T225710Z</created>
<updated>20230920T225915Z</updated>
<note-attributes>
<author>Matthias Böhmer</author>
</note-attributes>
<content>
<![CDATA[<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml2.dtd"><en-note><div><a href="evernote:///view/12752282/s96/7648fa9c-4cff-7651-ab00-cc4089058883/e68db5e0-11ee-55b5-bed6-af6a365a4efd/" rel="noopener noreferrer" rev="en_rl_none">second note</a> other </div><div><a href="evernote:///view/12752282/s96/180970fd-f387-6b70-6405-a9ba33dcab4a/e68db5e0-11ee-55b5-bed6-af6a365a4efd/" rel="noopener noreferrer" rev="en_rl_none">first note</a> self</div></en-note> ]]>
</content>
</note>
</en-export>
In Evernote one note provides a link to the other. But the two files generated by yarle are first-note
:
---
created-at: 2023-09-21
updated-at: 2023-09-21
---
# first note
[[first-note|second note]] other
[[first-note|first note]] self
and second-note
:
---
created-at: 2023-09-21
updated-at: 2023-09-21
---
# second note
[[first-note|second note]] self
[[first-note|first note]] other
The link to the second-note
is lost.
Looking at my original data set I somehow have the impression that yarle looses track of cross references and at some point only uses one arbitrary reference.
Hi @matboehmer !
Thanks for raising this issue, I investigate it asap.
HI @matboehmer ,
I checked the issue, and it occurs only if the text of the link differs from the title of the note that the link refers to.
It is a known issue, and its root cause of that Evernote does not store the unique ID of a note in the enex file (which makes its own export-import lose the links also). It means that even if the link is there, we don't know what it refers to if we just see the Ids. That's why I had to implement a workaround to support at least a subset of the links, especially those whose text is the same as the title of the target note, this is the chain that Yarle recognizes as links. I'm thinking on a more sophisticated solution, but as long as Evernote does not serves the proper information, we have to deal with such inconviences.
So my suggestion would be to update your notes to match the links with the target note titles.
And please note that Zettelkasten prefixes still does not work with links as it is reported here: #209
I'm sorry for the inconviences, and thank you for your understanding.
Okay, thank you very much! When I looked into the xml code of EN I was already wondering how it keeps references, since no IDs are being kept within the <note>
. However, when import yarletest.enex
back into EN these links are working. Maybe those internal IDs are some kind of hash values?
I don't think so, they seem to be UUID4.
And I'm not able to make the import work properly with the exported links. Are you sure that you removed the previous notes (which were exported) and empty the trash prior you imported the enex?
You are right. Various ressources are reporting, that internal links break when importing enex freshly or into another account.
However, for yarle: Would it be possible to create a link to the file which has a name most similar to the link title (e.g. using some string metrics like Levenshtein distance)? I guess this would result in more working links, at least on my note notebooks. Manually editing the links does not seem to be appropriate, b/c there are too many.
Okay, it makes sense, but it can easily result a very bad linking, so I think I'll highlight it in the UI to use only it if you know what you're doing. Or they convert the notes a second time too, so it's not a big deal. :)
Okay, as this is a feature request now, let me create a new issue for it, and close this one as "3rd party problem".
@matboehmer, here we go: #531
And thanks for raising this idea, it's a good one!