Feature: Markdown page part - #1430
wakproductions wants to merge 1 commit into
Conversation
6098c55 to
953854c
Compare
|
Wouldn't it be preferred to instead switch from Trix to Lexxy? https://github.com/basecamp/lexxy You could already do what you're doing now with a regular MultiLine part. |
This is the first time I've heard of Lexxy. Looks like the project was only started last year and is intended to replace Trix. That might require some significant overhaul work on the admin editor, especially since it's configured to use a custom toolbar. The reason I'm interested in directly using Markdown is to get more control over how the content is stored in the database. I don't like the limited options Trix editor allows for embedding media. See #1428 Streamfield for my proposed solution.
This did not occur to me - just using a regular MultiLine part and interpreting it as markdown in the page rendering template. It wouldn't have a built in presenter though. I gave it a try with a custom helper and this works: module ApplicationHelper
def markdown(text_page_part)
Kramdown::Document.new(text_page_part.to_s).to_html.html_safe
end
end
# in page_parts_demo.html.erb (rendering template for the page)
<%= markdown(content.text(:simpletext)) %> |
Context
Some users may prefer to write formatting in Markdown as an alternative to the Trix editor formatting.
Changes proposed in this pull request
Add a Markdown page part to be included with Spina's default set of available page parts.
Guidance to review
For including this in your Spina pages:
It uses Kramdown as the Markdown rendering engine. If requested, I can add a setting that would allow the user to choose a different Markdown processor. Such a setting would allow even greater flexibility.