User talk:Remember the dot/Archive/2013

3DML
Hello, and thanks for tagging this for notability. The tag's still there after 5 years. It's such a mess, I wasn't able to be sure if notability was hidden in there or not. You may want to consider taking it to the Notability noticeboard or AfD to get the issue resolved. Best wishes, Boleyn (talk) 08:22, 30 January 2013 (UTC)

Allow customization of 100ms timeout?
I wish you would make the maximum allowed highlighting time a customizable parameter (instead of hard-coding it at 100 milliseconds). That way, power users who are willing to accept occasional slowness in the syntax highlighting can have the flexibility to do so. I am currently using Google Chrome 24.0.1312.57 on two different Ubuntu 12.04.1 boxes (recent hardware, fast enough that "try a faster computer" is really meaningless in my case). — Rich wales (no relation to Jimbo) 17:53, 4 February 2013 (UTC)


 * Try Firefox, it's much faster and doesn't have the issues with international text that Chrome has. But since you asked, I made the limit customizable. Happy editing! —Remember the dot (talk) 03:15, 6 February 2013 (UTC)


 * Thanks. Actually, I used to use Firefox until recently, but it was too slow and crashed too often, so I switched to Chrome.  —  Rich wales (no relation to Jimbo) 07:29, 6 February 2013 (UTC)


 * Hi, Remember the dot. Thanks for the nice script. I think it's rude and silly to tell people they need to buy a faster computer just to have some syntax-highlighting while editing Wikipedia though. :) "Syntax highlighting on this page was disabled because it took too long." would be better in my opinion. It depends on the length of the article you are editing after all, for a short article or a section it will be fine with a slow computer too. Also, you don't need to tell people "If you are using Chrome or Safari, ..." since you can easily check that with $.browser.webkit and don't need to display this sentence to all users, if you need to display it at all. By the way, that bug is now marked as fixed . You could also add a button to let people turn the highlighting on even if it takes too long so they can decide for themselves whether it's too slow or not. --V111P (talk) 04:18, 20 March 2013 (UTC)


 * Thanks for the feedback. The error message should be more accurate now, and I plan to remove the note about the WebKit bug the moment new versions of Safari and Chrome are released. By the way, as noted above there is a parameter for customizing the timeout value. Enjoy! —Remember the dot (talk) 01:26, 22 March 2013 (UTC)

Interesting testcase
Hi there! I just came across a rather elaborate signature that, while apparently not malformed, seems to be incorrectly parsed by the highlighter:

Anything written after the signature appears in the syntax highlighter as colored (either by the internal link or the bold; not sure which since they use the same color). Moving the bold markup to outside the outermost font tags makes the highlighting work again as expected.

I found this by editing this revision. --Waldir talk 22:12, 25 February 2013 (UTC)


 * That signature is malformed, though it's hard to see because it's so complicated. It's the same problem as above. The code boils down to
 * I would do what you did and move the first ''' to the very beginning of the signature. —Remember the dot (talk) 01:08, 26 February 2013 (UTC)
 * I would do what you did and move the first ''' to the very beginning of the signature. —Remember the dot (talk) 01:08, 26 February 2013 (UTC)


 * Argh! I looked at that code several times but didn't spot the inconsistency. Again, sorry for the noise. I removed the live example to allow the highlighter to work properly on this page.
 * So that this thread isn't completely wasted, let me ask you something else that I've been wondering: is it possible to nest bold and italic markup?
 * →  bold bold-italic bold  works (seems to be correctly highlighted)
 * →  italic italic-bold italic  doesn't: the first two &apos;&apos; of the bold markup close the italics, then the third one does nothing, and the three &apos;&apos;&apos; that were supposed to close bold actually open it, but it gets overridden by the &apos;&apos; in the end, which also work strangely (nothing written after them is highlighted, except if some other markup is started). I'm not sure I can explain this well, but check it for yourself. Is this something that can be fixed? --Waldir talk 04:13, 28 February 2013 (UTC)
 * I think that example would require a backtracking parser, which would slow the syntax highlighter down a lot. In other words, the real MediaWiki parser doesn't know whether italic text is italic text or italic text until it does or does not come to a ''' outside of a &lt;nowiki> tag etc. So I don't know of a great solution here. If you can think of a clever one, let me know.
 * As a workaround, try  → italic italic-bold italic. —Remember the dot (talk) 05:08, 28 February 2013 (UTC)
 * I thought about this for a while but every solution I could come up with would fail in some case... I don't have anything to offer atm, sorry. By the way, your workaround doesn't really work for that case: the middle string is only bold, not bold-italic, both for the mediawiki parser and the syntax highlighter.--Waldir talk 14:05, 28 February 2013 (UTC)
 * You're right. I meant  → italic italic-bold italic, but this isn't a great solution either because it results in an unnecessary &lt;i> tag. Maybe best the thing to do here is use ordinary HTML tags:   → italic italic-bold italic. It's an interesting case for sure. —Remember the dot (talk) 00:14, 1 March 2013 (UTC)

