You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using the following code to move all data-* attributes from <pre> tags onto <code> blocks before Reveal.intialize(...):
functionmoveDataAttributesToCodeElement(){constcodeElements=document.querySelectorAll("pre > code")codeElements.forEach((code,index)=>{console.log(`Moving all 'data-' attributes of code block ${index} to <code>`,code,)constpre=code.parentNodeconsole.log(pre)Array.from(pre.attributes).forEach((attr)=>{if(attr.name.startsWith("data-")){code.setAttribute(attr.name,attr.value)pre.removeAttribute(attr.name)}})})}
This works nicely. But somehow data-fragment-index="1" gets changed to ="0" with this initialization function:
moveDataAttributesToCodeElement()// Full list of configuration options available at:// https://revealjs.com/config/Reveal.initialize({plugins: [RevealNotes,RevealSearch,RevealZoom,RevealHighlight,RevealMath.MathJax3,RevealMenu]})
I am wondering what I am doing wrong when changeing the DOM just before Reveal initializes. It seems to not take up that
changes correctly?
Is there a better approach?
The text was updated successfully, but these errors were encountered:
I am using the following code to move all
data-*
attributes from<pre>
tags onto<code>
blocks beforeReveal.intialize(...)
:This works nicely. But somehow
data-fragment-index="1"
gets changed to="0"
with this initialization function:I am wondering what I am doing wrong when changeing the DOM just before Reveal initializes. It seems to not take up that
changes correctly?
Is there a better approach?
The text was updated successfully, but these errors were encountered: