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

[Enhancement] Support for "[text](file.md)" link syntax #42

Open
1 of 6 tasks
mcaruel opened this issue Jun 28, 2023 · 7 comments
Open
1 of 6 tasks

[Enhancement] Support for "[text](file.md)" link syntax #42

mcaruel opened this issue Jun 28, 2023 · 7 comments
Labels
enhancement Feature requests

Comments

@mcaruel
Copy link

mcaruel commented Jun 28, 2023

Which part of Cosma is your request about?

  • GUI version (Electron-based app)
  • CLI version (command-line tool)
  • cosmograph (records & cosmoscope creation)
  • cosmoscope (exported graph & records)
  • documentation
  • other

Describe your request:

The documentation says that wikilinks should be written like this: [[20201209111625|une fiche]].
I have a question: does the note id 20201209111625 should be the same as the name of the file ? I usually name the file with the id so that note id 20201209111625 always refer to 20201209111625.md.

Is it possible to make this kind of links [une fiche](20201209111625.md) also work with cosma?

A remark:

  • Pandoc can interpret [[20201209111625|une fiche]] using the extension wikilinks_title_after_pipe, but for some reason it does not handle well the case where the " title" (here " une fiche") is actually a reference such as @einstein-1905 : it just displays "@einstein-1905". However when using the syntax [@einstein-1905](20201209111625.md), the reference is rendered correctly by Pandoc and appears as a link to the 20201209111625.md file. These different markdown syntaxes are driving me crazy !!
@mcaruel mcaruel added the enhancement Feature requests label Jun 28, 2023
@infologie
Copy link
Contributor

Thank you @mcaruel for the suggestion. I'll discuss it with @Myllaume and get back to you.

@zadirion
Copy link

Hello, I am here to support this request as well, I am coming from using vimwiki and needed a good vizualization tool. I was a bit disappointed it's relying on non-standard markdown url syntax and its reliance on the metadata header at the top of the markdown file.

Could the reliance on the metadata header be dropped ( at least as an option that can be enabled) and instead the id of the document be the same as the filename (without the .md extension)?
As someone with an already existing Zettelkasten I am unable to use Cosma, and this will be true for most Zettelkasten users that discover Cosma after the fact. I think it greatly reduces Cosma's potential audience.

@infologie
Copy link
Contributor

@zadirion Thank you for echoing @mcaruel's request. I had not thought about it since my short reply but we're starting a new development cycle right now, so this is a good time to have the discussion.

I'm in favor of supporting [text](filename) and [text](filename.md). But I'm not in favor of making metadata headers optional. It would contradict the design of Cosma, which doesn't just encourage but enforces knowledge organization in a very specific way: hypertext combined with more traditional means such as metadata. There is a reason for this: the purpose of Cosma is to investigate linking as a knowledge organization process, under the hypothesis that it doesn't replace but complements other means of knowledge organization. So, making metadata optional would defeat Cosma's purpose completely.