Palette suggestion
Hi there. I've spent some time trying to devise a palette to propose as the default (or at least copy-pastable customization) for the highlighter. My notes are here. However, the table sorting code doesn't seem to be working well. Do you have any idea what may be causing this? --Waldir talk 16:51, 1 March 2013 (UTC)

restrict tags
I sometimes come across pages that use to denote placeholders, and this seems to confuse the highlighter ans it thinks they are opening tags without matching closing tags. Since there's a restricted set of tags allowed in mediawiki, how about making the highlighter only recognize those (along with &lt;ref>, &lt;source> and any others I might be forgetting atm)? --Waldir talk 02:55, 9 March 2013 (UTC)


 * How would the highlighter know which MediaWiki extensions are installed and which tags they provide? If there was some way to know then I could restrict which tags are recognized, but as it is I don't think it's possible.


 * By the way, your palette work is interesting. I'd like to see an actual proposal that I could copy-and-paste into my user JS to test. I don't know what's wrong with the sortable tables though. —Remember the dot (talk) 22:18, 9 March 2013 (UTC)

Syntax Highlighter issue with WikiEditor toolbar


Hi, I'm sometimes experiencing a nasty bug with your syntax higlighter in combination with the WikiEditor toolbar (see screenshot). I assume it's some kind of timing issue (toolbar loaded after highlighter or something like that) but I wasn't able to reproduce the bug so far. It's only happening sporadically. I hope you have an idea what's going wrong.

The error occured on commons:Template:Convert to SVG when choosing "View source". I'm using Firefox 20.0.1 on Windows 7 x64. I'm using vector skin, you can find my custom CSS here. --Patrick87 (talk) 19:54, 2 May 2013 (UTC)


 * Thanks for the bug report. I think you're right that the problem happens when the syntax highlighter loads before the editing toolbar. I just made a change to the syntax highlighter that should make it wait for the editing toolbar before loading, but because I've never seen the problem myself, I don't know for sure if this will fix it. If you see the problem again or find new problems, be sure to let me know. Happy editing! —Remember the dot (talk) 21:25, 5 May 2013 (UTC)


 * Hi, thank you for the update. I'll keep testing and report back if it ever happens again. --Patrick87 (talk) 22:07, 5 May 2013 (UTC)

Syntax highlighter in RTL Wikis
I just realized that the syntax highlighter does not work correctly in Wikis with RTL text. Not that I would really need it but it's probably easy to fix and would be a nice addition to the script. I just checked your overview of approach section and in fact you'd only have to correctly set  for RTL Wikis. I already tried it with Firefox's inspect utility and it works without obvious problems. --Patrick87 (talk) 06:05, 12 May 2013 (UTC)


 * I tried this with Firefox 20 on Windows 7 and Firefox 20 on Windows 8 and couldn't reproduce the bug on either. wpTextbox0 automatically inherits, at least on ar.wikipedia.org and he.wikipedia.org. I did, however, note that the syntax highlighter does not work in Chrom(e|ium) on RTL wikis on either Windows or Linux, and I have not found a workaround. —Remember the dot (talk) 04:19, 13 May 2013 (UTC)


 * I'm using Firefox 20.0.1 on Windows 7. Maybe it's an incompatibility with some other script then... wpTextbox0 inherits  from a   it's surrounded by. I'll check if I can figure out whats going wrong. --Patrick87 (talk) 09:58, 13 May 2013 (UTC)
 * Hah, I identified the problem. I recently set the language to English in preferences on all Wikipedias. If you set the language to English, most parts of the page are set to use LTR text, while the text fields still use RTL text. --Patrick87 (talk) 10:17, 13 May 2013 (UTC)


 * Ah, interesting. Well, that's easy to support: . —Remember the dot (talk) 01:04, 14 May 2013 (UTC)


 * Thanks for the prompt fix! --Patrick87 (talk) 01:51, 14 May 2013 (UTC)

