-
Notifications
You must be signed in to change notification settings - Fork 17
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
Line Number Link feature should be depreciated #22
Comments
I disagree.
For me the ability to link into another file by line number is a neat fallback from more advanced semantically anchord links and actually lets the link system extend beyond just other norg files or generic file-level links. It is not a perfect tool, but it is a tool that exists at all for those cases where i.e. you link from a note to a part within the source code. This was always IMO one of the weaknesses of markdown-based notes: they capsule links away too much between each other and don't allow you to reach into the wider file system. Neorg does, and the capability to specify a line number to open on is a simple extension of that, that has some use. |
I agree that it is useful when linking to source code file. Maybe we can change the behavior of line number linking to only support source code files. Norg is a free-form markup language, which means the line number can be easily change when formatting or converting to other formats. Linking to line number would not work well when it is linking to Norg files. How about following GFM style ( Line Number feature itself can exists, but I think we need to remove linking to line number of current(or other) Norg file feature. It will make implementing parser or formatters way harder. |
Could we alias "linking to line number" as „link to paragraph block“ to alleviate some of the issues? With line numbers that target into white spaces between paragraphs snapping to the nearest block, biased downwards? |
That still leaves the main problem: line number can be changed in same Norg document. i.e.
This Norg file should be equal to:
To solve this issue without removing the feature itself, all kinds of Norg formatter/converter should re-calculate the line number. linking to Block should be implemented with something like carryover tags, not via line numbers. |
In that case I might agree with supporting the notion of doing line number-based links only to non-norg files. |
This is the biggest blow to the existing line number implementation. I agree that deprecating such a link might be a good idea. The Although I have a counterargument which I just realized now. The existing syntax actually allows for a very useful generalization of line number links. I really dislike the
If we really want to deprecate the |
One good option I think that was already outlined is that the first place where the syntax breaks is when line number targets go from a Neorg file to another neorg file. So if we disallow targeting line number links into other norg files, we could solve most to all of the problems that cause this? That said, this could break again if something like a link target to another file in say ASCIdoc exists and that file gets converted too. |
On second thought what I like about the idea of generalizing the scoping delimiter is that it could also allow things like injecting custom link handlers into tired scope searches? If true, that would make the syntax more general and more powerful extendable. |
@SevorisDoe this would actually make the syntax very satisfyingly consistent. Currently URIs cannot have an attached path (obviously): |
@boltlessengineer what are your thoughts on these compromises? Summary:
|
Yeah, we can then define tired parsing to either supply a "pasable within scope" by returning some limited-scope object, or it returns an "end of parse" capper that terminates the pipeline and returns the resolution of the link?
we could model this, for the purpose of link resolution, in that searches using headings return virtual file objects of increasingly smaller sizes? THat may break the interpretation of some objects that require scope beyond the virtual view, IDK. exciting thought - if you can do tired searches, doing something like "call the URL, get a document return, then scope within the document" actually becomes possible? |
I agree what you said @vhyrro . Consistency is definitely one of most important parts in Norg syntax. But still, line number would only works well for I'm thinking new So if user wants to link to specific line of file, they can use
|
How does that avoid breaking? The cause of breaking line number links, to my understanding, is that the target can‘t be garuanteed to be stable in that line number under conversion. |
Sorry for the lack of explanation. I meant to add syntax to the
|
This is an auxillery idea to what started this issue, but what I like about the scope syntax in a larger view is it could be extended with custom target scope parsers such as say, Markdown element targeting commands or other such things. (Maybe external file links could point to function artefacts for a given language?) I like the idea of a separate syntax to keep users from messing things up, but I would like to synergize it with the above idea to have that extension possibility in the spec. |
Ok, then how about allow existing line number links only at the end of scoping? Invalid:
Valid:
Now user can have line number inside Norg file... We should at least note that this may break on Norg files. (another LSP feature idea here) Edit: typo |
The thing is, we cannot garuantee that there isn't a custom scoper function below that that may still resolve a valid target. If we have LSP feedback, we can actually just throw "link spec failed to bind" and print the error report. Thinking about this bit that @vhyrro said:
|
I feel Line Number Link feature in Norg is bit nonsense considering Norg is a free-form-markup.
In these reasons, I think line number link feature should be depreciated, or replaced to another feature (maybe link to nth footnote .)
Line Number Link is easy to parse, but It would be really hard to implement it's feature.
The text was updated successfully, but these errors were encountered: