poppastring / dasblog-core

The original DasBlog reimagined with ASP.NET Core

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Markdown powered comments

poppastring opened this issue · comments

Comments currently allow specific html tags, governed by a combination of the site.config and custom code.
image

Let's simplify comments code by accepting Markdown. The MD entry will be converted to HTML by using the MarkDig plugin.

I am happy to take a stab at this if no-one else is working on this. I love the idea of supporting markdown and if this works, would we be open to the idea of also allowing markdown for posts? We can start with comments and see how it goes. Okay to take a quick attempt at this if no-one else is working on this?

I can try and submit a PR in a couple of weeks.

I've started working on this and have a quick question.

Today the HTML tags allowed are limited. By introducing markdown are we completely removing the limit on markdown options allowed. For example in my comment can I type "# Hello" and the converted HTML will convert it into <h1>Hello</h1> - or do we also wanted users to use a restricted set of mark down options like allowing just bold, italics etc.? When we talk of simplifying the code I am thinking we want to remove all restrictions and allow everything in comments that markdown allows (Even if it means users can now inject H1 and H2 headers using markdown). Is this understanding correct?

(Another option is we have the same set of restrictions on what kind of tags we support today but allow the users to enter these using markdown).

Which one of the two options are we leaning towards? 1) allow everything that markdown allows? 2) have the same set of restrictions that we have today but allow users to use markdown instead of HTML?

@thousandtyone I wanted this to be option 2. Thanks for the checking!

@poppastring - I've submitted a PR. Feel free take a look at it and please do let me know if any changes are needed. I've documented it extensively in the PR comments. Also introduced a site.config setting to allow markdown which is off by default to retain backward compatibility. Feel free to review the PR and the comments associated with the PR and I'll be happy to make any modifications that might be needed. Please do let me know. Note: The PR goes with the option we discussed in the thread.