jreklund / php4dvd

php4dvd is an open source php/mysql powered movie database. Catalog your video collection with ease. Automatic update of information and images.
GNU General Public License v3.0
83 stars 44 forks source link

Markdown support in personal notes area #38

Closed kkayacan closed 5 years ago

kkayacan commented 6 years ago

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.

jreklund commented 6 years ago

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.

kkayacan commented 6 years ago

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

jreklund commented 6 years ago

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).

kkayacan commented 6 years ago

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.

jreklund commented 6 years ago

Yeah, I meant having separate fields in the database.

jreklund commented 5 years ago

Please see the pull request #40.