-
Notifications
You must be signed in to change notification settings - Fork 381
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
Add footnote support for wiki markdown #8125
Conversation
</sup> | ||
</p> | ||
|
||
<li class="osu-md__list-item osu-md__list-item--footnote" id="osu-fn-test" role="doc-endnote"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this extension sure likes producing weird output. This invalid list item aside, it also accepts [^1]: > aaa
and produces blockquote. Similarly with [^1]: 1. aaa
😐
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wandering around and look at another markdown parser that support footnote, I think this is intentional that they accepts any kind of markdown syntax inside footnote list, for example see markdig footnotes and remark footnotes (now in remark-gfm)
Just do some moderation from wiki-side to not using weird syntax inside footnote list 🙃
I think they only need to use emphasis and link for footnote list in wiki, cc: @TicClick for confirmation.
PS:
Now github also support footnote, let's compare. GFM also render as blockquote for first case. For second case, GFM is dying and not render at all.
Syntax:
Test[^1]
[^1]: > aaa
Result:
Test1
Footnotes
-
aaa
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so, yeah. maybe some other basic formatting like bold/underlined, but that's going to be very rare. typical footnote usage is link references or remarks like the one under ¹ at https://osu.ppy.sh/wiki/VCC#criteria
@@ -226,6 +234,20 @@ | |||
} | |||
} | |||
|
|||
&__link { | |||
&--footnote-ref { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, it's aligned correctly in firefox but not in chrome 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like there are some qtip2 bug in chrome that using first child element as positioning target.
Using this markdown
[*chat* **window**](/wiki/Chat_Console "Chat window")
will produce
<a class="osu-md__link" href="./Chat_Console" title="Chat window"><em>chat</em> <strong>window</strong></a>
In chrome, the tooltip use first child (em
element) for its positioning.
In firefox, it works as expected and using the whole anchor element for its positioning.
I have some options forward to tackle this.
- Debug qtip2 fork in https://github.com/notbakaneko/qTip2 and apply some patches.
- Use custom renderer to directly add bracket into superscript anchor.
- Remove the
::before
and::after
element. But without bracket the superscript link is so small in mobile it so hard to click. - Remove the tooltip preview altogether so we don't have to worry about this bug.
Thoughts?
PS: At some point we have to replace qtip2 to another library, it's already abandoned since long time ago.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't see this as a blocker to get this PR merged. Probably fine to create a separate issue tracking it.
Depends on:
fragment-target
toscroll-padding-top
#7980closes #7316
Now without any custom renderers and with simple approach.
How to use
Basic syntax:
And will automatically assign number and render something like this:
Footnote1
[1] link will target to the reference list item and ↑ link will go back to [1].
Some caveats
Be careful with exclamation
Valid:
Invalid:
Be careful with duplicate reference key
Valid:
Invalid:
Demo
Use this branch for this example
footnote.mp4