silverbulletmd / silverbullet

The knowledge tinkerer's notebook
https://silverbullet.md
MIT License
2.59k stars 189 forks source link

markdown footnotes #212

Open strcrzy opened 1 year ago

strcrzy commented 1 year ago

Hi! This project is awesome and I am really enjoying it, thanks!

I have a few feature requests to prioritize however you might.

The first one I think would be useful is markdown footnotes.

Here is a simple footnote[^1]. With some additional text after it.

[^1]: My reference.

This would insert a hr at the bottom of the page, then an ordered list of the notes.

zefhemel commented 1 year ago

For future reference (or whoever is interested in attempting to implement this), this will require extending the markdown parser. We have a few extensions already, they're all here: https://github.com/silverbulletmd/silverbullet/blob/main/common/markdown_parser/parser.ts

strcrzy commented 1 year ago

Trying to take a look at this, but I'm new to Deno (though pretty familiar with TS).

I'm trying to use the Deno plugin with VSCode.

When I try to open this file, I get an error just opening it:

Parameter 'cx' implicitly has an 'any' type.deno-ts(7006) (the same for all the args to that function).

I'm assuming from the context that this is intentional, so I tried just adding a tsconfig.json that looks like:

{
  "compilerOptions": {"noImplicitAny": false},
}

but the editor/ts compiler still seem to error out. if you have a moment and anything sticks out, could you tell me if i'm doing anything obviously wrong? i feel like i could contribute this feature if i could just get past this roadblock.

otherwise, i'll muddle thorugh and hopefully get to it somehow :)

zefhemel commented 1 year ago

@strcrzy there’s probably a bunch of these errors (not really errors, more lint issues). You can either ignore them, or address them. In this case, I’d simply add cx: any to the code to make the “any” explicit. Tsconfig files are ignored by Deno I think, although you may be able to add such options to deno.jsonc. Generally, though, I’d prefer to just address the issues that I find (or explicitly disable them on a line-basis) rather than disable rules across the board.

strcrzy commented 1 year ago

thanks so much! this gets me started :)

v411e commented 1 year ago

Just an idea that came to my mind: What about not listing the footnotes at the bottom of the page. Instead we could use mouse-over on the little number combined with a little 'popup' which automatically closes once you move the mouse away?

Pro: No need to scroll down and loose context Con: Harder to implement

ryanwwest commented 9 months ago

I like @v411e 's idea about not losing context. When this gets implmented, it might be nice to additionally render footnotes as sidenotes to the right of the main text column, a bit like Google Docs comments. There you could click on the text to edit it directly (and it is updated at the bottom where it's actually stored in regular Markdown) or click a link to jump to the bottom source. Might depend on editable transclusions, though.