Skip to content

HTML Render Method#130

Merged
BigBlueHat merged 3 commits intomainfrom
html-render-method
Feb 12, 2026
Merged

HTML Render Method#130
BigBlueHat merged 3 commits intomainfrom
html-render-method

Conversation

@BigBlueHat
Copy link
Contributor

@BigBlueHat BigBlueHat commented Feb 5, 2026

  • Allow queries.json to be optional.
  • Add HTML Render Method example credential.

The contained credential.json VC can be tested on VC Viewer. Once merged, this will show up in the examples list there automatically.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Feb 5, 2026

Deploying vc-examples with  Cloudflare Pages  Cloudflare Pages

Latest commit: 786001d
Status: ✅  Deploy successful!
Preview URL: https://9a4f44e1.vc-examples.pages.dev
Branch Preview URL: https://html-render-method.vc-examples.pages.dev

View logs

@BigBlueHat BigBlueHat changed the title html render method HTML Render Method Feb 5, 2026
"/issuer/name",
"/credentialSubject/name"
],
"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>",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this needs to be in a data URL.

"/issuer/name",
"/credentialSubject/name"
],
"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>",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This?

Suggested change
"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>",
"template": "data:text/html;base64,PGRpdj4KICA8c2NyaXB0PgogICAgZG9jdW1lbnQuYWRkRXZlbnRMaXN0ZW5lcignRE9NQ29udGVudExvYWRlZCcsIChldmVudCkgPT4gewogICAgY29uc29sZS5sb2coJ3J1bm5pbmcgdGVtcGxhdGUgcmVuZGVyIHNjcmlwdCcpOwoKICAgIC8vIGRpc3BsYXkgY3JlZGVudGlhbCBhcyBKU09OIGFzIGFuIGV4YW1wbGUgcmVuZGVyZXI7IGFueXRoaW5nCiAgICAvLyBjb3VsZCBiZSBkb25lIGhlcmUgaW5zdGVhZCwgaW5jbHVkaW5nIG11c3RhY2hlL290aGVyLXN0eWxlCiAgICAvLyB0ZW1wbGF0ZSBwcm9jZXNzaW5nIHRvIGdlbmVyYXRlIHRoZSBIVE1MIGZvciBkaXNwbGF5CgogICAgLy8gRklYTUU6IGRldGVybWluZSBiZXN0IG5hbWUvbG9jYXRpb24gZm9yIHRoZSBkYXRhYmxvY2svc2NyaXB0IHRhZwogICAgY29uc3QgY3JlZGVudGlhbCA9IEpTT04ucGFyc2UoZG9jdW1lbnQucXVlcnlTZWxlY3RvcigKICAgICAgJ2hlYWQgPiBzY3JpcHRbbmFtZT0iY3JlZGVudGlhbCJdJykuaW5uZXJIVE1MKTsKCiAgICBkb2N1bWVudC5xdWVyeVNlbGVjdG9yKCcjY3JlZGVudGlhbFN1YmplY3QtbmFtZScpLmlubmVyVGV4dCA9CiAgICAgIGNyZWRlbnRpYWwuY3JlZGVudGlhbFN1YmplY3QubmFtZTsKICAgIGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3IoJyNpc3N1ZXItbmFtZScpLmlubmVyVGV4dCA9CiAgICAgIGNyZWRlbnRpYWwuaXNzdWVyLm5hbWU7CgogICAgLy8gVEJEOiBzaWduYWwgdG8gaG9zdCB0aGF0IHJlbmRlcmluZyBpcyBjb21wbGV0ZQogICAgd2luZG93LnJlbmRlck1ldGhvZFJlYWR5KCk7Cn0pOyAgPC9zY3JpcHQ+CiAgPHN0eWxlPgogICAgaDEgewogICAgICBjb2xvcjogYmx1ZTsKICAgIH0KICA8L3N0eWxlPgoKICA8aDEgaWQ9ImNyZWRlbnRpYWxTdWJqZWN0LW5hbWUiPjwvaDE+CiAgPHA+SXNzdWVkIGJ5OiA8c3BhbiBpZD0iaXNzdWVyLW5hbWUiPjwvc3Bhbj48L3A+CjwvZGl2Pg==",

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think base64-ing these should fall to the choice of the implementer and the data: URL spec should be references for if/when/how to do that or find a need/reason to. I'd rather not require it as it overly constrains the URL space (which won't makes us friends...) and base64-ing often bloats the size of plain text.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heh...just realized this is the examples repo not the spec repo. I'll fix it here and fix https://github.com/digitalbazaar/vc-viewer to match. Thanks!

@BigBlueHat
Copy link
Contributor Author

Still avoiding base64 in the example, but digitalbazaar/vc-viewer#13 does implement that as an option.

"/issuer/name",
"/credentialSubject/name"
],
"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>",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only comment is just me not knowing whether base64 encoding is a requirement here for proper parsing or not. Not a blocker because if we find out it needs it, we'll fix this, and if we don't, then we don't need the overhead.

@BigBlueHat BigBlueHat requested a review from dlongley February 12, 2026 16:46
@BigBlueHat BigBlueHat merged commit ab96864 into main Feb 12, 2026
5 checks passed
@BigBlueHat BigBlueHat deleted the html-render-method branch February 12, 2026 17:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants