Skip to content

Instantly share code, notes, and snippets.

@moreati
Last active July 3, 2017 00:35
Show Gist options
  • Save moreati/4fb8b56656bc70ea432b7e0458e76063 to your computer and use it in GitHub Desktop.
Save moreati/4fb8b56656bc70ea432b7e0458e76063 to your computer and use it in GitHub Desktop.
Trying a custom named entity with (X)HTML
<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml;charset=utf-8"/>
<title>Testy test</title>
</head>
<body style="background: black;">
<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
<symbol id="twitter" viewBox="0 0 512 512">
<path d="m456 133c-14 7-31 11-47 13 17-10 30-27 37-46-15 10-34 16-52 20-61-62-157-7-141 75-68-3-129-35-169-85-22 37-11 86 26 109-13 0-26-4-37-9 0 39 28 72 65 80-12 3-25 4-37 2 10 33 41 57 77 57-42 30-77 38-122 34 170 111 378-32 359-208 16-11 30-25 41-42z" fill="#fff" />
</symbol>
</svg>
<p><svg><use xlink:href="#twitter"/></svg></p>
<p><svg><use xlink:href="#twitter"/></svg></p>
</body>
</html>
<!DOCTYPE html [
<!ENTITY twitter "<svg class='svg-icons' viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'><path d='m456 133c-14 7-31 11-47 13 17-10 30-27 37-46-15 10-34 16-52 20-61-62-157-7-141 75-68-3-129-35-169-85-22 37-11 86 26 109-13 0-26-4-37-9 0 39 28 72 65 80-12 3-25 4-37 2 10 33 41 57 77 57-42 30-77 38-122 34 170 111 378-32 359-208 16-11 30-25 41-42z' fill='#000'/></svg>">
]>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="UTF-8"/>
<title>HTML Entities</title>
</head>
<body>
<span>&twitter;</span>
<span>&twitter;</span>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment