Skip to content
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

need for mergeHtmlAndAttachment in markdown resolved() method? #67

Open
jywarren opened this issue May 2, 2018 · 3 comments
Open

need for mergeHtmlAndAttachment in markdown resolved() method? #67

jywarren opened this issue May 2, 2018 · 3 comments

Comments

@jywarren
Copy link
Collaborator

jywarren commented May 2, 2018

I'm loving the new options.mergeHtmlAndAttachment ability to intercept and custom-format attachments --

parts = options.mergeHtmlAndAttachment(chunks, link);

We have done so for a custom rendering of CSV files, for example, with the following code:

https://github.com/publiclab/PublicLab.Editor/blob/f5f5492e5188963b0d6b672fc60093cef34c065c/src/adapters/PublicLab.Woofmark.js#L144-L146

However, this only works in HTML mode, not markdown mode. So when dragging in an attachment in HTML mode, this custom formatter works great. But in markdown mode it is rendered as:

  [attachment-1]: /system/images/photos/000/024/808/original/114634.csv "114634.csv"

Do we need to port the mergeHtmlAndAttachment method implementation from /html/linkOrImageOrAttachment.js over to /markdown/linkOrImageOrAttachment.js to get this working in both modes?

@jywarren
Copy link
Collaborator Author

jywarren commented May 2, 2018

Could we insert a catch here:

links.forEach(renderLink);

and defer to a custom mergeHtmlAndAttachment or corresponding mergeMarkdownAndAttachment at that point instead of going to renderLink?

@bevacqua what do you think about this way forward? Thanks!

@bevacqua
Copy link
Owner

bevacqua commented May 6, 2018

It sounds like you want a different function that lets you add custom handling of links, that could be used internally to manage attachments, and exposed so that people can add their own kinds of special "attachment" links

@jywarren
Copy link
Collaborator Author

jywarren commented May 6, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants