Skip to content

Commit 786001d

Browse files
committed
Use a data: URL for template.
1 parent 29cb517 commit 786001d

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

credentials/html-render-method/credential.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"/issuer/name",
2323
"/credentialSubject/name"
2424
],
25-
"template": "<div>\n <script>\n document.addEventListener('DOMContentLoaded', (event) => {\n console.log('running template render script');\n\n // display credential as JSON as an example renderer; anything\n // could be done here instead, including mustache/other-style\n // template processing to generate the HTML for display\n\n // FIXME: determine best name/location for the datablock/script tag\n const credential = JSON.parse(document.querySelector(\n 'head > script[name=\"credential\"]').innerHTML);\n\n document.querySelector('#credentialSubject-name').innerText =\n credential.credentialSubject.name;\n document.querySelector('#issuer-name').innerText =\n credential.issuer.name;\n\n // TBD: signal to host that rendering is complete\n window.renderMethodReady();\n}); </script>\n <style>\n h1 {\n color: blue;\n }\n </style>\n\n <h1 id=\"credentialSubject-name\"></h1>\n <p>Issued by: <span id=\"issuer-name\"></span></p>\n</div>",
25+
"template": "data:text/html,<div>\n <script>\n document.addEventListener('DOMContentLoaded', (event) => {\n console.log('running template render script');\n\n // display credential as JSON as an example renderer; anything\n // could be done here instead, including mustache/other-style\n // template processing to generate the HTML for display\n\n // FIXME: determine best name/location for the datablock/script tag\n const credential = JSON.parse(document.querySelector(\n 'head > script[name=\"credential\"]').innerHTML);\n\n document.querySelector('#credentialSubject-name').innerText =\n credential.credentialSubject.name;\n document.querySelector('#issuer-name').innerText =\n credential.issuer.name;\n\n // TBD: signal to host that rendering is complete\n window.renderMethodReady();\n}); </script>\n <style>\n h1 {\n color: blue;\n }\n </style>\n\n <h1 id=\"credentialSubject-name\"></h1>\n <p>Issued by: <span id=\"issuer-name\"></span></p>\n</div>",
2626
"outputPreference": {
2727
"mode": [
2828
"visual"

0 commit comments

Comments
 (0)