selfthinker / dokuwiki_plugin_wrap

Wrap Plugin for DokuWiki: Universal plugin which combines functionalities of many other plugins. Wrap wiki text inside containers (divs or spans) and give them a class (choose from a variety of preset classes), a width and/or a language with its associated text direction.
http://www.dokuwiki.org/plugin:wrap
GNU General Public License v2.0
42 stars 33 forks source link

Use <mark> for highlighting #251

Closed saschaleib closed 1 year ago

saschaleib commented 1 year ago

This is a small change that makes the wrap plugin use <mark> instead of <span hi> for the highlight button.

A side-effect of this change is that it will also make it easier to add more tags, which may be important in the future when DokuWiki will no longer allow embedding HTML code.

fiwswe commented 1 year ago

The <mark> HTML tag is relatively new and not supported by some older browsers. See https://caniuse.com/?search=mark

Maybe there should be a fallback? Or an option in the config to go back to <span class="wrap_hi">

Nor sure what https://github.com/selfthinker/dokuwiki_plugin_wrap/pull/251/commits/33018e85637ec71dfc775d11474bef4e98108457 has to do with this change though? Maybe separate PRs would be better?

saschaleib commented 1 year ago

Hm, it seems the language attribute update somehow also sneaked in to this pull request. Sorry about that - I'll close this one and make a new one.

saschaleib commented 1 year ago

Sorry for the mixup with the previous change. I have closed this request one already and created a new one.

As for the support issue, though: in browsers that do not support the tag, it will still behave like a span, while other browsers can take advantage of the new semantics.

Edit: also: please check: <mark> is supported e.g. since version 4 in Firefox (12 years ago), For other older browsers, the support is "unknown". However, e.g. in Chrome the support is actually just as old.

fiwswe commented 1 year ago

I just took a look at Safari 11.1.2 from OS X 10.11.6. The <mark> element actually works fine to my surprise. So I guess some of the uncertainty is that caniuse.com has no test data, rather than the tag not working.

saschaleib commented 1 year ago

Hi again, I tested it on Chrome 15 (from 2011) via BrowserStack - there is definitely support for <mark> already there (at least it appears correctly). Didn't have time to test more browsers (but Safari on my old iPad with iOS 12.5 also seems to handle it quite fine).

I can, however, assure you that I am using the tag in other contexts already since many years and didn't encounter problems. The reason being that even if there would be no support in any browser, it would just be used as a (semantically) empty tag, equivalent to <span> – so we are in no worse situation here than if we just used <span>, as now...

But I would also like to emphasize that the more important change is that this will introduce a mechanism for enabling additional HTML tags to be used with the Wrap attributes system. This will be all the more important once the HTML option in DokuWiki is removed – then there will be no more (easy) way to create semantic markup within DW pages... and while I know that not everybody cares about this, I definitely do :-)

My idea here is to provide the mechanism within Wrap (maybe with a small set of tags already supported, most importantly <mark>) and then have an add-on plugin that introduces the other tags for those users who need markup like <article>, <figure> or <abbr>, etc. …

I think this would be an important improvement that would benefit at least the group of users who care about stuff like Accessibility and ertain usability features.