Ask A Question

Notifications

You’re not receiving notifications from this thread.

How is the Trix editor on gorails.com "Parsed with Markdown"?

chrickso asked in General
I was considering implementing on my website the ability for users to switch between a markdown editor or the trix editor but then I noticed on this gorails.com editor (which appears to be Trix) it says "parsed with markdown" below it and I'm wondering how this is possible and what I can do to enable my trix editor to parse markdown. It was my understanding that Trix translates what is typed clientside into HTML and the HTML-ized body is content is what is submitted via the form to the rails controller.

Is there some markdown parser customized into the Trix library or is the parser even running clientside or is the parser just run serverside of the HTML-ized body content before it is saved? I would really love any info on how this is done and how I can incorporate the same functionality.

Thanks in advance for any insight.
Reply
~~~is this really parsed with markdown test~~~

1. Item 1
1. Item 2
1. Item 3
   1. Item 3a
   1. Item 3b
      1. Item 3b
         1. Item 3b


- [x] @mentions, #refs, [links](), **formatting**, and <del>tags</del> supported
- [x] list syntax required (any unordered or ordered list supported)
- [x] this is a complete item
- [ ] this is an incomplete ite

First Header | Second Header ------------ | ------------- Content from cell 1 | Content from cell 2 Content in the first column | Content in the second column

> guess not
Reply
That's actually leftover from when I moved away from SimpleMDE. I forgot to remove that. Unfortunately Trix isn't great for code samples so I think I'm going to be migrating back.

Luckily HTML is valid Markdown, but like you see above, you can't really have Markdown in HTML because the characters will be escaped.
Reply

switching back to SimpleMDE or something else? SimpleMDE looks cool but not being updated at all since mid 2016 is worrisome

Reply

I'm not sure it's so worriesome. A markdown editor is super simple so unless there are a ton of bugs, there's not much maintenance that you would need.

Reply

thanks for the info

Reply

indentation test for simpleMDE:

This is the top level.
This should be indented (level 1)
indented more (level 2)
indented more (level 3)

  • Bullet Top Level
    • Bullet Level 2
      • Bullet Level 3
        • Bullet Level 4
          • Bullet Level 5
Reply

what i really dont like on trix is that it seems to be impossible to style content in it like centering words etc.
In addition to that i really would love to embed social media in my posts like twitter feeds, spotify etc but that seems to be not possible aswell

Reply

Sebastian, you can always build custom buttons for Trix to add those features.

Reply

uh ehm, okay didnt know that, is there a guide which shows how to achieve that? looks promising! thank you for that information!

Reply
Join the discussion
Create an account Log in

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

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

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

    Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more.

    © 2024 GoRails, LLC. All rights reserved.