google / schema-dts

JSON-LD TypeScript types for Schema.org vocabulary
Apache License 2.0
889 stars 33 forks source link

Feature Request: Add safeJsonLdReplacer() from react-schemaorg to schema-dts-gen generated code #150

Closed eamon-otuathail closed 3 years ago

eamon-otuathail commented 3 years ago

The react-schemaorg project (also by the hard-working Eyas) has a useful function safeJsonLdReplacer() in: https://github.com/google/react-schemaorg/blob/master/src/json-ld.tsx

safeJsonLdReplacer() is not React specific, but is general to any solution working with HTML and JSON-LD: https://www.w3.org/TR/json-ld11/#restrictions-for-contents-of-json-ld-script-elements

For folks who do use schema-dts-gen but don't use React (e.g. those who use Angular 12) it would be handy if safeJsonLdReplacer() were added to the generated code created by schema-dts-gen, so all can use it when needed.