Ask A Question

Notifications

You’re not receiving notifications from this thread.

Markdown and Emoji with the html-pipeline gem Discussion

Awesome episode! I've used https://rubygems.org/gems/p... but html-pipeline looks like a great alternative. Loving the emojis !!

Reply

The SyntaxHighlightFilter depends upon github-linguist that depends upon pygments.rb so behind the scenes you'll be using the same tools. :)

Reply

I would do the conversion from the raw markdown the user entered into sanitised HTML on save and store both the original user content (for editing etc) and html in the database. This means there is hardly any computation when your load the forum. The same could be accomplished by caching the page or fragment caching but I think this is a better solution.

Reply

:+1: )

Reply

:heart: ep! The emoji asset root cdn link seems expired. The more permanent way is to follow the https://github.com/github/g... steps copying the images to the public/images. The asset root is then localhost:3000/images/.

Reply

Thanks for the tip! I was wondering how long Github would allow people to use their assets.

Reply
Jordano Moscoso Jordano Moscoso

And don't forget the "http://".

Reply
Kohl Kohlbrenner Kohl Kohlbrenner

@excid3:disqus I refactored the markdownify method into a decorator instead of putting it in helpers. Admittedly I did it for practice generating decorators, but what is your opinion on the design decision?

Reply

I usually go for simplicity and don't use decorators for something like this. It's just a single method and I've already got a helper available so putting it there makes sense to me.

I find decorators are great for more complex things that manipulate record data into something more visible. A contrived example is a UserDecorator that has a "name" attribute that combines the "first_name" and "last_name" fields and does similar things for addresses. That rarely belongs in a model but it's a bit more logic than you'd want in a bunch of separate helper methods.

Reply

This cast is awesome, thanks. On Github, when you start typing the emoji name or mention (i.e., when you type ":hea..." or "@..." it pops up suggestion engine that allows you to choose what you want - a kind of auto-completion. any idea on how to implement something like that? I earched the documentation but couldn't find anything. of-course, the idea is to get some "real time" feedback and not just after you "pot" the mesage.
Thanks

Reply

I've used At.js in the past and it has worked quite well. http://ichord.github.io/At.js/

Reply

Any idea how to turn the Auto link to make a new tab, ie target = blank

Reply

I've had to do this before. I think you have to pass in an option into the autolink plugin (or copy it and write your own that uses target blank. Can't remember off the top of my head but I did ask about it in an issue on the Github repository.

Reply
Jordano Moscoso Jordano Moscoso

Is going to be a episode also using mentions and At.js? With notifications on mentions?

Reply
Khemlall Mangal Khemlall Mangal

Hi chris, i am facing an issue, when i try adding this gem my textfield gets disalbed why?

Reply

Thank you for the video :) check that https://github.com/tibastra... it may help you too ;)

Reply

Have you tried it with a real-life project? Thanks for sharing :)

Reply

Great video, is there a way I could customize the color of markdown formatting?

Reply

here is the asset_root: that i found
I was having hard time and I found this
it seems to work ~
https://github.githubassets.com/images/icons/

Reply

Thank you! This solution worked for me.

Reply

Hey, for some reason it's not rendering the text area where I added markdownify.

Reply

Wow, I think Action_Text using Trix comes with rich text features.

Reply

Do you have source code on this episode?

Reply

It is the gorails-forum repo -> https://github.com/excid3/gorails-forum.

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 85,376+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.