2

The max size of comments seems OK, but can we calculate it based on rendered character count, rather than input character count?

For example, this input:

This sentence has *emphasis* and a [link](https://en.wikipedia.org/wiki/Hyperlink).

Renders as:

This sentence has emphasis and a link.

which has an apparent size of 38 characters, but has 83 characters total input.

IMHO the intention of the comments size limit is to limit the apparent or rendered size. Adding links adds convenience and clarity to comments, and the author should not be penalized when decorating a comment with them.

The total input limit should probably be capped at say double the rendered char count to prevent malicious data entry.


If this is declined, please state the justification.

11
  • @bobble not sure. The other question seems to have been interpreted as a request to not count formatting characters when determining if the minimum comment size has been reached.
    – Bohemian
    Commented Dec 5, 2021 at 23:56
  • As Rob commented, the part about the links is already covered in the above question, which doesn't have an official response. The part about formatting is covered in the request in the first comment above, which has been declined. To prevent this from being closed as a duplicate, I'd edit this so it's only about formatting and rephrase it as a reconsideration request. Commented Dec 6, 2021 at 0:02
  • 1
    Bohemian I agree with Sonic, replying to auto-generated comments can be useful if the suggested duplicates are way off the mark; unworthy of an edit to your question. --- It would indeed be advantageous to have searched for duplicates beforehand and linked to all of them, providing reasons why they didn't apply in your question; improving and refining what you ask for, to generate more upvotes and avoid duplicate closure. --- Arguably formatting characters do provide additional information, and that a penalty for using them isn't unfair; input versus output length is another thing.
    – Rob
    Commented Dec 6, 2021 at 0:18
  • @Rob I strongly disagree. The effect on site visual quality of adding a link is zero. The effect to site content quality of adding the link is high, and so should be allowed to be added without having to sacrifice content to "pay" for it. I would like to see solid reasoning to the contrary if this idea is declined.
    – Bohemian
    Commented Dec 6, 2021 at 0:24
  • 1
    Bohemian, that not what Sonic or I have argued against. You need to re-read the comments suggesting improvements, and if you wish rewrite your question. Replying to the suggestions for improvement needs to successfully refute such comments and relieve you of the need to improve your question; without that closure is imminent.
    – Rob
    Commented Dec 6, 2021 at 0:30
  • This has been asked before and denied, iirc (can't remember where, maybe mso). See also meta.stackexchange.com/q/156667/323179
    – Laurel
    Commented Dec 6, 2021 at 0:40
  • 2
    This sort of request is likely to be declined. It's a considerable effort to add computing the allowed characters based on ignoring some of the contents. The code would have to be written for both the backend and in-page JavaScript. The page displays the remaining characters available to the user. Having that displayed number vary based on the contents is quite confusing to users (i.e. ongoing support issues). It's far easier to increase the total character limit, which is what would have to happen anyway, due to needing to increase the space allocated in the database for each comment.
    – Makyen
    Commented Dec 6, 2021 at 1:38
  • @Makyen The "considerable" effort is changing input.length to input.replace(/\*|\[([^\\]+)]\(.*?\)/g, '$1').length in the browser and similarly terse code on the server.
    – Bohemian
    Commented Dec 6, 2021 at 1:47
  • 6
    @Bohemian Your regex isn't sufficient. It doesn't handle code formatting, using * as not Markdown, _, cases where the Markdown is invalid, convert all the magic links active for that site, etc. You have to test and verify that the two separate implementations (frontend and backend) produce the same results, etc. Once implemented, that doesn't resolve the UX issues, which are confusing as all get-out to users who don't understand the technicalities of what's being done. And still doesn't resolve the underlying issue of changing the comment size in the database.
    – Makyen
    Commented Dec 6, 2021 at 2:15
  • @Makyen I spent only a couple of minutes on that regex. I'm sure SE devs could quickly whip up a precise regex. Besides, I'm not convinced it has to be 100% accurate, only 100% conservative: ie the calculated rendered length is guaranteed to be no less than the true rendered length, because a conservative implementation is guaranteed to allow some formatting for free while never allowing too much. re DB change: alter table comment alter column text nvarchar(1000). IMHO it's a mistake to limit it in the first place - there's no advantage doing that. Just use text as the type.
    – Bohemian
    Commented Dec 6, 2021 at 5:18
  • FWIW, comments that use MathJax have a lot of "hidden" content, which becomes visible when you copy & paste them, eg math.stackexchange.com/questions/733754/…
    – PM 2Ring
    Commented Dec 7, 2021 at 0:05

0

Browse other questions tagged .