svivian / q2a-markdown-editor

Markdown editor plugin for Question2Answer
55 stars 24 forks source link

Minimum length of question body does not work correctly for Markdown editor #28

Open fardina opened 4 years ago

fardina commented 4 years ago

It seems markdown does not count html tags.

Example to reproduce the issue: set Minimum length of question body to 100 character for example. question body text: <p>94 characters here...</p> So the question body is 101 characters. But It gets the error for min length of question body.

fardina commented 4 years ago

@svivian Do you have any idea why this happen?

fardina commented 4 years ago

@svivian there is also another problem in this regard.

for example my site is about mathematics when a question started by

Let x<y ...

then all the text after < is not counted and users get the error of minimum length of question body.

this happens alot in my site.

could you Please kindly make a comment?

svivian commented 4 years ago

This can be solved by changing 'html' to '' on line 39 in qa-markdown-viewer.php

However, you now get the opposite problem, where someone can enter

<p><span><span>123</span></span></p>

So they only put 3 characters (that are actually displayed) but it counts it as over 30 characters (the minimum I was using for testing). Probably, making the change makes it easier for most users.