A few notes:

  • It's interesting (and a little bit funny, at least for me) to compare Cosma with Obsidian in this whole situation. Obsidian was created for a general audience. Then people with specific needs found it, and asked (among other things) for YAML headers. Cosma is the opposite: it was created for a specific audience and now a more general audience has found us, asking (among other things) to make YAML headers optional. Obsidian users waited a long while for YAML headers… but they eventually got them, because the Obsidian developers are building a commercial product and they want a large, diverse audience. On the other hand, YAML headers will have to stay in Cosma, because this is a research experiment, and they're one of the key parameters.

  • We try to loosen some of the initial requirements which were based on my personal situation. For instance, initially Cosma only supported links based on id; then we added links based on title. We did this because, although title-based links are less robust for the initial use case, i.e. personal documentation, they are convenient for other use cases which have emerged since, e.g. a glossary that is made once and then not modified much. Metadata headers are different: they're too integral to the program's purpose to be made optional.

  • The only parameter Cosma requires in a YAML header is title, so you may wonder how we can “enforce” knowledge organization, as I put it, if we don't make e.g. type mandatory. Let's think about it the other way round: we assume that people are using metadata (because we're building the program for people who do so); but we also want to limit friction when creating data. For instance, when creating notes with cosma record, on occasion you may not know what to put in type; so you can leave that field out, because it's optional, and you come back later to add it when you've figured it out.

  • [[id]] and [[id|text]] are not part of the Markdown syntax but they are supported by a lot of tools, including vimwiki. Significantly for us, as @mcaruel mentioned, even Pandoc supports this syntax now. My impression was that the [text](filename) syntax was the marginal one. I think Cosma is following the mainstream in this little Pandoc-based niche… But I'm happy to make Cosma more interoperable around links, because the whole thing revolves around them.

Sorry for the long answer, I take this topic very seriously and it's sometimes hard to condense.

@mcaruel
Copy link
Author

mcaruel commented May 27, 2024

Thank you @infologie for this reply. I am happy to hear that there are Cosma updates ahead. I really believe it will be a very useful tool. I support the enforcement of YAML header. Not having these information is like storing a book in your library without a reference number or an author. The more I think about the necessary features to obtain an effective research tool where information can be retrieved, the more I come to believe that metadata is as important as the note content itself !

This discussion is related to your blog post : https://www.arthurperret.fr/blog/2022-06-15-liens-wiki-et-identifiants.html. There you mention the tryptic title - filename - unique id. I like the idea of using the unique id (UID) as the primary ingredient for internal link, because UIDs are immutable, unlike filenames. This is how Zettlr works. Somehow the standard markdown syntax, does not use a UID to identify the target of a link but the filename like in text or [[filename.md|text]]. This poses the question of the usefulness of UID in the system, and the interoperability between Cosma, Zettlr or just bare .md files in folders.

As I mentioned above I tend to name my files using the UID. This is robust but not very "user friendly" when it comes to finding a note directly in your disk explorer (finder on MacOS). It the latter case, having readable filenames is useful, indeed.

@zadirion
Copy link

zadirion commented May 27, 2024

@infologie
Thank you for the detailed answer. I understand your desire to preserve the identity/vision of the project.

Regarding your statement about [[id]] being supported by vimwiki, apologies if there's any oversight on my part, but an [[id]] will not link to another .md file that has the id written in it only as part of its metadata file and not filename, as far as I know, or am I mistaken?

This means in order to get a functional link as well as a functioning cosma graph, the id has to be duplicated and maintained both in the filename and inside the file, in the yaml header, right?

If that is the case, does this mean existing vimwiki users that already have notes will not be considered a target audience for cosma? since going through the notes and changing file names to ids is not really a practical proposition.

@infologie
Copy link
Contributor

@zadirion

Regarding your statement about [[id]] being supported by vimwiki, apologies if there's any oversight on my part, but an [[id]] will not link to another .md file that has the id written in it only as part of its metadata file and not filename, as far as I know, or am I mistaken?

The confusion is probably on my end, I don't use vimwiki unlike you, I only skimmed through the online documentation. What I meant to say is that vimwiki supports a wiki-like double brackets [[ ]] link syntax in addition to the standard Markdown [ ]( ) link. I don't know how vimwiki works beyond that, when it comes to file names and identifiers. I only wanted to point out that the double brackets syntax, while "non-standard Markdown", is arguably the more standard link syntax for wiki-influenced plain text tools.

This means in order to get a functional link as well as a functioning cosma graph, the id has to be duplicated and maintained both in the filename and inside the file, in the yaml header, right?

No, Cosma's only requirement is a YAML header with a title field. You could use an id field but it's optional, and when there is no id field, Cosma uses the value of title as an identifier.

So if you have for instance a note called A note.md, and other notes that link to it as [[A note]], all you would need is to add a YAML header with title: A note inside A note.md for Cosma to work. You don't have to modify the filename.

@infologie
Copy link
Contributor

infologie commented May 28, 2024

@zadirion I almost forgot to address the last sentence of your message, which was just as important:

If that is the case, does this mean existing vimwiki users that already have notes will not be considered a target audience for cosma? since going through the notes and changing file names to ids is not really a practical proposition.

Our target audience is either people who already use Pandoc's Markdown, and are happy to find a tool that's mostly compatible with it, or people who are fine with adopting this syntax, whether for a single project or for long term use. We don't have the resources to address other use cases.

edit: Maybe we should advertise this more clearly on the website. It does say at the top of the home page "if you have a personal wiki, Zettelkasten or digital garden…", suggesting Cosma will adapt to it, which may be misleading.

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

No branches or pull requests

3 participants