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

[Suggestion]: Rethinking footnotes/definitions #48

Open
boltlessengineer opened this issue Sep 12, 2024 · 1 comment
Open

[Suggestion]: Rethinking footnotes/definitions #48

boltlessengineer opened this issue Sep 12, 2024 · 1 comment

Comments

@boltlessengineer
Copy link

We previously have footnotes/definitions syntax like this:

^^ footnote id
footnote content

which can be multiple paragraphs
^^

Which is defined as one type of detached modifier.
Because they don’t need to be nested, v1 spec introduced 3rd type of detached modifiers; ranged detached modifiers.
But should they really have to be like that?

Norg doesn't care where to put footnotes/definitions. User can put footnotes anywhere in the document, which is a really neat feature to have as a markup language.
So all features they need is:

  • special id/title that can be referenced by link targets
  • range of general Neorg blocks

Then why should they need levels/nesting/grouping?
How should we handled nested definitions?

In core concept, they are more closer to standard ranged tags which has exactly those two features.

Then how to reimplement footnotes/definitions?

We can implement footnote/definitions using tags:

|def word
definition of word
|end

|ftn 1
footnote index 1
|end

I used ftn to match with def. I'm not sure what would be more intuitive & easy to use.
I’ve considered |$ and |^ but those seem a bit unintuitive to me.

Wait what about inlined versions?

We can implement those with infirm tags (I’m using syntax suggested from #47 for convenience)

.def word; definition of word

.ftn 1; footnote index 1

Ok then how to target them from links?

If footnotes/definitions are standard ranged tags, how to ensure they are linkable with prefix + title format?

I haven't fully made up my mind on this issue yet. So I’ll leave few ideas that come to mind.

Base idea

As footnotes/definitions are standard ranged tags, they can return altered Norg markup from given range of texts:

|def word
definition of word
|end

can be expanded to

+definition
+id word
definition of word

But this will match with all {# word} link targets so we should fix that.

Sol 1) custom non-strict prefix

Imagine .def word ... is expanded like this:

+definition
+id def-word
definition of word

So we can use it like this: {# def-word}

Simple, but not that convenient to use.

Sol 2) ability to define custom URI scheme

Let’s change the existing raw URI link target syntax.
Now users can define a URI scheme to abstract objects.

+definition
+uri def://word
definition of word

So we can use it like this: {def://word}

Better in some points, but still not that convenient and feel too hacky solution.

Sol 3) Macro link target

What if we introduce macro link target; a macro that can be expanded inside the link definition.
So we can define custom macro link def that searches for given id but filter to abstract object that has +definition attribute.

.macro-link def; …

+definition
+id some word
definition of some word

And use it like this: {.def some word}.

@boltlessengineer
Copy link
Author

Actually there is 4th solution for making footnotes/definitions as a first-class citizen without conflicting with other syntax: Make them into keywords.
Why not? Norg's design decisions said keywords are bad, but are they that bad?

Sol 4) Make them into keywords

paragraph {^ 1}

|ftn 1
content
|end

paragraph {^ word}

|def word
content
|end

ftn and def here are keywords now.

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

No branches or pull requests

1 participant