jywarren / woofmark

:dog2: Barking up the DOM tree. A modular, progressive, and beautiful Markdown and HTML editor
http://bevacqua.github.io/woofmark
MIT License
3 stars 5 forks source link

Switch away from footnote-style linking #65

Open jywarren opened 3 years ago

jywarren commented 3 years ago

As noted in this test in the PublicLab.Editor project:

https://github.com/publiclab/PublicLab.Editor/blob/0daf8cba9a2e6d251ba2704d38235f9eff74a4fe/spec/javascripts/wysiwyg_spec.js#L27-L34

Woofmark uses a "footnote" style of linking, where the URLs are placed in a numbered list at the bottom, like:

Hello [world][1]

1. https://world.com

This can cause issues when switching back and forth from HTML to Markdown, so we'd prefer the more basic style:

Hello [world](https://world.com)

We can now write a Jest test for it!

This may also be the case for image markdown URLs.

jywarren commented 3 years ago

Test might look like:

insert this in HTML mode:

<a href="https://example.com">link</a>

and confirming it converts to:

[link](https://example.com)
jywarren commented 3 years ago

It's all managed in https://github.com/jywarren/woofmark/blob/plots2/src/html/linkOrImageOrAttachment.js

Sagarpreet commented 3 years ago

Noting: The above url is incorrect, we need to change here: https://github.com/jywarren/woofmark/blob/plots2/src/markdown/linkOrImageOrAttachment.js

For images:

![image description][2]

 [2]: /i/41849.png "Screenshot_2020-11-20_at_3.28.30_PM.png"

need to be converted to:

![image description](/i/41848.png "Screenshot_2020-11-20_at_3.28.30_PM.png")

Same for Hyperlinks!

Sagarpreet commented 3 years ago

Also Noting:

Attachments are not working in markdown but are working in rich mode!

Sagarpreet commented 3 years ago

For attachments:

[WOW.pdf][attachment-1]

[attachment-1]: /i/41850.pdf "WOW.pdf"

Need to convert to:

[WOW.pdf](/i/41851.pdf "https://publiclab.org/i/41851.pdf")
jywarren commented 3 years ago

Noting that i'm also seeing that dragging a PDF into https://publiclab.org/post generates:

testing this

  [attachment-1]: /i/4.pdf "ConcealedHingeBasics.pdf"

and not:

testing this [attachment-1]

  [attachment-1]: /i/4.pdf "ConcealedHingeBasics.pdf"

and so there is no originating text linking down to the attachment. If we could fix that, we might be in better shape, at least short term.