SpinaCMS / Spina

Spina CMS
http://www.spinacms.com
Other
2.19k stars 405 forks source link

Do you plan Markdown support? #246

Closed Inza closed 7 years ago

Inza commented 7 years ago

The included Trix WYSIWYG is nice - probably the best WYSIWYG option available. But it would be nice if spinacms could support Markdown which is better for some use cases. There is awesome rubygem for Markdown - the redcarpet (https://github.com/vmg/redcarpet).

Do you plan to support Markdown as well? For example it could be somewhere in site or page settings - it I would like to use markdown or trix? Or it could be just an additional gem, plugin, etc.

If you do not plan to support the markdown I will be very happy to contribute to spina with some kind of markdown extension - I just need to know if there is currently any way how to replace the text processing logic.

Thanks for info - and for a cute CMS! ;)

Kind regards Tom

Bramjetten commented 7 years ago

Thanks for your interest in Spina CMS!

We actually started out with a Markdown-editor (EpicEditor) but later replaced it with wysihtml5 and eventually Trix. Some have already replaced it with their own editor of choice, so that's always an option. What I would like to see is some kind of Markdown extension for Trix itself. Sort of like a "source view" instead of the wysiwyg view.

dankmitchell commented 7 years ago

I have used Markdown on a project using the rdiscount gem and simple replaced app/views/spina/admin/page_partables/texts/_form.html.haml with the following;

.horizontal-form-label
  = f.object.title
.horizontal-form-content
  = f.fields_for :page_partable, f.object.page_partable do |ff|
    = ff.text_area :content

which allows users to just use a plain textarea where they can use markdown and then uses a helper on the frontend to render the text i.e.

  def markdown(copy)
      markdown = RDiscount.new(copy)
      markdown.to_html.html_safe
  end

<%= markdown(@product.description) %>

Little sidenote when using haml is that you need to remove whitespace otherwise you get loads of random space in the text so add this to application.rb Haml::Template.options[:remove_whitespace] = true