Skip to content

feat: allow rendering footnotes without superscript #362

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

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions lua/render-markdown/render/shortcut.lua
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,17 @@ function Render:footnote(text)
end

local footnote = self.link.footnote
if not footnote.superscript then
return
end

local value = Converter.to_superscript(footnote.prefix .. text .. footnote.suffix)
if value == nil then
return
local value = ''

if footnote.superscript then
local converted_value = Converter.to_superscript(footnote.prefix .. text .. footnote.suffix)
if converted_value == nil then
return nil
end
value = converted_value
else
value = footnote.prefix .. text .. footnote.suffix

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the purpose of this change?

To inline prefix & suffix when superscript = false?

Or effectively a way to hide the ^?

If it's the latter it strikes me as unintuitive that setting superscript = false results in the ^ being hidden, this should be controlled by something more explicit.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, would it be better to control the whole option for rendering footnotes in general with an enable flag that defaults to true then? Right now the rendering of the option is controlled by if superscript = true is enabled or not, which I thought to be a little unintuitive myself.

I was trying to keep within the bounds of existing options, but maybe adding an option here for enabling rendering of footnotes may be a better way of going about this then.

Copy link
Contributor Author

@water-sucks water-sucks Mar 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My intent for this change was to be able to conceal the option without needing to render everything with superscript-style characters, btw. Sorry for not making that clear in my initial PR comment.

end

self.marks:add_over('link', self.node, {
Expand Down