我想知道是否有可能有一个"剧剧文本",也就是说,与这个问题不同,只有当鼠标悬停在上面时才能看到文本,在GitHub调味Markdown
我试过这样做,但它不起作用。
<p>Lorem ipsum <span id="hidden_text" style="visibility: hidden;" onmouseover="document.getElementById('hidden_text').style.visibility='visible';">hidden stuff hidden stuff</span> text text text</p>
编辑:
在试图找出问题的时候,我在GFM的GitHub仓库中发现html被严重净化了。所以,我更想知道是否有可能获得这种行为。
您可以将CSS嵌入到SVG文件中,如本站点所述。事实上,你也可以把你的完整代码直接放在SVG中,然后嵌入它。
所以像这样的东西可能会奇怪地工作。
在你的repo中创建一个svg:
<svg fill="none" viewBox="0 0 800 400" width="500" height="70" xmlns="http://www.w3.org/2000/svg">
<foreignObject width="100%" height="100%">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>Lorem ipsum <span id="hidden_text" style="visibility: hidden;" onmouseover="document.getElementById('hidden_text').style.visibility='visible';">hidden stuff hidden stuff</span> text text text</p>
</div>
</foreignObject>
</svg>
然后在repo中的markdown文件中,添加如下内容:
<img src="fileyoumadebefore.svg" width="500" height="70">
编辑:在我自己的测试中,我发现有必要对文本进行样式设置,否则它会变得非常小。你需要多玩一会儿。也许更可行的格式化方法是根据链接的站点将CSS放在svg中,而将html保留在markdown文件中。(只是不确定GitHuB是否会清除你的onmouseover)