Disable the highlighter in the Module: namespace
Can you add a check for the Module namespace to the syntax highlighter? The namespace number seems to be 828 wherever I look it up. Note however, that some wikis will reserve "/doc", "/documentation" or similar subpages for actual wikitext pages, so the best check should probably be "if in namespace 828, enable only if the preview button is present". Keφr 10:21, 12 May 2013 (UTC)


 * I just put in a check for the presence of the preview button. Let me know if it causes any problems. —Remember the dot (talk) 04:19, 13 May 2013 (UTC)


 * There is a problem — the highlighter does not start up when viewing source of protected pages. A better check (which also covers CSS and JavaScript cases, by the way) be, though it should be noted that it requires a bleeding-edge MediaWiki (1.22-wmf4). Keφr 12:59, 16 May 2013 (UTC)


 * Sorry for the delay; I meant to do this on Monday when 1.22-wmf4 was deployed here: The syntax highlighter now checks only wgPageContentModel. Thanks for bringing that solution to my attention; I wouldn't have noticed that that variable was available. It should be the end of this kind of problem. —Remember the dot (talk) 03:06, 23 May 2013 (UTC)


 * That change appears to break the script (preventing any syntax highlighting from occurring) on non-WMF wikis, because MW 1.22 is not yet available to the general public. (The wikis I tried are running MW 1.20 and 1.21.) Maybe we need to check  to decide between the old and new behavior? Or can we rely on   to be   on older MediaWiki versions? --SoledadKabocha (talk) 05:05, 26 May 2013 (UTC)


 * I suggest writing a shim to use on older versions of MediaWiki, something like:


 * This will work about as well as an older version of the syntax highlighter. —Remember the dot (talk) 06:23, 2 June 2013 (UTC)

A Barnstar for You

 * You're welcome! —Remember the dot (talk) 03:06, 23 May 2013 (UTC)

Syntax highlighter is one of the best gadgets I've ever used; it's on par with popups.
One question: it annoys me to no end when someone's poor syntax causes highlighting all the way down the page. Where can I get hold of a script that can locate the offending syntax and 'zap' it so it doesn't highlight the rest of the page?-- Laun  chba  ller  08:43, 16 May 2013 (UTC)


 * Unfortunately, I don't know of an easy way to do that. I just scroll up until I find the point where the highlighting starts, and try to see what's wrong. —Remember the dot (talk) 03:06, 23 May 2013 (UTC)
 * It doesn't seem to be doing it any more, but  was more often than not the main culprit. Has this been fixed?--  Laun  chba  ller  21:51, 23 May 2013 (UTC)
 * The syntax highlighter does not make an exception for  or any other self-closing tag for two reasons: 1) More exceptions to the rules means worse performance and more timeouts and 2)   makes it clear to humans and computers alike that there is no end tag coming. I have found that   and   are way overused on Wikipedia anyway, so usually the solution is to put some more thought into the template, reference, or paragraph where you think you need to use it. If you need some specific advice feel free to leave me another message. —Remember the dot (talk) 01:06, 24 May 2013 (UTC)

Syntax highlighter: Strange performance issues with large pages
I noticed some strange performance issues with the syntax highlighter on large pages. Strange, because highlighting is fast on page load (no timeout or similar), some edit operations are fast too, but other edit operations take ages and make Firefox hang for many seconds.

As an example consider Graphics Lab/Illustration workshop/Archive/Jan 2012: I'm sure you're able to find other examples yourself, especially you can probably understand why it is slow and if there is anything that can be done about it.
 * Simply writing an "a" at the end of the first line takes ages
 * Adding a line break at the beginning of the first line takes ages
 * Adding a line break at the beginning of the second line is quite fast

Regards, --Patrick87 (talk) 05:47, 2 June 2013 (UTC)


 * I tried editing that page with Firefox 21 on Lubuntu 13.04, Windows 7, and Windows 8, and I can't reproduce this issue on any of them. It seems to be uniformly fast or uniformly slow no matter what I do. I'd try installing Lubuntu or another flavor of Linux and seeing if you still have the problem. —Remember the dot (talk) 06:23, 2 June 2013 (UTC)


 * Wow, strange. No problem for me either today. I don't know what could have been causing this yesterday. Probably there was something really messed up in Firefox, that couldn't be solved by reloading the page (while holding Shift, therefore rebuilding caches). --Patrick87 (talk) 14:16, 2 June 2013 (UTC)

