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

Snarkdown #759

Open
ptbrowne opened this issue Sep 3, 2019 · 2 comments
Open

Snarkdown #759

ptbrowne opened this issue Sep 3, 2019 · 2 comments
Labels
✨ Enhancement New feature or request Harvest

Comments

@ptbrowne
Copy link
Contributor

ptbrowne commented Sep 3, 2019

#758

I wanted to use it also in harvest, but we can't since we've a custom renderers.

I wanted to know what kind of renderers we use and why ? And explore what could we do not to use them ?

@Crash--
Copy link
Contributor

Crash-- commented Sep 3, 2019

You can find our custom renderers here: https://github.com/cozy/cozy-libs/blob/master/packages/cozy-harvest-lib/src/components/Markdown.jsx

We use it specially for styling purpose but also for referrer.

This is something we can't do with snarkdown. It seems that te recommended way is to pipe the result of snarkdown and make the transformation ourself (developit/snarkdown#5 (comment))

@ptbrowne
Copy link
Contributor Author

ptbrowne commented Sep 3, 2019

It seems that te recommended way is to pipe the result of snarkdown and make the transformation ourself.

I'd be OK with that.

We could also do :

const snarkWithNoReferer = content => {
   const div = createElement('div')
  div.innerHTML = snarkdown(content)
  div.querySelectorAll('a').forEach(a => a.setAttribute('noreferer', true))
  return div.innerHTML
}

This way we do not have to deal with regexps.

@Crash-- Crash-- added Harvest ✨ Enhancement New feature or request labels Sep 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ Enhancement New feature or request Harvest
Projects
None yet
Development

No branches or pull requests

2 participants