Skip to content

Prepare for markdown #2493

@iamareebjamal

Description

@iamareebjamal

Currently, the server stores raw HTML for description in various places, which is insecure and difficult to show on mobile devices. Also, rich content based on HTML is always a bad idea since supported things can change and not every HTML element is feasible.

The plan is to get rid of all HTML from the server and change it to markdown. This will be done on incremental basis starting with posts with no HTML content and content with HTML will be converted to restricted MarkDown, which will also make it easier for the frontend to make a rich text editor.

For markdown content, a special field is_markdown will be added for markdown content and is_raw_html for posts with raw HTML.

By default, is_markdown will be false and the latter will be true for all content. Later, is_raw_html will be deprecated, and frontend will have to show escaped text by default when all markdown conversion is complete.

This makes easier for us to not run into XSS problems. So, if the content returned from API is <p>Hello</p> with is_raw_html false, it should be shown with the tags, and not just hello

is_markdown will only be true for text with rich content. For example, bold, italics, etc. So, it will be disabled for all simple content. For frontend and mobile, a flag is_markdown needs to be sent while creating content so that it is optional and not necessary to implement rich text editor for the client, and this flag will be reflected in the fetched API making the consumers show/ not show it as markdown.

So, three scenarios are:
is_mardown (default: false) -> render markdown
is_raw_html (default: true) -> Show using inner HTML without scaping (To be deprecated)
else -> Plain Text, show woth escaping (default in future)

This is a design proposal and discussion on it with suggestions and counter-arguments and welcome.

Same proposal to be shared in frontend, server and mobile

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions