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

Allow the body of news items and events to be written in markdown #83

Closed
itsWill opened this issue Nov 27, 2015 · 15 comments
Closed

Allow the body of news items and events to be written in markdown #83

itsWill opened this issue Nov 27, 2015 · 15 comments
Assignees
Labels

Comments

@itsWill
Copy link
Contributor

itsWill commented Nov 27, 2015

It would be cool if for news items and events we could write the body in markdown to give our posts some ⭐ πŸ’Ž ⭐ πŸ’Ž ⭐ πŸ’Ž ⭐. Thinking we could implement this using something like redcarpet

@cawel
Copy link

cawel commented Nov 30, 2015

Good idea! I believe @nicholasjhenry told me that was indeed in the pipeline. Pending the core team's approval (e.g. by tagging the issue as a 'feature'), I'd be happy to start on that one.

@itsWill
Copy link
Contributor Author

itsWill commented Nov 30, 2015

I've implemented something like this before, so let me know if you need some pointers on how to tackle this one.

@benichu
Copy link
Member

benichu commented Dec 1, 2015

πŸ‘

@cawel do you want to take care of it? Also, remember that the markdown storage/display behaviour should be shared by a lot of our models (anywhere we have a description or body fields I believe, source: #47 (comment))

@cawel
Copy link

cawel commented Dec 1, 2015

@benichu Sure thing πŸ‘ I will start on that tomorrow Tuesday.

@benichu
Copy link
Member

benichu commented Dec 1, 2015

Cool stuff. I invited you to the contributor's team, so you don't have to fork the repository but can directly create branches off the repository. Tell me if you need any help.

@nicholasjhenry
Copy link
Contributor

One additional feature on Events and NewsItems would be to include a filter attribute to specify if it's in markdown or html. This would help with rendering legacy content imported from Wordpress.

@cawel
Copy link

cawel commented Dec 1, 2015

@itsWill Thanks for the offer. I've been writing my own notes – on various topics – using the awesome markdown syntax for many years now. I should be good! But I'll be looking forward to hear what you have to say in a possible code review ;)

@benichu Thanks for making me a contributor πŸ™‡

@nicholasjhenry Happy if I make your filter attribute an enum with 2 possibles options (markdown and html)? I would speculate that this attribute will be useful initially when rendering the legacy content in its original html. But once all that legacy content will be converted to markdown (some months from now), the idea is to get rid of that attribute and only support markdown for all user-defined content.

Taking a look at the object model diagram, my understanding is that "markdown support" is required for the following models:

  • Event
  • Job
  • NewsItem
  • Organization
  • Page
  • Talk

So just to double check, Event and NewsItem are the only models which should have that special filter attribute?

@nicholasjhenry
Copy link
Contributor

So just to double check, Event and NewsItem are the only models which should have that special filter attribute?

Correct. Thank you.

@benichu
Copy link
Member

benichu commented Dec 1, 2015

@nicholasjhenry Did you have a chance to get a copy of the current wordpress site db dump?
I am curious to know if the content could be converted to markdown when we import instead of implementing a legacy feature that could be (easily, maybe) avoided.
Or, is it a bit too optimistic? Let's have a look at that data before doing any work on the filter.

cc @sophiedeziel

@nicholasjhenry
Copy link
Contributor

@benichu Yes, I do have a copy of the dump. Never considered converting the HTML to markdown, but if that's doable sounds like a plan. I'll share the dump with you via slack.

@benichu
Copy link
Member

benichu commented Dec 1, 2015

@cawel I am going to look into the wordpress db dump (asap)...
In the meantime just focus that feature on displaying raw markdown content, no filter unless we have a hard time converting the old content to markdown.

@cawel
Copy link

cawel commented Dec 2, 2015

@benichu Understood. New PR created for markdown support phase 1: #89.

@nicholasjhenry
Copy link
Contributor

Actually, another thought -- doesn't the markdown renderer ignore HTML anyway and passes it through?

@cawel
Copy link

cawel commented Dec 2, 2015

@nicholasjhenry You are right. Per the Markdown syntax spec, HTML code can be inlined. I tested it to confirm that the redcarpet gem would indeed respect the spec, and it does. πŸ‘Œ

@nicholasjhenry
Copy link
Contributor

  • I know that this is a work in progress - just a heads up it would be nice to render markdown fields in the admin. Example:

screenshot 2015-12-04 11 47 55

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

No branches or pull requests

4 participants