SO-Close-Vote-Reviewers / UserScripts

Various user scripts that add features to the review queue or to the chat room
Other
57 stars 40 forks source link

Magic Editor doesn't support code fences #181

Closed MdoubleDash closed 4 years ago

MdoubleDash commented 4 years ago

I have noticed that Magic Editor removes multiple grave accents (code blocks) and multiple dollar signs (formula blocks). Moreover, at least for the formula blocks, it still capitalizes first words and applies other edits intended for simple text sections of the post.

makyen commented 4 years ago

@MdoubleDash For the formula blocks problem, please open another issue. Also for that one, please provide at least one example post where it doesn't do what you're expecting. It would also help if you could link to some documentation which explained that format, as I don't see anything about it in SO's Markdown formatting help or in the Official Markdown syntax guide. Thanks.

Note: I'm not saying it won't be supported, just that it's necessary to know the specifics of the syntax in order to implement anything.

MdoubleDash commented 4 years ago

It would also help if you could link to some documentation which explained that format, as I don't see anything about it in SO's Markdown formatting help or in the Official Markdown syntax guide. Thanks.

@makyen Formula block are not part of SO's markdown formatting but they are available on other SE communities like Math Overflow, Chemistry, etc.

Here's a snapshot of what I mean: (you can also try it yourself https://math.stackexchange.com/posts/1138996/edit)

image

Let me know if you are planning to expand the support to other communities and I will post another issue if that's the case.

Update: Further details available here: https://github.com/SO-Close-Vote-Reviewers/UserScripts/issues/182

makyen commented 4 years ago

@MdoubleDash We're happy to have support for things needed by other SE sites.

If there's a GitHub issue that describes what's desired, and points at some detailed information that specifies the format of the things which we should not change, then it's likely that it will be added. Basically, what would be needed is pointers to enough information such that the code could be written. Not having links to that information means that whoever is doing the work needs to go searching for it and hope that what they find actually describes what's really desired. Even an actual GitHub issue isn't required, but knowing enough about the specifications of what's desired really is needed. A GitHub issue of its own is just an easy way to track it and keep it in mind when looking at what needs to be/should be worked on.

If links to format specification/description information are available, then it's likely that implementing it would be in a similar time-frame as supporting code fences, because the effort should be in a similar section of the code (i.e. once having dived back into the code, it's relatively easy to implement something else that doesn't have a high cost, rather than postpone it to sometime when it would be necessary to come back up to speed on the code yet again).

So, yes, if it's something that's beneficial to have, then it would be good to have a GitHub issue for it.

BTW: I'm assuming that what you're wanting is for MagicEditor to avoid making changes within text that will be formatted by MathJax. From the documentation which I've seen (1, 2), that appears to be anything within $...$ or $$...$$. The $$...$$ case will be relatively rare to false-identify blocks, but the $...$ demarcation could easily have significant false positives when using a naive identification (e.g. someone providing a list of prices in $, would look like multiple blocks of $...$). Is there something simple which further identifies the blocks? For instance, a lot of the examples appear to match the regexes /\$\$\s*\\[^$]*?\$\$/ and /\$\s*\\[^$]*?\$/, but it's not clear that the $ must be followed by a \, with the possibility of intervening whitespace.

makyen commented 4 years ago

Issue #187 was opened which concentrates on just the code fence problem. While the comments here are helpful, they're mostly about the formula block issue covered in #182. I'm going to close this issue as a duplicate of #187, because when reading these issues cold, it makes it clearer that there are two distinctly separate issues.