canvas-lms icon indicating copy to clipboard operation
canvas-lms copied to clipboard

Markdown Rendering

Open tylerkern opened this issue 11 years ago • 24 comments

Since getting involved in open source, I've come to love Markdown, and I'm sure I'm not alone. I think it would be awesome if canvas could render Markdown!

tylerkern avatar Aug 25 '14 23:08 tylerkern

I agree that it would be great, but I'm curious if you have any thoughts on how it would actually work? Would users only be able to create new items in Markdown, but not edit them? If they could edit them, the system would likely need to convert from HTML to Markdown. Is there a losless way to round-trip from HTML to Markdown and back again?

cannona avatar Aug 26 '14 15:08 cannona

Storing the plain text markdown should work. I wonder what the overhead of converting markdown to html on the fly would be?

defektive avatar Aug 26 '14 15:08 defektive

Sorry I wasn't more clear. We could store the Markdown, so a user could create an item in Markdown, and even edit it in Markdown. They could even edit it in the HTML view, or the WYSIWYG editor. However, after they had edited the item in something other than Markdown, they would lose the ability (unless we figure out a way to round-trip) to make further edits in Markdown.

Perhaps that is an acceptable limitation, but we will want to make sure that that gets communicated to users, or someone is certain to be surprised.

cannona avatar Aug 26 '14 15:08 cannona

My primary desire is the ability to submit .markdown files and allow viewers of the file to view rendered markdown in the browser (similar to the way word and pdf previews currently work). Currently it just links to a file to download, which for less savvy group members and professors can be a bit confusing.

tylerkern avatar Aug 26 '14 17:08 tylerkern

Sorry, my mistake. This is a good idea.

cannona avatar Aug 28 '14 20:08 cannona

Can't we just convert the markdown on the fly? I am pretty sure sites like stackoverflow or github don't generate the html and save it to the database. They generate it on the fly. Wouldn't it be better if one can switch between two editors, tinymce or markdown and the database would store the mime type of the content - either - text/html or text/x-markdown. And if the overhead of rendering markdown in the server is not desirable, one can easily use a javascript parser for the markdown. Basic google gave me: https://github.com/evilstreak/markdown-js

EDIT: After googling for more I found out the following library: http://strapdownjs.com; That way database change would not be required as markdown will live in an html document.

GasimGasimzada avatar Sep 21 '14 12:09 GasimGasimzada

I would love to be able to write and edit Pages in Markdown. I currently do most of my Page authoring in HTML in the Canvas editor, which I do not love.

benjaminy avatar Oct 02 '14 14:10 benjaminy

YES PLZ. The HTML Editor was a nice feature, 10 years ago... Markdown is easy to learn, and super fast. Plus, it plays nice with other platforms, like GitHub. What we'd really like to see is the ability to point to a .md file on GitHub, and voila, our lesson plan is magically rendered in Canvas. Doing so also makes content completely independent from Canvas, which it should be.

jfraboni avatar Feb 26 '15 18:02 jfraboni

What needs to happen for this to be prioritized? Are there sprints and sprint planning? Can anyone just code it and submit a PR?

markdown-js is perfectly fine and runs just fine in the browser (and where it doesn't, plain text markdown doesn't look so bad).

If I was to implement it is there anything that I should be aware of? I see the Quick Start says you don't support Windows. If I'm going to set up a VM to develop Canvas I want to make sure a PR would have a reasonably good chance of success. Also if anyone has a good vagrant file to set this up I'd appreciate it.

togakangaroo avatar Mar 16 '15 01:03 togakangaroo

Also of note, Tiny MCE (the rich text editor used here) actually supports Markdown in their latest version!

Last update to the TinyMCE directory in source was two years ago. So what's the plan?

togakangaroo avatar Mar 16 '15 16:03 togakangaroo

@togakangaroo We have an update to TinyMCE in master right now (b257d4c8c7e39be8d538fdab7cdd94b4a2363a3a). I am however, unsure if the markdown plugin is enabled.

cc: @evizitei

claydiffrient avatar Mar 16 '15 16:03 claydiffrient

the markdown plugin is not enabled out of the box, the first big step was getting the upgrade in play, we want to let that bake for a time before we monkey with any other variants to make sure that we've killed absolutely every problem we can related to the upgrade first (assuming that we find any)

evizitei avatar Mar 16 '15 21:03 evizitei

I see, would it be possible to enable the plugin on our personal instance of canvas? Would this require digging around in the ruby code or just adding the js plugin and configuring?

togakangaroo avatar Mar 17 '15 14:03 togakangaroo

do you guys run canvas on your own? If so then, yes you'd want to look in

https://github.com/instructure/canvas-lms/blob/master/public/javascripts/tinymce.config.js#L52

that's where we specify which plugins we want to use, you'd probably also want to get an AMD wrapper around that plugin for the front-end build (see https://github.com/instructure/canvas-lms/blob/master/public/javascripts/bower/tinymce/plugins/autolink/plugin.js#L12 for an example) and update https://github.com/instructure/canvas-lms/blob/master/app/coffeescripts/editor/stocktiny.coffee to specify that you want to load that plugin into the build, and to tell tiny not to try to load it on it's own later.

evizitei avatar Mar 17 '15 22:03 evizitei

Has this feature been implemented? Can I use it?

gregorypenn avatar Aug 13 '15 05:08 gregorypenn

@pyrogerg No. But it's possible to enable on your own. Look at some of the other comments.

orawalters avatar Aug 27 '15 02:08 orawalters

This would be so useful!

markuskreitzer avatar Jan 31 '18 19:01 markuskreitzer

I feel like markdown support would be great! The html text editor feels like it's a bit overkill

AlinaWithAFace avatar Feb 07 '18 00:02 AlinaWithAFace

Arrived here with the same thought -- it would be great to keep content external to Canvas and not copy/paste html between semesters. A natural format for that content would be markdown, since we use it for everything else (Github pages, issues, etc).

rrnewton avatar Aug 29 '19 09:08 rrnewton

Would be very useful indeed!

Just to cross link, there is an idea tracker on Canvas about Markdown rendering.

schirner avatar Jan 15 '20 17:01 schirner

I suggested this a while back on their feedback page but I don't know where it went from there, probably got deleted after a year of inactivity, still would be nice to see though!

LizAinslie avatar Jan 27 '20 00:01 LizAinslie

Having just completed an exam in Canvas, and with the expectation of completing more using TinyMCE, I would like to suggest another possible implementation: store raw markdown in <script type="text/markdown;variant=commonmark"> or variant=gfm, depending on if the TinyMCE default of gfm or the IMHO superior Commonmark gets used.

This has the advantage of not requiring roundtripping through HTML, which may lead to poor UX. Downside is that rendering to HTML is possibly forced onto the client, though I'm given to believe that it'd be necessary anyway.

However, I'm not familiar with the consumer side, and I don't know if they'd be able to support this without modification. Thus, it may be necessary to store both – perhaps a <div> with a special data attribute, with the understanding that it's autogenerated and overwritten from on a paired markdown source.

I'm not too familiar with canvas-rce, or TinyMCE itself, but a patch will get accepted, I'm willing to give implementation a shot, time-permitting.

0az avatar Mar 19 '20 04:03 0az

Bump on the request. I have all instructions in markdown files (since I host them on Git)

alalemp avatar Feb 23 '21 00:02 alalemp

The idea linked was archived. I hope that someone from the open source community can move forward and attempt to implement this.

rdrpenguin04 avatar Apr 15 '25 04:04 rdrpenguin04