icons too", async (t) => {
65 | let md = new MarkdownToHtml();
66 |
67 | assert.equal(await md.toMarkdown(` `, sampleEntry), ` `);
68 | });
69 |
70 |
--------------------------------------------------------------------------------
/test/sources/blog-awesome-author.json:
--------------------------------------------------------------------------------
1 | {
2 | "id": 155431370,
3 | "name": "Matt Johnson",
4 | "url": "",
5 | "description": "",
6 | "link": "https://blog.fontawesome.com/author/iamthedayofcurrenttaste/",
7 | "slug": "iamthedayofcurrenttaste",
8 | "avatar_urls": {
9 | "24": "https://secure.gravatar.com/avatar/b548253c6adbbd36ce84487da009e1aa?s=24&r=g",
10 | "48": "https://secure.gravatar.com/avatar/b548253c6adbbd36ce84487da009e1aa?s=48&r=g",
11 | "96": "https://secure.gravatar.com/avatar/b548253c6adbbd36ce84487da009e1aa?s=96&r=g"
12 | },
13 | "meta": [],
14 | "yoast_head": "\nMatt Johnson, Author at Blog Awesome \n\n \n \n \n \n \n \n \n \n \n \n\n",
15 | "yoast_head_json": {
16 | "title": "Matt Johnson, Author at Blog Awesome",
17 | "robots": {
18 | "index": "index",
19 | "follow": "follow",
20 | "max-snippet": "max-snippet:-1",
21 | "max-image-preview": "max-image-preview:large",
22 | "max-video-preview": "max-video-preview:-1"
23 | },
24 | "canonical": "https://blog.fontawesome.com/author/iamthedayofcurrenttaste/",
25 | "og_locale": "en_US",
26 | "og_type": "profile",
27 | "og_title": "Matt Johnson, Author at Blog Awesome",
28 | "og_url": "https://blog.fontawesome.com/author/iamthedayofcurrenttaste/",
29 | "og_site_name": "Blog Awesome",
30 | "og_image": [
31 | {
32 | "url": "https://secure.gravatar.com/avatar/b548253c6adbbd36ce84487da009e1aa?s=500&r=g"
33 | }
34 | ],
35 | "twitter_card": "summary_large_image",
36 | "twitter_site": "@fontawesome",
37 | "schema": {
38 | "@context": "https://schema.org",
39 | "@graph": [
40 | {
41 | "@type": "ProfilePage",
42 | "@id": "https://blog.fontawesome.com/author/iamthedayofcurrenttaste/",
43 | "url": "https://blog.fontawesome.com/author/iamthedayofcurrenttaste/",
44 | "name": "Matt Johnson, Author at Blog Awesome",
45 | "isPartOf": { "@id": "https://blog.fontawesome.com/#website" },
46 | "breadcrumb": {
47 | "@id": "https://blog.fontawesome.com/author/iamthedayofcurrenttaste/#breadcrumb"
48 | },
49 | "inLanguage": "en-US",
50 | "potentialAction": [
51 | {
52 | "@type": "ReadAction",
53 | "target": [
54 | "https://blog.fontawesome.com/author/iamthedayofcurrenttaste/"
55 | ]
56 | }
57 | ]
58 | },
59 | {
60 | "@type": "BreadcrumbList",
61 | "@id": "https://blog.fontawesome.com/author/iamthedayofcurrenttaste/#breadcrumb",
62 | "itemListElement": [
63 | {
64 | "@type": "ListItem",
65 | "position": 1,
66 | "name": "Home",
67 | "item": "https://blog.fontawesome.com/"
68 | },
69 | {
70 | "@type": "ListItem",
71 | "position": 2,
72 | "name": "Archives for Matt Johnson"
73 | }
74 | ]
75 | },
76 | {
77 | "@type": "WebSite",
78 | "@id": "https://blog.fontawesome.com/#website",
79 | "url": "https://blog.fontawesome.com/",
80 | "name": "Blog Awesome",
81 | "description": "News and information from Font Awesome – the internet's favorite icon set; mixed with musings and nerdery from the team behind it.",
82 | "potentialAction": [
83 | {
84 | "@type": "SearchAction",
85 | "target": {
86 | "@type": "EntryPoint",
87 | "urlTemplate": "https://blog.fontawesome.com/?s={search_term_string}"
88 | },
89 | "query-input": {
90 | "@type": "PropertyValueSpecification",
91 | "valueRequired": true,
92 | "valueName": "search_term_string"
93 | }
94 | }
95 | ],
96 | "inLanguage": "en-US"
97 | },
98 | {
99 | "@type": "Person",
100 | "@id": "https://blog.fontawesome.com/#/schema/person/7bc6a686f3fdf796f6e069c674ea7dbe",
101 | "name": "Matt Johnson",
102 | "image": {
103 | "@type": "ImageObject",
104 | "inLanguage": "en-US",
105 | "@id": "https://blog.fontawesome.com/#/schema/person/image/",
106 | "url": "https://secure.gravatar.com/avatar/b548253c6adbbd36ce84487da009e1aa?s=96&r=g",
107 | "contentUrl": "https://secure.gravatar.com/avatar/b548253c6adbbd36ce84487da009e1aa?s=96&r=g",
108 | "caption": "Matt Johnson"
109 | },
110 | "mainEntityOfPage": {
111 | "@id": "https://blog.fontawesome.com/author/iamthedayofcurrenttaste/"
112 | }
113 | }
114 | ]
115 | }
116 | },
117 | "amp_review_panel_dismissed_for_template_mode": "",
118 | "amp_dev_tools_enabled": false,
119 | "_links": {
120 | "self": [
121 | {
122 | "href": "https://blog.fontawesome.com/wp-json/wp/v2/users/155431370",
123 | "targetHints": { "allow": ["GET", "POST", "PUT", "PATCH", "DELETE"] }
124 | }
125 | ],
126 | "collection": [
127 | { "href": "https://blog.fontawesome.com/wp-json/wp/v2/users" }
128 | ]
129 | }
130 | }
131 |
--------------------------------------------------------------------------------
/test/sources/blog-awesome-categories.json:
--------------------------------------------------------------------------------
1 | {
2 | "id": 1,
3 | "count": 91,
4 | "description": "",
5 | "link": "https://blog.fontawesome.com/category/uncategorized/",
6 | "name": "Uncategorized",
7 | "slug": "uncategorized",
8 | "taxonomy": "category",
9 | "parent": 0,
10 | "meta": [],
11 | "yoast_head": "\u003C!-- This site is optimized with the Yoast SEO plugin v23.8 - https://yoast.com/wordpress/plugins/seo/ --\u003E\n\u003Ctitle\u003EUncategorized Archives - Blog Awesome\u003C/title\u003E\n\u003Cmeta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" /\u003E\n\u003Clink rel=\"canonical\" href=\"https://blog.fontawesome.com/category/uncategorized/\" /\u003E\n\u003Cmeta property=\"og:locale\" content=\"en_US\" /\u003E\n\u003Cmeta property=\"og:type\" content=\"article\" /\u003E\n\u003Cmeta property=\"og:title\" content=\"Uncategorized Archives - Blog Awesome\" /\u003E\n\u003Cmeta property=\"og:url\" content=\"https://blog.fontawesome.com/category/uncategorized/\" /\u003E\n\u003Cmeta property=\"og:site_name\" content=\"Blog Awesome\" /\u003E\n\u003Cmeta name=\"twitter:card\" content=\"summary_large_image\" /\u003E\n\u003Cmeta name=\"twitter:site\" content=\"@fontawesome\" /\u003E\n\u003Cscript type=\"application/ld+json\" class=\"yoast-schema-graph\"\u003E{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"CollectionPage\",\"@id\":\"https://blog.fontawesome.com/category/uncategorized/\",\"url\":\"https://blog.fontawesome.com/category/uncategorized/\",\"name\":\"Uncategorized Archives - Blog Awesome\",\"isPartOf\":{\"@id\":\"https://blog.fontawesome.com/#website\"},\"breadcrumb\":{\"@id\":\"https://blog.fontawesome.com/category/uncategorized/#breadcrumb\"},\"inLanguage\":\"en-US\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://blog.fontawesome.com/category/uncategorized/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https://blog.fontawesome.com/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Uncategorized\"}]},{\"@type\":\"WebSite\",\"@id\":\"https://blog.fontawesome.com/#website\",\"url\":\"https://blog.fontawesome.com/\",\"name\":\"Blog Awesome\",\"description\":\"News and information from Font Awesome – the internet's favorite icon set; mixed with musings and nerdery from the team behind it.\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https://blog.fontawesome.com/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}\u003C/script\u003E\n\u003C!-- / Yoast SEO plugin. --\u003E",
12 | "yoast_head_json": {
13 | "title": "Uncategorized Archives - Blog Awesome",
14 | "robots": {
15 | "index": "index",
16 | "follow": "follow",
17 | "max-snippet": "max-snippet:-1",
18 | "max-image-preview": "max-image-preview:large",
19 | "max-video-preview": "max-video-preview:-1"
20 | },
21 | "canonical": "https://blog.fontawesome.com/category/uncategorized/",
22 | "og_locale": "en_US",
23 | "og_type": "article",
24 | "og_title": "Uncategorized Archives - Blog Awesome",
25 | "og_url": "https://blog.fontawesome.com/category/uncategorized/",
26 | "og_site_name": "Blog Awesome",
27 | "twitter_card": "summary_large_image",
28 | "twitter_site": "@fontawesome",
29 | "schema": {
30 | "@context": "https://schema.org",
31 | "@graph": [
32 | {
33 | "@type": "CollectionPage",
34 | "@id": "https://blog.fontawesome.com/category/uncategorized/",
35 | "url": "https://blog.fontawesome.com/category/uncategorized/",
36 | "name": "Uncategorized Archives - Blog Awesome",
37 | "isPartOf": {
38 | "@id": "https://blog.fontawesome.com/#website"
39 | },
40 | "breadcrumb": {
41 | "@id": "https://blog.fontawesome.com/category/uncategorized/#breadcrumb"
42 | },
43 | "inLanguage": "en-US"
44 | },
45 | {
46 | "@type": "BreadcrumbList",
47 | "@id": "https://blog.fontawesome.com/category/uncategorized/#breadcrumb",
48 | "itemListElement": [
49 | {
50 | "@type": "ListItem",
51 | "position": 1,
52 | "name": "Home",
53 | "item": "https://blog.fontawesome.com/"
54 | },
55 | {
56 | "@type": "ListItem",
57 | "position": 2,
58 | "name": "Uncategorized"
59 | }
60 | ]
61 | },
62 | {
63 | "@type": "WebSite",
64 | "@id": "https://blog.fontawesome.com/#website",
65 | "url": "https://blog.fontawesome.com/",
66 | "name": "Blog Awesome",
67 | "description": "News and information from Font Awesome – the internet's favorite icon set; mixed with musings and nerdery from the team behind it.",
68 | "potentialAction": [
69 | {
70 | "@type": "SearchAction",
71 | "target": {
72 | "@type": "EntryPoint",
73 | "urlTemplate": "https://blog.fontawesome.com/?s={search_term_string}"
74 | },
75 | "query-input": {
76 | "@type": "PropertyValueSpecification",
77 | "valueRequired": true,
78 | "valueName": "search_term_string"
79 | }
80 | }
81 | ],
82 | "inLanguage": "en-US"
83 | }
84 | ]
85 | }
86 | },
87 | "_links": {
88 | "self": [
89 | {
90 | "href": "https://blog.fontawesome.com/wp-json/wp/v2/categories/1",
91 | "targetHints": {
92 | "allow": [
93 | "GET"
94 | ]
95 | }
96 | }
97 | ],
98 | "collection": [
99 | {
100 | "href": "https://blog.fontawesome.com/wp-json/wp/v2/categories"
101 | }
102 | ],
103 | "about": [
104 | {
105 | "href": "https://blog.fontawesome.com/wp-json/wp/v2/taxonomies/category"
106 | }
107 | ],
108 | "wp:post_type": [
109 | {
110 | "href": "https://blog.fontawesome.com/wp-json/wp/v2/posts?categories=1"
111 | }
112 | ],
113 | "curies": [
114 | {
115 | "name": "wp",
116 | "href": "https://api.w.org/{rel}",
117 | "templated": true
118 | }
119 | ]
120 | }
121 | }
122 |
--------------------------------------------------------------------------------
/test/sources/blog-awesome-posts.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "id": 3829,
4 | "date": "2021-12-07T11:35:48",
5 | "date_gmt": "2021-12-07T17:35:48",
6 | "guid": { "rendered": "https://blog.fontawesome.com/?p=3829" },
7 | "modified": "2021-12-07T11:36:05",
8 | "modified_gmt": "2021-12-07T17:36:05",
9 | "slug": "font-awesome-6",
10 | "status": "publish",
11 | "type": "post",
12 | "link": "https://blog.fontawesome.com/font-awesome-6/",
13 | "title": {
14 | "rendered": "It’s Official. Font Awesome 6 is Coming in February 2022! "
15 | },
16 | "content": {
17 | "rendered": "\nWe’re so close to launching version 6, and we figured it was high time to make an official announcement. So, save the date for February. Font Awesome 6 will go beyond pure icon-imagination!
\n\n\n\nSave the date! February 2022 is just around the corner! \n\n\n\nSo, what’s new?
\n\n\n\n \n\n\n\nMore Icons \n\n\n\nFont Awesome 6 contains over 7,000 new icons, so you’re sure to find what you need for your project. Plus, we’ve redesigned most of our icons from scratch, so they’re more consistent and easier to use.
\n\n\n\n \n\n\n\n \n\n\n\nMore Styles \n\n\n\nFont Awesome 6 includes five icons styles: solid, regular, light, duotone, and the new THIN style — not to mention all of our brand icons. And coming later in 2022 is the entirely new SHARP family of styles.
\n\n\n\n \n\n\n\n \n\n\n\nMore Ways to Use \n\n\n\nFont Awesome 6 makes it even easier to use icons where you want to. More plugins and packages to match your stack. Less time wrestling browser rendering.
\n\n\n\n \n\n\n\n \n\n\n\nWe’ll keep fine-tuning that sweet, sweet recipe until February. Believe us; the web’s going to have a new scrumpdillyicious secret ingredient!
\n\n\n\n Check Out the Beta! \n\n\n\n
\n",
18 | "protected": false
19 | },
20 | "excerpt": {
21 | "rendered": "We’re so close to launching version 6, and we figured it was high time to make an official announcement. So, save the date for February. Font Awesome 6 will go beyond pure icon-imagination! So, what’s new? More Icons Font Awesome 6 contains over 7,000 new icons, so you’re sure to find what you need for […]
\n",
22 | "protected": false
23 | },
24 | "author": 155431370,
25 | "featured_media": 3850,
26 | "comment_status": "open",
27 | "ping_status": "open",
28 | "sticky": false,
29 | "template": "",
30 | "format": "standard",
31 | "meta": {
32 | "jetpack_post_was_ever_published": false,
33 | "_jetpack_newsletter_access": "",
34 | "_jetpack_dont_email_post_to_subs": false,
35 | "_jetpack_newsletter_tier_id": 0,
36 | "_jetpack_memberships_contains_paywalled_content": false,
37 | "_jetpack_memberships_contains_paid_content": false,
38 | "footnotes": "",
39 | "jetpack_publicize_message": "",
40 | "jetpack_publicize_feature_enabled": true,
41 | "jetpack_social_post_already_shared": true,
42 | "jetpack_social_options": {
43 | "image_generator_settings": { "template": "highway", "enabled": false },
44 | "version": 2
45 | }
46 | },
47 | "categories": [1],
48 | "tags": [],
49 | "class_list": [
50 | "post-3829",
51 | "post",
52 | "type-post",
53 | "status-publish",
54 | "format-standard",
55 | "has-post-thumbnail",
56 | "hentry",
57 | "category-uncategorized"
58 | ],
59 | "jetpack_publicize_connections": [],
60 | "yoast_head": "\nIt’s Official. Font Awesome 6 is Coming in February 2022! - Blog Awesome \n\n \n \n \n \n \n \n \n \n \n \n \n\t \n\t \n\t \n \n \n \n \n \n\t \n\t \n\t \n\n",
61 | "yoast_head_json": {
62 | "title": "It’s Official. Font Awesome 6 is Coming in February 2022! - Blog Awesome",
63 | "robots": {
64 | "index": "index",
65 | "follow": "follow",
66 | "max-snippet": "max-snippet:-1",
67 | "max-image-preview": "max-image-preview:large",
68 | "max-video-preview": "max-video-preview:-1"
69 | },
70 | "canonical": "https://blog.fontawesome.com/font-awesome-6/",
71 | "og_locale": "en_US",
72 | "og_type": "article",
73 | "og_title": "It’s Official. Font Awesome 6 is Coming in February 2022! - Blog Awesome",
74 | "og_description": "We’re so close to launching version 6, and we figured it was high time to make an official announcement. So, save the date for February. Font Awesome 6 will go beyond pure icon-imagination! So, what’s new? More Icons Font Awesome 6 contains over 7,000 new icons, so you’re sure to find what you need for […]",
75 | "og_url": "https://blog.fontawesome.com/font-awesome-6/",
76 | "og_site_name": "Blog Awesome",
77 | "article_published_time": "2021-12-07T17:35:48+00:00",
78 | "article_modified_time": "2021-12-07T17:36:05+00:00",
79 | "og_image": [
80 | {
81 | "width": 1920,
82 | "height": 1080,
83 | "url": "https://blog.fontawesome.com/wp-content/uploads/2021/12/image-save-the-date.png",
84 | "type": "image/png"
85 | }
86 | ],
87 | "author": "Matt Johnson",
88 | "twitter_card": "summary_large_image",
89 | "twitter_creator": "@fontawesome",
90 | "twitter_site": "@fontawesome",
91 | "twitter_misc": {
92 | "Written by": "Matt Johnson",
93 | "Est. reading time": "2 minutes"
94 | },
95 | "schema": {
96 | "@context": "https://schema.org",
97 | "@graph": [
98 | {
99 | "@type": "WebPage",
100 | "@id": "https://blog.fontawesome.com/font-awesome-6/",
101 | "url": "https://blog.fontawesome.com/font-awesome-6/",
102 | "name": "It’s Official. Font Awesome 6 is Coming in February 2022! - Blog Awesome",
103 | "isPartOf": { "@id": "https://blog.fontawesome.com/#website" },
104 | "primaryImageOfPage": {
105 | "@id": "https://blog.fontawesome.com/font-awesome-6/#primaryimage"
106 | },
107 | "image": {
108 | "@id": "https://blog.fontawesome.com/font-awesome-6/#primaryimage"
109 | },
110 | "thumbnailUrl": "https://i0.wp.com/blog.fontawesome.com/wp-content/uploads/2021/12/image-save-the-date.png?fit=1920%2C1080&ssl=1",
111 | "datePublished": "2021-12-07T17:35:48+00:00",
112 | "dateModified": "2021-12-07T17:36:05+00:00",
113 | "author": {
114 | "@id": "https://blog.fontawesome.com/#/schema/person/7bc6a686f3fdf796f6e069c674ea7dbe"
115 | },
116 | "breadcrumb": {
117 | "@id": "https://blog.fontawesome.com/font-awesome-6/#breadcrumb"
118 | },
119 | "inLanguage": "en-US",
120 | "potentialAction": [
121 | {
122 | "@type": "ReadAction",
123 | "target": ["https://blog.fontawesome.com/font-awesome-6/"]
124 | }
125 | ]
126 | },
127 | {
128 | "@type": "ImageObject",
129 | "inLanguage": "en-US",
130 | "@id": "https://blog.fontawesome.com/font-awesome-6/#primaryimage",
131 | "url": "https://i0.wp.com/blog.fontawesome.com/wp-content/uploads/2021/12/image-save-the-date.png?fit=1920%2C1080&ssl=1",
132 | "contentUrl": "https://i0.wp.com/blog.fontawesome.com/wp-content/uploads/2021/12/image-save-the-date.png?fit=1920%2C1080&ssl=1",
133 | "width": 1920,
134 | "height": 1080
135 | },
136 | {
137 | "@type": "BreadcrumbList",
138 | "@id": "https://blog.fontawesome.com/font-awesome-6/#breadcrumb",
139 | "itemListElement": [
140 | {
141 | "@type": "ListItem",
142 | "position": 1,
143 | "name": "Home",
144 | "item": "https://blog.fontawesome.com/"
145 | },
146 | {
147 | "@type": "ListItem",
148 | "position": 2,
149 | "name": "It’s Official. Font Awesome 6 is Coming in February 2022! "
150 | }
151 | ]
152 | },
153 | {
154 | "@type": "WebSite",
155 | "@id": "https://blog.fontawesome.com/#website",
156 | "url": "https://blog.fontawesome.com/",
157 | "name": "Blog Awesome",
158 | "description": "News and information from Font Awesome – the internet's favorite icon set; mixed with musings and nerdery from the team behind it.",
159 | "potentialAction": [
160 | {
161 | "@type": "SearchAction",
162 | "target": {
163 | "@type": "EntryPoint",
164 | "urlTemplate": "https://blog.fontawesome.com/?s={search_term_string}"
165 | },
166 | "query-input": {
167 | "@type": "PropertyValueSpecification",
168 | "valueRequired": true,
169 | "valueName": "search_term_string"
170 | }
171 | }
172 | ],
173 | "inLanguage": "en-US"
174 | },
175 | {
176 | "@type": "Person",
177 | "@id": "https://blog.fontawesome.com/#/schema/person/7bc6a686f3fdf796f6e069c674ea7dbe",
178 | "name": "Matt Johnson",
179 | "image": {
180 | "@type": "ImageObject",
181 | "inLanguage": "en-US",
182 | "@id": "https://blog.fontawesome.com/#/schema/person/image/",
183 | "url": "https://secure.gravatar.com/avatar/b548253c6adbbd36ce84487da009e1aa?s=96&r=g",
184 | "contentUrl": "https://secure.gravatar.com/avatar/b548253c6adbbd36ce84487da009e1aa?s=96&r=g",
185 | "caption": "Matt Johnson"
186 | },
187 | "url": "https://blog.fontawesome.com/author/iamthedayofcurrenttaste/"
188 | }
189 | ]
190 | }
191 | },
192 | "jetpack_featured_media_url": "https://i0.wp.com/blog.fontawesome.com/wp-content/uploads/2021/12/image-save-the-date.png?fit=1920%2C1080&ssl=1",
193 | "jetpack_likes_enabled": true,
194 | "jetpack_sharing_enabled": true,
195 | "jetpack_shortlink": "https://wp.me/pasa0D-ZL",
196 | "amp_enabled": false,
197 | "_links": {
198 | "self": [
199 | {
200 | "href": "https://blog.fontawesome.com/wp-json/wp/v2/posts/3829",
201 | "targetHints": { "allow": ["GET", "POST", "PUT", "PATCH", "DELETE"] }
202 | }
203 | ],
204 | "collection": [
205 | { "href": "https://blog.fontawesome.com/wp-json/wp/v2/posts" }
206 | ],
207 | "about": [
208 | { "href": "https://blog.fontawesome.com/wp-json/wp/v2/types/post" }
209 | ],
210 | "author": [
211 | {
212 | "embeddable": true,
213 | "href": "https://blog.fontawesome.com/wp-json/wp/v2/users/155431370"
214 | }
215 | ],
216 | "replies": [
217 | {
218 | "embeddable": true,
219 | "href": "https://blog.fontawesome.com/wp-json/wp/v2/comments?post=3829"
220 | }
221 | ],
222 | "version-history": [
223 | {
224 | "count": 12,
225 | "href": "https://blog.fontawesome.com/wp-json/wp/v2/posts/3829/revisions"
226 | }
227 | ],
228 | "predecessor-version": [
229 | {
230 | "id": 3859,
231 | "href": "https://blog.fontawesome.com/wp-json/wp/v2/posts/3829/revisions/3859"
232 | }
233 | ],
234 | "wp:featuredmedia": [
235 | {
236 | "embeddable": true,
237 | "href": "https://blog.fontawesome.com/wp-json/wp/v2/media/3850"
238 | }
239 | ],
240 | "wp:attachment": [
241 | {
242 | "href": "https://blog.fontawesome.com/wp-json/wp/v2/media?parent=3829"
243 | }
244 | ],
245 | "wp:term": [
246 | {
247 | "taxonomy": "category",
248 | "embeddable": true,
249 | "href": "https://blog.fontawesome.com/wp-json/wp/v2/categories?post=3829"
250 | },
251 | {
252 | "taxonomy": "post_tag",
253 | "embeddable": true,
254 | "href": "https://blog.fontawesome.com/wp-json/wp/v2/tags?post=3829"
255 | }
256 | ],
257 | "curies": [
258 | { "name": "wp", "href": "https://api.w.org/{rel}", "templated": true }
259 | ]
260 | }
261 | }
262 | ]
263 |
--------------------------------------------------------------------------------
/test/sources/bluesky-test.xml:
--------------------------------------------------------------------------------
1 |
2 | 🌍 https://zachleat.com
🎈🐀 Creator/Maintainer of @11ty.dev
🎉 Builder at Font Awesome
🏳️⚧️ Listen to Trans Folks
👋🏻 He/him/they
🐘 Mastodon https://zachleat.com/@zachleat
✅ Front of the Front-end
✅ Static Sites
✅ Web Components
✅ Web Performance https://bsky.app/profile/zachleat.com@zachleat.com - Zach Leatherman https://bsky.app/profile/zachleat.com/post/3lckusgtkuk2rtime to review my HTML wrapped 2024
Most used: <a>
Doing work to reduce infrastructure bills: <picture>
Underrated: <output>
Misunderstood: <details>
Tame but a small win: <search>
Hope the design never calls for it: <dialog>
Not today Satan: <canvas>
Pure vibes: <noscript> 05 Dec 2024 14:26 +0000 at://did:plc:xpchjovbk6sxl3bv74z7cs54/app.bsky.feed.post/3lckusgtkuk2r
3 |
--------------------------------------------------------------------------------
/test/sources/youtube-user.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | yt:channel:skGTioqrMBcw8pd14_334A
5 | skGTioqrMBcw8pd14_334A
6 | Eleventy
7 |
8 |
9 | Eleventy
10 | https://www.youtube.com/channel/UCskGTioqrMBcw8pd14_334A
11 |
12 | 2022-02-14T17:18:45+00:00
13 |
14 | yt:video:kNI_LcbvtNk
15 | kNI_LcbvtNk
16 | UCskGTioqrMBcw8pd14_334A
17 | Managing content management (with no vendor lock-in) — David Large, Liam Bigelow (11ty Conf 2024)
18 |
19 |
20 | Eleventy
21 | https://www.youtube.com/channel/UCskGTioqrMBcw8pd14_334A
22 |
23 | 2024-05-17T18:27:22+00:00
24 | 2024-09-24T01:49:49+00:00
25 |
26 | Managing content management (with no vendor lock-in) — David Large, Liam Bigelow (11ty Conf 2024)
27 |
28 |
29 | CloudCannon is the Recommended CMS Partner of 11ty:
30 |
31 | https://cloudcannon.com/11tyconf/
32 | https://cloudcannon.com/blog/how-to-manage-hundreds-of-connected-websites-with-a-git-based-headless-cms/
33 |
34 | This was a talk given at the 11ty International Symposium on Making Web Sites Real Good (2024): https://conf.11ty.dev/2024/managing-content-management/
35 |
36 | If Jamstack has taught us anything, it’s that websites work best when they’re generated from folders full of flat files. Even massively interconnected websites!
37 |
38 | We talk through a classically Jamstacky approach to content management for large organizations: mounting shared layout and component repositories, creating a central content lake to aggregate content like news articles, and automating site builds and deployments when your content or dependencies change.
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 | yt:video:-Pl0ibl47Rc
47 | -Pl0ibl47Rc
48 | UCskGTioqrMBcw8pd14_334A
49 | 11ty and Large-Project Tooling — Paul Everitt (11ty Conf 2024)
50 |
51 |
52 | Eleventy
53 | https://www.youtube.com/channel/UCskGTioqrMBcw8pd14_334A
54 |
55 | 2024-05-17T18:27:18+00:00
56 | 2024-08-19T19:05:07+00:00
57 |
58 | 11ty and Large-Project Tooling — Paul Everitt (11ty Conf 2024)
59 |
60 |
61 | This was a talk given at the 11ty International Symposium on Making Web Sites Real Good (2024): https://conf.11ty.dev/2024/11ty-and-large-project-tooling/
62 |
63 | JetBrains has a knowledge base with lots of content, customizing, authors, developers… so we built it in Gatsby. Then switched to 11ty. But we wanted to keep some of the large-project tooling, so we added it. In this talk, we'll cover component driven development through TypeScript and TSX, unit testing with Vitest, in-editor validation of Markdown frontmatter for authors, content queries, and more.
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 | yt:video:P-I5D6BlejM
72 | P-I5D6BlejM
73 | UCskGTioqrMBcw8pd14_334A
74 | Digital Frontiers, IndieWeb Cowboys, and A Place Online To Call… — Henry Desroches (11ty Conf 2024)
75 |
76 |
77 | Eleventy
78 | https://www.youtube.com/channel/UCskGTioqrMBcw8pd14_334A
79 |
80 | 2024-05-17T18:27:14+00:00
81 | 2024-09-23T21:12:23+00:00
82 |
83 | Digital Frontiers, IndieWeb Cowboys, and A Place Online To Call… — Henry Desroches (11ty Conf 2024)
84 |
85 |
86 | This was a talk given at the 11ty International Symposium on Making Web Sites Real Good (2024): https://conf.11ty.dev/2024/digital-frontiers-indieweb-cowboys-and-a-place-online-to-call-your-own/
87 |
88 | The IndieWeb is a community of developers and designers and web-surfing wraiths connected by a belief in personal websites/domains as identity, digital self-publishing, and perhaps most chiefly owning one's content. In this talk, Henry will explore the key principles of the IndieWeb, and specifically focus on the concept of POSSE (or "Publish (on your) Own Site, Syndicate Elsewhere"), its benefits, and how it empowers folks to reclaim ownership of their online content or data. They will also discuss concrete and actionable strategies for implementing POSSE in one's own online presence (PERHAPS USING ELEVENTY?!?!?) and the potential impact it can have on the wider web
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 | yt:video:1vrPtBCLoro
97 | 1vrPtBCLoro
98 | UCskGTioqrMBcw8pd14_334A
99 | You're Probably Doing Web Performance Wrong — Sia Karamalegos (11ty Conf 2024)
100 |
101 |
102 | Eleventy
103 | https://www.youtube.com/channel/UCskGTioqrMBcw8pd14_334A
104 |
105 | 2024-05-17T18:27:10+00:00
106 | 2024-09-24T02:43:20+00:00
107 |
108 | You're Probably Doing Web Performance Wrong — Sia Karamalegos (11ty Conf 2024)
109 |
110 |
111 | This was a talk given at the 11ty International Symposium on Making Web Sites Real Good (2024): https://conf.11ty.dev/2024/you-re-probably-doing-web-performance-wrong/
112 |
113 | Lighthouse 100 is a common goal for developers seeking to make their sites fast, but does this really center user experience? In this talk, Sia will cover how to get a broader perspective on how real users are experiencing your website performance and better strategies for improving it.
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 | yt:video:VNIy2MaXFNM
122 | VNIy2MaXFNM
123 | UCskGTioqrMBcw8pd14_334A
124 | Building a Town That Doesn't Exist — Dan Sinker (11ty Conf 2024)
125 |
126 |
127 | Eleventy
128 | https://www.youtube.com/channel/UCskGTioqrMBcw8pd14_334A
129 |
130 | 2024-05-17T18:27:06+00:00
131 | 2024-08-06T15:00:32+00:00
132 |
133 | Building a Town That Doesn't Exist — Dan Sinker (11ty Conf 2024)
134 |
135 |
136 | This was a talk given at the 11ty International Symposium on Making Web Sites Real Good (2024): https://conf.11ty.dev/2024/building-a-town-that-doesnt-exist/
137 |
138 | The town of Question Mark, Ohio has a city hall, a newspaper, a library, a chicken joint, an ice cream store, a dump, a haunted factory, two cults, a sordid past, and a mysterious glowing void in the woods.
139 |
140 | None of it is real, of course, but all of it exists on the web, thanks to Eleventy, Tailwind CSS, and Alpine.js, the crucial building blocks for creating a year-long immersive novel told not in a book but across the entire internet. This talk looks under the hood at how one person built 40 websites to tell the story of Question Mark, Ohio, a town that disappears into time.
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 | yt:video:8Z8H2NEbLtE
149 | 8Z8H2NEbLtE
150 | UCskGTioqrMBcw8pd14_334A
151 | Don't Fear the Cascade — Mayank (11ty Conf 2024)
152 |
153 |
154 | Eleventy
155 | https://www.youtube.com/channel/UCskGTioqrMBcw8pd14_334A
156 |
157 | 2024-05-17T18:27:02+00:00
158 | 2024-08-24T14:18:56+00:00
159 |
160 | Don't Fear the Cascade — Mayank (11ty Conf 2024)
161 |
162 |
163 | This was a talk given at the 11ty International Symposium on Making Web Sites Real Good (2024): https://conf.11ty.dev/2024/dont-fear-the-cascade/
164 |
165 | In this talk, Mayank will teach the audience how to make sense of the cascade, clear up some common misconceptions (e.g. shadow DOM vs host context styles), and ultimately offer practical advice on how to make best use of the cascade.
166 |
167 | They will show off some newer game-changing CSS features (like :where, cascade layers, and @scope) that enable us to write styles with confidence and intention. They may also sprinkle in some tips on how these new features interact with current workflows, including frameworks, build tools, browser devtools, and IDEs.
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 | yt:video:kwHVpcwsJOE
176 | kwHVpcwsJOE
177 | UCskGTioqrMBcw8pd14_334A
178 | 11ty for “Non-Developers” — Adrianna Tan (11ty Conf 2024)
179 |
180 |
181 | Eleventy
182 | https://www.youtube.com/channel/UCskGTioqrMBcw8pd14_334A
183 |
184 | 2024-05-17T18:26:58+00:00
185 | 2024-08-06T20:21:33+00:00
186 |
187 | 11ty for “Non-Developers” — Adrianna Tan (11ty Conf 2024)
188 |
189 |
190 | This was a talk given at the 11ty International Symposium on Making Web Sites Real Good (2024): https://conf.11ty.dev/2024/11ty-sites-for-people-who-dont-think-they-are-web-developers/
191 |
192 | For a long time, we've thought of web development in two separate streams. WYSWYG builders for non-techical people, code for the rest. What if 'non-technical' isn't real, ‘web dev’ doesn't have to be just something you do for money, and building sites on the open web can be a fun hobby, especially with 11ty?
193 |
194 | In this talk, Adrianna will share how 11ty helped them finally break down the ’I’m not a web developer’ thoughts so they could build cool sites. Just like everyone can draw without being an artist, everyone can cook without being a chef.
195 |
196 | Adrianna will also share a framework they've developed for talking about and teaching 11ty to people who think they are not web developers, but who really have things to share on the web.
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 | yt:video:uIuf5LlA6KQ
205 | uIuf5LlA6KQ
206 | UCskGTioqrMBcw8pd14_334A
207 | Come to the light side: HTML Web Components — Chris Ferdinandi (11ty Conf 2024)
208 |
209 |
210 | Eleventy
211 | https://www.youtube.com/channel/UCskGTioqrMBcw8pd14_334A
212 |
213 | 2024-05-17T18:26:54+00:00
214 | 2024-09-25T04:58:00+00:00
215 |
216 | Come to the light side: HTML Web Components — Chris Ferdinandi (11ty Conf 2024)
217 |
218 |
219 | This was a talk given at the 11ty International Symposium on Making Web Sites Real Good (2024): https://conf.11ty.dev/2024/come-to-the-light-side-html-web-components/
220 |
221 | While Web Components have been around for years, they're seeing a bit of a renaissance thanks to an emerging approach for authoring them: ditch the shadow DOM and progressively enhance existing HTML.
222 |
223 | In this talk, we'll look at what Web Components, how the "HTML Web Component" approach works, why it's awesome, and some tips, tricks, and gotchas when working with them.
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 | yt:video:Pkg-Brizep8
232 | Pkg-Brizep8
233 | UCskGTioqrMBcw8pd14_334A
234 | Chinese Type Systems — ivan zhao (11ty Conf 2024)
235 |
236 |
237 | Eleventy
238 | https://www.youtube.com/channel/UCskGTioqrMBcw8pd14_334A
239 |
240 | 2024-05-17T18:26:50+00:00
241 | 2024-08-29T07:32:37+00:00
242 |
243 | Chinese Type Systems — ivan zhao (11ty Conf 2024)
244 |
245 |
246 | This was a talk given at the 11ty International Symposium on Making Web Sites Real Good (2024): https://conf.11ty.dev/2024/chinese-type-systems/
247 |
248 | In this talk, ivan will educate listeners about understanding Chinese type systems, pairing Chinese fonts, and why its so hard to put your Chinese font in the @font-face in CSS. Typesetting on the web with Chinese fonts is extremely difficult and ivan will give examples of pages that do this beautifully, and recommendations on how to find these.
249 |
250 | They will also talk about the history of the Chinese language, the differences in character based vs glyph based, and the difficulties of pairing the two types together. They’ll dive into the various classifications of systems that they use and talk about how to notice and pair Chinese fonts together, as well as actionably implementing them in CSS and the bundle size of the file.
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 | yt:video:iZ4XjLeaKH4
259 | iZ4XjLeaKH4
260 | UCskGTioqrMBcw8pd14_334A
261 | Light mode versus Dark mode, why not both? — Sara Joy (11ty Conf 2024)
262 |
263 |
264 | Eleventy
265 | https://www.youtube.com/channel/UCskGTioqrMBcw8pd14_334A
266 |
267 | 2024-05-17T18:26:47+00:00
268 | 2024-09-24T14:17:03+00:00
269 |
270 | Light mode versus Dark mode, why not both? — Sara Joy (11ty Conf 2024)
271 |
272 |
273 | This was a talk given at the 11ty International Symposium on Making Web Sites Real Good (2024): https://conf.11ty.dev/2024/light-mode-versus-dark-mode/
274 |
275 | It doesn’t have to be this way. Some people have very real physical reasons to need one mode over another. The rest of us are also allowed to have our favourites, or might prefer light mode in some situations and dark in others.
276 |
277 | What if Sara said it was super easy to code up both dark and light modes at the same time? Despite Sara’s evangelising efforts, not enough people know of the CSS property color-scheme and how powerful it is.
278 |
279 |
280 |
281 |
282 |
283 |
284 |
285 | yt:video:tXNsWsEE7S0
286 | tXNsWsEE7S0
287 | UCskGTioqrMBcw8pd14_334A
288 | The Future of 11ty — Zach Leatherman (11ty Conf 2024)
289 |
290 |
291 | Eleventy
292 | https://www.youtube.com/channel/UCskGTioqrMBcw8pd14_334A
293 |
294 | 2024-05-17T18:26:42+00:00
295 | 2024-09-24T15:54:12+00:00
296 |
297 | The Future of 11ty — Zach Leatherman (11ty Conf 2024)
298 |
299 |
300 | This was a talk given at the 11ty International Symposium on Making Web Sites Real Good (2024): https://conf.11ty.dev/2024/the-future-of-11ty/
301 |
302 | Learn more about CloudCannon and 11ty: https://cloudcannon.com/11tyconf/
303 |
304 | A talk about the current state of the 11ty project, new tricks and releases, and where we’re going next.
305 |
306 |
307 |
308 |
309 |
310 |
311 |
312 | yt:video:uaN9kY8lKPU
313 | uaN9kY8lKPU
314 | UCskGTioqrMBcw8pd14_334A
315 | Hints and Suggestions — Miriam Suzanne (11ty Conf 2024)
316 |
317 |
318 | Eleventy
319 | https://www.youtube.com/channel/UCskGTioqrMBcw8pd14_334A
320 |
321 | 2024-05-17T18:04:53+00:00
322 | 2024-08-29T14:28:06+00:00
323 |
324 | Hints and Suggestions — Miriam Suzanne (11ty Conf 2024)
325 |
326 |
327 | This was a talk given at the 11ty International Symposium on Making Web Sites Real Good (2024): https://conf.11ty.dev/2024/hints-and-suggestions-first-do-no-harm/
328 |
329 | The web is fundamentally different from other platforms, built around a radically political vision for resilience and user-control. CSS takes that to another level, attempting the almost absurd task of collaborative styling across devices and interfaces and languages. This is a quick dive into the origins of the web, and CSS in particular—the design constraints, and the range of strange proposals, and how we got where we are. By the end, we see the CSS is Awesome meme in a whole new light.
330 |
331 |
332 |
333 |
334 |
335 |
336 |
337 | yt:video:b-aQ7_yD44s
338 | b-aQ7_yD44s
339 | UCskGTioqrMBcw8pd14_334A
340 | Break Slideshow: Personal Sites Montage (11ty Conf 2024)
341 |
342 |
343 | Eleventy
344 | https://www.youtube.com/channel/UCskGTioqrMBcw8pd14_334A
345 |
346 | 2024-05-15T16:01:31+00:00
347 | 2024-08-26T19:42:34+00:00
348 |
349 | Break Slideshow: Personal Sites Montage (11ty Conf 2024)
350 |
351 |
352 | This slideshow appeared during the 11ty Conference (2024) during the breaks to highlight community personal sites. The sites were gathered from the 11ty Leaderboard https://www.11ty.dev/speedlify/ and our Authors pages https://www.11ty.dev/authors/
353 |
354 |
355 |
356 |
357 |
358 |
359 |
360 | yt:video:iLxJ6PtuF9M
361 | iLxJ6PtuF9M
362 | UCskGTioqrMBcw8pd14_334A
363 | The 11ty International Symposium on Making Web Sites Real Good (Live stream)
364 |
365 |
366 | Eleventy
367 | https://www.youtube.com/channel/UCskGTioqrMBcw8pd14_334A
368 |
369 | 2024-05-09T21:10:46+00:00
370 | 2024-08-24T19:51:44+00:00
371 |
372 | The 11ty International Symposium on Making Web Sites Real Good (Live stream)
373 |
374 |
375 | https://conf.11ty.dev/
376 |
377 | 00:00:00 Countdown
378 | 00:20:05 Kickoff!
379 | 00:35:56 Future of 11ty by Zach Leatherman
380 | 01:09:50 Hints & Suggestions (First, Do No Harm) by Miriam Suzanne
381 | 01:34:00 11ty and Large-Project Tooling by Paul Everitt
382 | 01:55:41 Break
383 | 02:22:22 Digital Frontiers, IndieWeb Cowboys, and A Place Online To Call Your Own by Henry Desroches
384 | 02:39:40 You're Probably Doing Web Performance Wrong by Sia Karamalegos
385 | 03:00:30 Building a Town That Doesn't Exist by Dan Sinker
386 | 03:14:43 Break
387 | 03:35:00 11ty Sites for People Who Don't Think they are Web Developers by Adrianna Tan
388 | 03:50:50 Don't Fear the Cascade by Mayank
389 | 04:16:50 Managing content management (with no vendor lock-in): Git CMS and static API generation, together at last! by Liam Bigelow and David Large
390 | 04:31:00 Break
391 | 04:50:35 Come to the light side: HTML Web Components by Chris Ferdinandi
392 | 05:15:55 Chinese Type Systems by Ivan Zhao
393 | 05:31:55 Light mode versus Dark mode by Sara Joy
394 | 05:54:59 Recap
395 |
396 |
397 |
398 |
399 |
400 |
401 |
402 | yt:video:nypsmn70ipI
403 | nypsmn70ipI
404 | UCskGTioqrMBcw8pd14_334A
405 | Big Announcement: Eleventy and @CloudCannon!
406 |
407 |
408 | Eleventy
409 | https://www.youtube.com/channel/UCskGTioqrMBcw8pd14_334A
410 |
411 | 2023-07-25T15:00:46+00:00
412 | 2024-08-24T07:51:29+00:00
413 |
414 | Big Announcement: Eleventy and @CloudCannon!
415 |
416 |
417 | https://cloudcannon.com/blog/cloudcannon-the-official-cms-partner-of-eleventy/
418 |
419 | and at https://www.11ty.dev/blog/cloudcannon/
420 |
421 |
422 |
423 |
424 |
425 |
426 |
427 |
--------------------------------------------------------------------------------
/test/test.js:
--------------------------------------------------------------------------------
1 | import "dotenv/config";
2 | import test from 'node:test';
3 | import assert from "node:assert/strict";
4 | import fs from "node:fs";
5 | import { createRequire } from "node:module";
6 |
7 | import { Importer } from "../src/Importer.js";
8 | import { DataSource } from "../src/DataSource.js";
9 | import { Persist } from "../src/Persist.js";
10 | import { Fetcher } from "../src/Fetcher.js";
11 |
12 | function cleanContent(content) {
13 | // trim extra whitespace (dirty workaround for trailing whitespace)
14 | return content.split("\n").map(line => line.trim()).join("\n");
15 | }
16 |
17 | const require = createRequire(import.meta.url);
18 |
19 | test("YouTube user", async (t) => {
20 | let importer = new Importer();
21 |
22 | importer.setVerbose(false);
23 | importer.setDryRun(true);
24 |
25 | importer.addSource("youtubeUser", "UCskGTioqrMBcw8pd14_334A");
26 |
27 | let stubContent = fs.readFileSync("./test/sources/youtube-user.xml");
28 | importer.addDataOverride("youtube", "https://www.youtube.com/feeds/videos.xml?channel_id=UCskGTioqrMBcw8pd14_334A", Fetcher.parseXml(stubContent.toString("utf8")));
29 |
30 | let entries = await importer.getEntries({ contentType: "markdown" });
31 | assert.equal(entries.length, 15);
32 |
33 | let [post] = entries;
34 |
35 | assert.deepEqual(Object.keys(post).sort(), ["authors", "content", "contentType", "date", "dateUpdated", "filePath", "title", "type", "url", "uuid"]);
36 | assert.equal(post.content.length, 812);
37 | assert.equal(post.content, `CloudCannon is the Recommended CMS Partner of 11ty:
38 |
39 | https://cloudcannon.com/11tyconf/
40 | https://cloudcannon.com/blog/how-to-manage-hundreds-of-connected-websites-with-a-git-based-headless-cms/
41 |
42 | This was a talk given at the 11ty International Symposium on Making Web Sites Real Good (2024): https://conf.11ty.dev/2024/managing-content-management/
43 |
44 | If Jamstack has taught us anything, it’s that websites work best when they’re generated from folders full of flat files. Even massively interconnected websites!
45 |
46 | We talk through a classically Jamstacky approach to content management for large organizations: mounting shared layout and component repositories, creating a central content lake to aggregate content like news articles, and automating site builds and deployments when your content or dependencies change.`);
47 |
48 | assert.equal(post.authors[0].name, "Eleventy");
49 | });
50 |
51 | test("Bluesky posts", async (t) => {
52 | let importer = new Importer();
53 |
54 | importer.setVerbose(false);
55 | importer.setDryRun(true);
56 |
57 | importer.addSource("bluesky", "zachleat.com");
58 |
59 | let stubContent = fs.readFileSync("./test/sources/bluesky-test.xml");
60 |
61 | importer.addDataOverride("bluesky", "https://bsky.app/profile/zachleat.com/rss", Fetcher.parseXml(stubContent.toString("utf8")));
62 |
63 | let entries = await importer.getEntries({ contentType: "markdown" });
64 | assert.equal(entries.length, 1);
65 |
66 | let [post] = entries;
67 |
68 | assert.deepEqual(Object.keys(post).sort(), ["authors", "content", "contentType", "date", "filePath", "title", "type", "url", "uuid"]);
69 | assert.equal(post.content.length, 323);
70 | assert.equal(post.content, `time to review my HTML wrapped 2024
71 |
72 | Most used: <a>
73 | Doing work to reduce infrastructure bills: <picture>
74 | Underrated: <output>
75 | Misunderstood: <details>
76 | Tame but a small win: <search>
77 | Hope the design never calls for it: <dialog>
78 | Not today Satan: <canvas>
79 | Pure vibes: <noscript>`);
80 |
81 | assert.equal(post.authors[0].name, "@zachleat.com - Zach Leatherman");
82 | });
83 |
84 | test("WordPress import", async (t) => {
85 |
86 | let importer = new Importer();
87 |
88 | importer.setVerbose(false);
89 | importer.setDryRun(true);
90 | importer.setAssetReferenceType("disabled");
91 |
92 | importer.addSource("wordpress", "https://blog.fontawesome.com/");
93 |
94 | if(process.env.WORDPRESS_USERNAME) {
95 | importer.addDataOverride("wordpress", "https://blog.fontawesome.com/wp-json/wp/v2/posts/?page=1&per_page=100&status=publish%2Cdraft", require("./sources/blog-awesome-posts.json"));
96 | importer.addDataOverride("wordpress", "https://blog.fontawesome.com/wp-json/wp/v2/posts/?page=2&per_page=100&status=publish%2Cdraft", []);
97 | } else {
98 | importer.addDataOverride("wordpress", "https://blog.fontawesome.com/wp-json/wp/v2/posts/?page=1&per_page=100", require("./sources/blog-awesome-posts.json"));
99 | importer.addDataOverride("wordpress", "https://blog.fontawesome.com/wp-json/wp/v2/posts/?page=2&per_page=100", []);
100 | }
101 |
102 | importer.addDataOverride("wordpress", "https://blog.fontawesome.com/wp-json/wp/v2/categories/1", require("./sources/blog-awesome-categories.json"));
103 | importer.addDataOverride("wordpress", "https://blog.fontawesome.com/wp-json/wp/v2/users/155431370", require("./sources/blog-awesome-author.json"));
104 |
105 | importer.addPreserved(".c-button--primary");
106 |
107 | let entries = await importer.getEntries({ contentType: "markdown" });
108 | assert.equal(entries.length, 1);
109 |
110 | let [post] = entries;
111 | assert.deepEqual(Object.keys(post).sort(), ["authors", "content", "contentType", "date", "dateUpdated", "filePath", "metadata", "status", "title", "type", "url", "uuid"]);
112 |
113 | assert.equal(cleanContent(post.content), `We’re so close to launching version 6, and we figured it was high time to make an official announcement. So, save the date for February. Font Awesome 6 will go beyond pure icon-imagination!
114 |
115 | 
116 |
117 | Save the date! February 2022 is just around the corner!
118 |
119 | So, what’s new?
120 |
121 | * * *
122 |
123 | ## More Icons
124 |
125 | Font Awesome 6 contains over 7,000 new icons, so you’re sure to find what you need for your project. Plus, we’ve redesigned most of our icons from scratch, so they’re more consistent and easier to use.
126 |
127 | 
128 |
129 | * * *
130 |
131 | ## More Styles
132 |
133 | Font Awesome 6 includes five icons styles: solid, regular, light, duotone, and the new THIN style — not to mention all of our brand icons. And coming later in 2022 is the entirely new SHARP family of styles.
134 |
135 | 
136 |
137 | * * *
138 |
139 | ## More Ways to Use
140 |
141 | Font Awesome 6 makes it even easier to use icons where you want to. More plugins and packages to match your stack. Less time wrestling browser rendering.
142 |
143 | 
144 |
145 | * * *
146 |
147 | We’ll keep fine-tuning that sweet, sweet recipe until February. Believe us; the web’s going to have a new scrumpdillyicious secret ingredient!
148 |
149 | Check Out the Beta! `);
150 |
151 | assert.equal(post.content.length, 1634);
152 | assert.equal(post.authors[0].name, "Matt Johnson");
153 | });
154 |
155 | test("addSource using DataSource", async (t) => {
156 | let importer = new Importer();
157 |
158 | importer.setVerbose(false);
159 | importer.setDryRun(true);
160 |
161 | class MySource extends DataSource {
162 | static TYPE = "arbitrary";
163 | static TYPE_FRIENDLY = "Arbitrary";
164 |
165 | getData() {
166 | return [{
167 | lol: "hi",
168 | url: "https://example.com/test/"
169 | }];
170 | }
171 | }
172 |
173 | importer.addSource(MySource);
174 |
175 | let entries = await importer.getEntries();
176 | assert.equal(entries.length, 1);
177 | });
178 |
179 | test("addSource needs to use DataSource", async (t) => {
180 | let importer = new Importer();
181 |
182 | importer.setVerbose(false);
183 | importer.setDryRun(true);
184 |
185 | assert.throws(() => {
186 | importer.addSource(class MySource {});
187 | }, {
188 | message: "MySource is not a supported type for addSource(). Requires a string type or a DataSource class."
189 | })
190 | });
191 |
192 | test("Persist parseTarget", async (t) => {
193 | assert.deepEqual(Persist.parseTarget("github:11ty/eleventy"), {
194 | type: "github",
195 | username: "11ty",
196 | repository: "eleventy",
197 | branch: undefined,
198 | });
199 |
200 | assert.deepEqual(Persist.parseTarget("github:11ty/eleventy#main"), {
201 | type: "github",
202 | username: "11ty",
203 | repository: "eleventy",
204 | branch: "main",
205 | });
206 | });
207 |
208 | test("Persist constructor (no token)", async (t) => {
209 | let p = new Persist();
210 |
211 | assert.throws(() => p.setTarget("gitlab:11ty/eleventy"), {
212 | // message: "Invalid persist type: gitlab"
213 | message: "Missing GITHUB_TOKEN environment variable."
214 | });
215 | });
216 |
217 | test("Persist constructor (gitlab)", async (t) => {
218 | let p = new Persist();
219 | process.env.GITHUB_TOKEN = "FAKE_TOKEN";
220 |
221 | assert.throws(() => p.setTarget("gitlab:11ty/eleventy"), {
222 | message: "Invalid persist type: gitlab"
223 | });
224 | });
225 |
226 | test("Fetcher asset location tests (relative)", async (t) => {
227 | let f = new Fetcher();
228 |
229 | let relative1 = f.getAssetLocation("https://example.com/test.png", "image/png", { filePath: "/test.html" });
230 | assert.deepEqual(relative1, {
231 | filePath: "assets/test-NzhbK6MSYu2g.png",
232 | url: "assets/test-NzhbK6MSYu2g.png",
233 | });
234 |
235 | let relativeNoExt = f.getAssetLocation("https://example.com/test", "image/png", { filePath: "/test.html" });
236 | assert.deepEqual(relativeNoExt, {
237 | filePath: "assets/test-m4HI5oTdgEt4.png",
238 | url: "assets/test-m4HI5oTdgEt4.png",
239 | });
240 |
241 | let relative2 = f.getAssetLocation("https://example.com/subdir/test.png", "image/png", { filePath: "localsubdirectory/test.html" });
242 | assert.deepEqual(relative2, {
243 | filePath: "localsubdirectory/assets/test-slaK8pecO8QR.png",
244 | url: "assets/test-slaK8pecO8QR.png",
245 | });
246 | });
247 |
248 | test("Fetcher asset location tests (absolute)", async (t) => {
249 | let f = new Fetcher();
250 | f.setUseRelativeAssetPaths(false);
251 |
252 | let abs1 = f.getAssetLocation("https://example.com/test.png", "image/png");
253 | assert.deepEqual(abs1, {
254 | filePath: "assets/test-NzhbK6MSYu2g.png",
255 | url: "/assets/test-NzhbK6MSYu2g.png",
256 | });
257 | });
258 |
259 |
260 | test("Markdown cleanup code blocks strip tags", async (t) => {
261 | let importer = new Importer();
262 |
263 | importer.setVerbose(false);
264 | importer.setDryRun(true);
265 |
266 | let content = await importer.getTransformedContent({
267 | content: `$ npm config set “@fortawesome :registry” https://npm.fontawesome.com/ `,
268 | contentType: "html"
269 | }, true);
270 |
271 | assert.equal(content.trim(), "```\n$ npm config set “@fortawesome:registry” https://npm.fontawesome.com/\n```");
272 | });
273 |
274 | test("Markdown cleanup code blocks with nested ", async (t) => {
275 | let importer = new Importer();
276 |
277 | importer.setVerbose(false);
278 | importer.setDryRun(true);
279 |
280 | let content2 = await importer.getTransformedContent({
281 | content: `Authorization: Bearer DEAD-BEEF
`,
282 | contentType: "html"
283 | }, true);
284 |
285 | assert.equal(content2.trim(), "```\nAuthorization: Bearer DEAD-BEEF\n```");
286 | });
287 |
288 | test("within yes", async (t) => {
289 | let importer = new Importer();
290 |
291 | importer.setVerbose(false);
292 | importer.setDryRun(true);
293 |
294 | class MySource extends DataSource {
295 | static TYPE = "arbitrary";
296 | static TYPE_FRIENDLY = "Arbitrary";
297 |
298 | getRawEntryDates(rawEntry) {
299 | return {
300 | created: rawEntry.date,
301 | }
302 | }
303 |
304 | getData() {
305 | return [{
306 | lol: "hi",
307 | url: "https://example.com/test/",
308 | date: new Date(),
309 | }];
310 | }
311 | }
312 |
313 | importer.addSource(MySource);
314 |
315 | let entries = await importer.getEntries({
316 | within: "1m"
317 | });
318 | assert.equal(entries.length, 1);
319 | });
320 |
321 | test("within no", async (t) => {
322 | let importer = new Importer();
323 |
324 | importer.setVerbose(false);
325 | importer.setDryRun(true);
326 |
327 | class MySource extends DataSource {
328 | static TYPE = "arbitrary";
329 | static TYPE_FRIENDLY = "Arbitrary";
330 |
331 | getRawEntryDates(rawEntry) {
332 | return {
333 | created: rawEntry.date,
334 | }
335 | }
336 |
337 | getData() {
338 | return [{
339 | lol: "hi",
340 | url: "https://example.com/test/",
341 | date: new Date(2010, 0,1),
342 | }];
343 | }
344 | }
345 |
346 | importer.addSource(MySource);
347 |
348 | let entries = await importer.getEntries({
349 | within: "1m"
350 | });
351 | assert.equal(entries.length, 0);
352 | });
353 |
--------------------------------------------------------------------------------