jreklund / php4dvd

php4dvd is an open source php/mysql powered movie database. Catalog your video collection with ease. Automatic update of information and images.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Markdown support in personal notes area

kkayacan opened this issue · comments

Since the personal notes area does not support html or any kind of text formatting, I believe it would be useful to have this field to support Markdown syntax and get formatted automatically in display mode, in order to feature hyperlinks and other formatting options.

There are some nice libraries that could make the work easier.

If you can point the code where notes area is displayed, I would love to work on this.

I have looked at that library before, but I haven't tested it XSS capabilities. So I haven't implemented it.

If you just want to render you markdown:
tpl\default\movies\movie.html
L260: {$movie->markdown}

includes\movie.inc.php
L43: $movie = $moviedm->get($id);
After this one add $movie ->markdown = ...

PS. I won't merge a patch with just these modification. You need to add a column in the database and save the html code (XSS free of course) there and use that value instead in the view.
Same things as your latest Pull request but also some modification on includes\movie.update.inc.php with markdown->html code and XSS filtration.

Why should we save the html code in database? Isn't it better to render at display?

It will load faster. And depending on the XSS filtering, you may need to use HTML Purifier too.
Won't be that big of an impact if it's only used in notes, as it will just render once you open it. But bad practice if you ask me, in case you have a lot of users (normally you don't in this application thought).

But switching to edit mode, we have to convert html back to markdown. That would be harder. Edit: I think you mean raw text and rendered text should be in separate fields in database.

Yeah, I meant having separate fields in the database.

Please see the pull request #40.