nvim-neorg / norg-specs

A collection of specifications and grammars for Neorg's file format, `norg`.
90 stars 17 forks source link

Edge Cases Thread #24

Open vhyrro opened 1 year ago

vhyrro commented 1 year ago

All the Edge Cases

The specification isn't perfect, and as such this thread exists for any other parser writers to ask questions or note inconsistencies/ambiguities in the spec.

cc @boltlessengineer :D

boltlessengineer commented 1 year ago

whitespace/end-of-line rules in link destination:

{/ pa
th/to
/file.txt}

{:pa th/t\ o/file:}

{:path/t\
o/file:}
boltlessengineer commented 1 year ago

link destinations should be case-insensitive

I couldn't find this in doc, but Neorg seems to be working like this.

$ Paragraph Break
description

... {$ Paragraph Break} ... %this is valid%
... {$ paragraph break} ... %this is also valid%
boltlessengineer commented 1 year ago

What happens when we put carryover tag inside attached modifiers? Considering the precedence, should it break the attached modifier? Or as line-ending inside attached modifier can be ignored, carryover tag inside attached modifier is just invalid?

*bold
+color red
text*

Similar precedence cases:

*bold
|example
text*
|end
*bold
* heading
text*
boltlessengineer commented 1 year ago

Does terminating slide with a paragraph break means it is only terminating that list item but not a whole list?

- :
  paragraph

- is this same list? or another list?
boltlessengineer commented 1 year ago

Anchor link inside anchor link

[[my link]]

I think we can solve this edge case by converting to syntax sugar for wikilinks (automatically converted to {? my link}) Wiki-links are used a lot in many workflows so having extra syntax sugar made up with lowercases would be really useful. Because anchors and wikilinks do similar things, users can think this syntax as something link hard-anchor.

boltlessengineer commented 1 year ago

Free form attached modifier inside headings

* Contextual `|` Delimiter
  The pipe (`|`) character ...

Cause | opens free-form attached modifier, these two lines are part of single paragraph segment inside header

VoreckLukas commented 1 year ago

Can @document.meta tags appear anywhere in the document or only at the beginning? If the former, in this case:

@document.meta
title: sometitle
@end

Imagine some paragraphs here

@document.meta
title: someothertitle
@end

Does sometitle or someothertitle take precedence

vhyrro commented 1 year ago

Extra: spec doesn't define what sort of objects are allowed after a single definition (only a paragraph? or any single complex object?)

boltlessengineer commented 1 year ago

escape sequence can be used to escape non-punctuation character, is this intended behavior?

\* - this is common usecase of escape sequence

\a - and this is also escape sequence according to spec
boltlessengineer commented 1 year ago

Injection to link location

* evil link injection} {https://example.com

link to {* evil link injection} {https://example.com}[that heading]
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Should spec disallow { and } characters inside link location?

boltlessengineer commented 1 year ago

Structable's prefix inside attached modifiers?

*bold
- 
word*

If there is no following whitespace in line 2, this would be valid attached modifier, right? But if line 2 is - (- followed by whitespace,) is this valid attached modifier or syntax error for unordered list?

vhyrro commented 1 year ago

Since detached modifiers have a higher precedence than attached modifiers it becomes an unclosed *bold, a syntax error for the unordered list and then word*

vhyrro commented 1 year ago

escape sequence can be used to escape non-punctuation character, is this intended behavior?

\* - this is common usecase of escape sequence

\a - and this is also escape sequence according to spec

Yep, it is! It's for the sake of consistency. It won't do anything, in fact it will just return an a as is :)