Sentence Spacing and pre-wrap
Hi,

I added a section to the Talk:Sentence spacing page to talk about your recent change. Battling McGook (talk) 18:37, 31 July 2013 (UTC)

A barnstar for you!

 * Thanks :D —Remember the dot (talk) 06:05, 9 August 2013 (UTC)

Problem customising colors
I've just started using your syntax highlighter. I find some of the syntax highlighting quite useful, but some of it is a distraction, so I tried to turn some of it off with this this common.js:

// https://www.mediawiki.org/wiki/User:Remember_the_dot/Syntax_highlighter syntaxHighlighterConfig = { boldColor: "", italicColor: "", wikilinkColor: "", headingColor: "", entityColor: "", }

but this seems to have no effect - the nominated items are still highlighted.

I'm using Firefox 14.0.1 on Windows 7, with MonoBook skin on Wikipedia. I've also tried Firefox 23.0.1 and Vector skin, but it doesn't work for those either.

What am I doing wrong? Mitch Ames (talk) 13:42, 3 September 2013 (UTC)
 * mw:User:Remember_the_dot/Syntax_highlighter: "To not highlight any syntax except those you explicitly want, set  to   and set the color of each syntax you want to highlight. If you just want the usual color, set the color to  ." Keφr 17:06, 3 September 2013 (UTC)


 * Mitch is doing it right. As the documentation says: "To not highlight a syntax, set its color to . For example, to disable external link highlighting..." The problem was a bug that went unnoticed in the syntax highlighter itself, which I have now corrected. The change should propagate to your computer within a day or two. Thanks for bringing the problem to my attention. —Remember the dot (talk) 17:20, 3 September 2013 (UTC)


 * Oh well, this would at least work immediately. I read the source code first, and skimmed where it is documented later. But okay, it seems that it is me who needs to learn to RTFM. Keφr 17:37, 3 September 2013 (UTC)


 * You're fine, and you're not wrong either. As you pointed out, both methods are supposed to work. —Remember the dot (talk) 17:42, 3 September 2013 (UTC)


 * It's working now - thanks for that.
 * I tested it by starting to edit a page selected at random from my watchlist - this version of "Political correctness". Scrolling through the edit window I noticed that everything after the second sentence of "History of the term" was incorrectly coloured as a tag. I was about to come and report the problem when I remembered that the syntax highlighter page warned that it was not tolerant of sloppy syntax. So working forward from the last correctly coloured text I noticed that someone had forgotten to close the italics in one of the refs - something I probably would not have noticed if not for the "incorrect" syntax highlighting (because the formatting was in the reference text not the body text) . I fixed the italics, and now the syntax highlight is correct. Colour me impressed! Thank you for a useful tool. Mitch Ames (talk) 01:09, 4 September 2013 (UTC)

Line breaks and slashes
You might be interested in User talk:Mitch Ames, which refers to your syntax highlighting tool.

I suggest that it might be worth updating the parsing section of the documentation to say:
 * ... use  instead of.

(with a space before the slash). Mitch Ames (talk) 09:40, 26 October 2013 (UTC)


 * Both  and   are perfectly valid XHTML. (And by extension, valid HTML5, because pretty much anything is "valid" in HTML5.) I've updated Line-break handling to be more clear on that point. —Remember the dot (talk) 17:40, 26 October 2013 (UTC)

Syntax highlighter: Minor error in highlighting of combination of bold and italic tags
Hi Remember the dot,

I found a (admittedly veeery unusual) combination of bold and italic tags in Wikitext that is not correctly highlighted by Syntax highlighter. Something like



in Wikitext leads to highlighting of everything between "Example 1" and "Example 2" and everything following after "Example 2".

As said before, it's only a very tiny and rare error and probably not worth spending much time on, but in case you are bored at some point or a perfectionist I thought I'd report it anyway.

