php-markdown icon indicating copy to clipboard operation
php-markdown copied to clipboard

How to replace specific <span> like actually with <abbr>?

Open BarbzYHOOL opened this issue 5 years ago • 2 comments

I'd like to explain some words, but they are not abbreviations, so it's wrong to explain these words with <abbr title="">

I just would like to reproduce the system of abbrs but with some changes and only to certain <span>, any idea how to proceed?

I read the code a bit but it looked very confusing, with meaningless names etc

note: posted here first https://github.com/jonlabelle/ci-markdown/issues/14

BarbzYHOOL avatar May 13 '20 00:05 BarbzYHOOL

I'm not sure exactly what would suit your needs, but here's a few hints in case you want to tweak the code.

Abbreviations are handled in two phases. First it reads and remove abbreviation definitions from the Markdown source in stripAbbreviations and the callback function that follows. Then it searches for abbreviations in the text in doAbbreviations and replaces occurrences in the callback function that follows.

michelf avatar May 13 '20 00:05 michelf

(my bad, i edited the first message, some html had been lost in xss filtering)

What I meant was to write a list of words, then when it's transformed into html, it automatically adds <span title="definition">word</span>

BarbzYHOOL avatar May 13 '20 00:05 BarbzYHOOL