Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
969 views
in Q2A Core by

If there is < in the question body and set minimum length to 100 then you get an error: please provide more information-At least 100 character.

to reproduce:

1. In admin/posting set Minimum length of question body to 100

2. choose markdown editor as your default editor

3. Ask a question with this text as the question body:

Let x<y and Lorem ipsum, or lipsum as it is sometimes known, is dummy text used in laying out print, graphic or web designs. The passage is attributed to an unknown typesetter in the 15th century who is thought to have scrambled parts of Cicero's De Finibus Bonorum et Malorum for use in a type specimen book.

3. Send the question

Now you see the error.

Q2A version: 1.8.3
by
edited by
That's because it thinks it's a tag, like <code>, and then it's expecting the
rest of it: some string and then the greater than sign (>). Here's why:
https://daringfireball.net/projects/markdown/syntax#autoescape

Quick workarounds:
(1) Put a space between "<" and "y"
(2) Replace "<" with "&lt;"
(3) Use `x<y` instead

The question's content is actually being received by Q2A but the current code at
https://github.com/q2a/question2answer/blob/7ed3f6a077fd0ad7715ab307c7310f1760ae52a3/qa-include/plugins/qa-filter-basic.php#L75
shows there's two validations about question's body length:
(1) If the database can save it. Here it's okay because it receives "Let x<y and Lorem ipsum..."
(2) If the plain text rendering of content is less than or equal to 100 (in this case). Here it's   "Let x" because the viewer returns what it has before it was processing (and eating up) what it thinks is a tag.

Therefore, the error message is correct.

It also happens in other sites that use Markdown:
https://meta.stackexchange.com/questions/279727/how-can-i-escape-the-less-than-symbol-when-it-is-next-to-a-alphabetical-characte
by
But my website is about mathematics and I can't force the users to put a space after each < sign! Is there a way to make a space after each < or replace < by &lt; automatically?
by
By introducing this customization, It'll be harder to introduce html tags such as <table>, <tr>, <td>, <code>, and so on.
by
True, Thank you Jair.

Please log in or register to answer this question.

...