mikespub-org / seblucas-cops

Calibre OPDS (and HTML) PHP Server : web-based light alternative to Calibre content server / Calibre2OPDS to serve ebooks (epub, mobi, pdf, ...)
http://blog.slucas.fr/en/oss/calibre-opds-php-server
GNU General Public License v2.0
65 stars 7 forks source link

Render custom (long-text) columns with whitespace: pre-wrap #69

Closed Mikescher closed 10 months ago

Mikescher commented 10 months ago

Currently if we show the content of a custom column of type comments (in the book preview) we loose all line-breaks and leading whitespaces.

image

This commit PR parses the display column from the database and adds white-space: pre-wrap, to properly render the content (if interpret_as is either html, long-text or markdown).
For the fourth possible interpret-as value short-text, we keep the current display: inline behavior.

image

In the future it could be nice to really render the content if interpret_as is html or markdown. (Markdown would be pretty easy, but html would need a proper html sanitizer to prevent XSS)...

mikespub commented 10 months ago

Nice - I haven't really played with display options in Calibre for custom columns, but if it works for you that's fine