Regards, --Patrick87 (talk) 00:50, 9 November 2013 (UTC)


 * See point 2 under mw:User:Remember the dot/Syntax highlighter. I haven't been able to think of any good way to fix the highlighter (a backtracking or lookahead parser would be too slow), so my suggestion is to avoid using that particular combination of markup. I think  or   is a little easier to read anyway. —Remember the dot (talk) 01:45, 9 November 2013 (UTC)


 * I see... Maybe you could just always treat three  as a   tag? I think it's a combination one would not use otherwise? This way you could at least balance all   and   tags preventing highlighting of all following text... --Patrick87 (talk) 02:08, 9 November 2013 (UTC)


 * Let's try it! I wrote a new heuristic for guessing what ticks mean. It will handle,  , but   and   don't work (not that they worked right before either...) Anyway, please give me some feedback and tell me whether you think it's better or worse this way. —Remember the dot (talk) 19:09, 9 November 2013 (UTC)
 * Wow, quick as always! Looks good so far after some quick tests. I'll let you know if I encounter any problems. --Patrick87 (talk) 20:30, 9 November 2013 (UTC)


 * The new code seems to have broken the configurable colour selection. My common.js has

// https://www.mediawiki.org/wiki/User:Remember_the_dot/Syntax_highlighter syntaxHighlighterConfig = { boldColor: "", italicColor: "", wikilinkColor: "", headingColor: "", signatureColor: "", tableColor: "#E6F2FF", entityColor: "", }
 * because I don't want bold and italic text highlighted. It was working OK up until recently, but now it is highlighting (in grey) bold, italic, and bold-italic text. Mitch Ames (talk) 03:39, 10 November 2013 (UTC)
 * The variable name was changed. If you set  instead of   and   it should work again. --Patrick87 (talk) 03:44, 10 November 2013 (UTC)
 * OK, fixed, thanks. Mitch Ames (talk) 04:01, 10 November 2013 (UTC)


 * Previously  worked, but   didn't; the apostrophe-italics case, although I didn't test it at the time, presumably didn't either (as you say yourself "not that they worked right before either..."). Now, the first two cases are supported and the third still isn't. As I see it, it's a net positive. Losing the ability to differentiate bold vs. italic coloring seems like a small price to pay to prevent large runs of incorrectly highlighted text. --Waldir talk 13:31, 10 November 2013 (UTC)


 * Yeah I think so too. To clarify the differences in behavior, I put together a table for you:


 * Make sure to tell me if you run into more problems with this behavior. —Remember the dot (talk) 21:02, 10 November 2013 (UTC)

Style guideline for HTML entities
In the comments of Syntax highlighter.js, you wrote, "Use of other entities is discouraged as a matter of style." What specific guideline were you referring to? WP:ENTITY doesn't exist, and the closest relevant section I saw is MOS:MARKUP, which seems rather vague on this point.

I'm asking because I'm guilty of using  and   a lot on userspace pages documenting my scripts and TODOs, because that's the easiest way I can remember to type those arrows. This is, of course, not any kind of feature request for the syntax highlighter. --SoledadKabocha (talk) 03:34, 27 December 2013 (UTC)


 * Yeah, it's somewhat subjective. I didn't want to complicate the syntax highlighter code and degrade its performance by supporting hundreds of character entities, and I wanted to fight back against overcomplicated, scary-looking wikitext. Did you know that just above the edit summary box there are little links to insert the ← and → characters? —Remember the dot (talk) 05:06, 28 December 2013 (UTC)
 * I was probably aware of that at some point in the past, but I've had the edittools disabled for a long time (I made some excuse about "saving processing power" even though all my computers/ISPs are well more than fast enough; though this is understandable with all the other scripts I'm using... Perhaps the real reason was to make the screen look "cleaner," as I'm not actually short on screen space either). Are  and   really that big a sin, considering that not many users use the syntax highlighter?
 * BTW, is it worth redirecting WP:ENTITY somewhere? --SoledadKabocha (talk) 17:52, 28 December 2013 (UTC)


 * I wouldn't say they're a sin, but I definitely think that enabling the edittools is a better solution. I'd leave WP:ENTITY alone for now. —Remember the dot (talk) 18:46, 28 December 2013 (UTC)
 * I'm still reluctant to use edittools just for that purpose, so I'll be writing a new script to replace the entities with the proper arrow characters. (Sorry, I hope I'm not sounding too stubborn here.) --SoledadKabocha (talk) 23:08, 28 December 2013 (UTC)


 * You're fine. Happy New Year! —Remember the dot (talk) 06:09, 29 December 2013 (UTC)