Html 'a' tags target get overwritten in preview mode

Steps to reproduce

Say you want to embed a youtube video as an iframe and have links to timestamps in that video. 1 technique is to set the target attribute of a bare HTML anchor tag.

 <iframe src="" name = "myIframe"></iframe>

<a href="" target="myIframe">Link Text</a>

Expected result

The outerHtml of the rendered anchor tag should match the html as it was typed (ie the markdown parser shouldn’t do anything to the html.

Actual result

Opening dev tools, it looks like the markdown preview mode render overwrites target and rel

<a href="" target="_blank" rel="noopener">Link Text</a>

The iframe is rendered with name="myIframe" intact


  • Operating system:
    macOS 11.1

  • Obsidian version:

Additional information

Not a bug. This is the html sanitizer cleaning up the links.