denoland / deno-gfm

Server-side GitHub Flavored Markdown rendering for Deno
https://jsr.io/@deno/gfm
MIT License
226 stars 37 forks source link

feat: add footnote support #94

Closed deer closed 9 months ago

deer commented 9 months ago

closes https://github.com/denoland/deno-gfm/issues/6

Someone created a marked extension late last year. I guess it works well enough. For the test I basically just took the example from upstream: https://raw.githubusercontent.com/bent10/marked-extensions/main/packages/footnote/test/fixtures/example.md

@hashrock, please take a look.

hashrock commented 9 months ago

Thank you!

image

I tried the Example, but the link doesn't seem to work. The backlink is working, so there might be interference with the existing renderer.

deer commented 9 months ago

Sorry @hashrock, that was possibly the worst PR I've ever created. The feature wasn't at all working 😭

But on the positive side, it's now working and there are really good tests. Here's what's changed:

  1. Add a bunch of line breaks in the markdown to make it super obvious that the page is moving around (or not). This was the primary problem.
  2. Stop sanitizing certain attributes and classes necessary for the feature to actually work.
  3. Include the extra necessary styles.
  4. Copy the unit test from the source as the starting point and then modify it where necessary, instead of generating html from the markdown and assuming it's correct.
  5. Add a lengthy server test to ensure styles and other stuff are working correctly.
deer commented 9 months ago

Waiting on https://github.com/denoland/deno-gfm/pull/99 so that the server test is cleaner and more useful.

deer commented 9 months ago

Hi @crowlKats, if you could jump in here again, that'd be appreciated.