Skip to content
This repository was archived by the owner on Oct 3, 2024. It is now read-only.

more accurate markdown renderer#4

Draft
easrng wants to merge 10 commits intocpsdqs:mainfrom
easrng:main
Draft

more accurate markdown renderer#4
easrng wants to merge 10 commits intocpsdqs:mainfrom
easrng:main

Conversation

@easrng
Copy link

@easrng easrng commented Nov 18, 2022

everything renders properly now including emojis, link previews, a cohost plus on and off checkbox, and the "Read More" cut (though it's just implemented as a details/summary rn so it doesn't look exactly the same as on cohost). i'm marking this as a draft because it doesn't give you feedback on what the sanitizer removed like prechoster does now. also licensing might be an issue, almost everything in src/markdown was copied out of cohost's source maps and edited until it built properly.

@easrng
Copy link
Author

easrng commented Nov 18, 2022

here's a comparison:

  • cpsdqs/prechoster:
    image
  • easrng/prechoster (this pr):
    image
  • cohost:
    image

it's not perfectly accurate to cohost (idk why the footnote placement is different) but it's wayyyyyy closer

@cpsdqs
Copy link
Owner

cpsdqs commented Nov 18, 2022

oh, neat!
hmmmmmmmmm yeah before merging this i’d definitely like to see some kinda confirmation that staff (*tags @jkap*) are ok with this level of reversing in a public repo12. i had kinda given up and was waiting for a potential Official Reference Renderer™ when the public API releases…

i should probably also add some kinda code license before accepting a contribution this big lol added MIT which was already in package json apparently

for a quick review:

  • yeah the sanitizer warnings would be nice to keep
  • what changed in cohost-inherited.less? i had ignored it in prettier because it was 1:1 copy-pasted from cohost
  • that iframely api key probably can’t be there. i imagine it stops working outside localhost
    • (i dont really have plans to subscribe to iframely & i think it’d be fine to have a “iframely embed goes here” placeholder instead)
  • i18next doesn’t really seem needed here
  • i believe the footnote placement is actually correct. the cohost “read more” in the preview tab is a bit inaccurate (it’ll pick up html <hr> even though those don’t get converted to read more)

Footnotes

  1. there are source maps??

  2. “You further agree not to copy, translate, port, modify or make derivative works of any portion of the Services” which the cohost-inherited.less file is probably technically already in violation of but,

@easrng
Copy link
Author

easrng commented Nov 18, 2022

  • i agree the sanitizer warnings would be nice to keep i just don't know what the easiest way to add them back would be
  • i added the classes needed for the emojis and the iframely embeds, i tried to have the initial prettier run in a different commit than the one where i added the new styles but i don't think it worked
  • the iframely api key allows access from http://localhost:8000 and https://cloudwithlightning.net, it's on the free plan and i haven't given them payment info so worst case scenario the embeds don't load
  • you're probably right, there are probably even more modules than that that could be removed pretty easily, i just haven't done it yet

@cpsdqs
Copy link
Owner

cpsdqs commented Nov 26, 2022

ok until it is Probably Legal to include the cohost renderer code in this repo, i have for now implemented a terrible, terrible hack in bb2533b. It simply loads the appropriate webpack chunks containing the renderer from cohost dot org itself. I don’t know how cohost does deployments or whether they keep the older static files around, so I’ve also kept the current renderer as fallback if it ever breaks.

@easrng
Copy link
Author

easrng commented Nov 27, 2022

that's awful (positive)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants