@@ -23,6 +23,46 @@ see README at root of repo for usage details
2323
2424---
2525
26+ ## Members
27+
28+ <dl >
29+ <dt ><a href =" #DEV-Post-Declarative-Shadow-DOM " >DEV-Post-Declarative-Shadow-DOM</a > ⇒ <code >string</code ></dt >
30+ <dd ></dd >
31+ <dt ><a href =" #DEV-Declarative-Shadow-DOM " >DEV-Declarative-Shadow-DOM</a > ⇒ <code >string</code ></dt >
32+ <dd ></dd >
33+ </dl >
34+
35+ ## Objects
36+
37+ <dl >
38+ <dt ><a href =" #DEVUtils " >DEVUtils</a > : <code >object</code ></dt >
39+ <dd ><p >Utility functions for fetching and parsing dev.to api data, getting
40+ styles and generating HTML for dev.to profile UIs</p >
41+ </dd >
42+ </dl >
43+
44+ <a name =" DEV-Post-Declarative-Shadow-DOM " ></a >
45+
46+ ## DEV-Post-Declarative-Shadow-DOM ⇒ <code >string</code >
47+ ** Kind** : global variable
48+ ** Returns** : <code >string</code > - DEV post HTML wrapped in a ` template `
49+
50+ | Param | Type | Description |
51+ | --- | --- | --- |
52+ | content | <code >ForemPostHTML</code > | Content about one post by dev.to (or Forem) user |
53+ | fetch | <code >boolean</code > | |
54+
55+ <a name =" DEV-Declarative-Shadow-DOM " ></a >
56+
57+ ## DEV-Declarative-Shadow-DOM ⇒ <code >string</code >
58+ ** Kind** : global variable
59+ ** Returns** : <code >string</code > - DEV HTML wrapped in a ` template `
60+
61+ | Param | Type | Description |
62+ | --- | --- | --- |
63+ | content | <code >ForemUserHTML</code > | a content object representing a DEV user |
64+ | fetch | <code >boolean</code > | |
65+
2666<a name =" DEVUtils " ></a >
2767
2868## DEVUtils : <code >object</code >
@@ -51,17 +91,14 @@ Utility functions for fetching and parsing dev.to api data, getting
5191Utility functions for a post
5292
5393** Kind** : static namespace of [ <code >DEVUtils</code >] ( #DEVUtils )
54- ** Example** * (Server side rendering trick )*
94+ ** Example** * (Server side rendering a post with Declarative Shadow Dom )*
5595``` js
56- < devto- post>
57- < template id= " devto-post" shadowrootmode= " open" >< / template>
58- < / devto- post>
96+ < devto- post>< / devto- post>
5997
6098< script type= " module" >
6199import {post } from ' profile-components/devto-utils' ;
62- const content = post .generateContent ({id: ' 12345' }, true );
63- const html = post .html (content);
64- document .querySelector (' #devto-post' ).innerHTML = ` <style >${post .style } </style >${ html} ` ;
100+ const dsdHTML = post .dsd ({id: ' 12345' }, true );
101+ document .querySelector (' devto-post' ).innerHTML = dsdHTML;
65102< / script>
66103```
67104
@@ -131,17 +168,14 @@ Forem post content, ready for HTML
131168Utility functions for a user
132169
133170** Kind** : static namespace of [ <code >DEVUtils</code >] ( #DEVUtils )
134- ** Example** * (Server side rendering trick )*
171+ ** Example** * (Server side rendering with Declarative Shadow Dom )*
135172``` js
136- < devto- user>
137- < template id= " devto-user" shadowrootmode= " open" >< / template>
138- < / devto- user>
173+ < devto- user>< / devto- user>
139174
140175< script type= " module" >
141- import {user } from ' profile-components/devto-utils' ;
142- const content = user .generateContent ({username: ' scottnath' }, true );
143- const html = user .html (content);
144- document .querySelector (' #devto-user' ).innerHTML = ` <style >${user .style } </style >${ html} ` ;
176+ import {dsd } from ' profile-components/devto-utils' ;
177+ const dsdHTML = dsd ({username: ' scottnath' }, true );
178+ document .querySelector (' devto-user' ).innerHTML = dsdHTML;
145179< / script>
146180```
147181
0 commit comments