Skip to content

Commit

Permalink
fix: allow twitter:card
Browse files Browse the repository at this point in the history
  • Loading branch information
maxakuru committed Oct 10, 2024
1 parent 2fdcca7 commit 3efd0d1
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 54 deletions.
1 change: 1 addition & 0 deletions src/html2md.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ function isAllowedMetaName(name) {
}
return !HELIX_META[name] && (
!name.startsWith('twitter:')
|| name === 'twitter:card'
|| name.startsWith('twitter:label')
|| name.startsWith('twitter:data')
);
Expand Down
26 changes: 14 additions & 12 deletions test/fixtures/blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,17 +155,19 @@ Helix lets frontend devs develop and deploy the design and functionality of thei
| Style | highlight |
+---------+-----------+

+----------------------------------------------------------------------+
| Metadata |
+-------------+--------------------------------------------------------+
| title | Project Helix by Adobe |
+-------------+--------------------------------------------------------+
| description | Frictionless experience management: Build blazing fast |
| | websites using tools content creators and developers |
| | already know. |
+-------------+--------------------------------------------------------+
| robots | noindex, nofollow |
+-------------+--------------------------------------------------------+
+-----------------------------------------------------------------------+
| Metadata |
+--------------+--------------------------------------------------------+
| title | Project Helix by Adobe |
+--------------+--------------------------------------------------------+
| description | Frictionless experience management: Build blazing fast |
| | websites using tools content creators and developers |
| | already know. |
+--------------+--------------------------------------------------------+
| twitter:card | summary\_large\_image |
+--------------+--------------------------------------------------------+
| robots | noindex, nofollow |
+--------------+--------------------------------------------------------+

[image0]: ./media_11150c400cabf67c6baeb1d92d2adf99ab8941fb7.png?width=750&format=png&optimize=medium

Expand All @@ -181,4 +183,4 @@ Helix lets frontend devs develop and deploy the design and functionality of thei

[image6]: ./media_1b8ff9e1931834386254be2c49c4424210fb0988c.png?width=750&format=png&optimize=medium

[image7]: ./media_1b5d4ed769249aadccd584894ceff3b1b0439747e.png?width=750&format=png&optimize=medium
[image7]: ./media_1b5d4ed769249aadccd584894ceff3b1b0439747e.png?width=750&format=png&optimize=medium
30 changes: 16 additions & 14 deletions test/fixtures/default-content.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,19 +147,21 @@ Once you are are ready to push your changes, simply git add, commit and push and

**That’s it, you made it! Congrats, your first Helix site is up and running.**

+----------------------------------------------------------------------+
| Metadata |
+-------------+--------------------------------------------------------+
| title | Getting started with Helix - Developer Tutorial |
+-------------+--------------------------------------------------------+
| description | This tutorial should have you up and running with your |
| | AEM Helix projects in 10 - 20 minutes to a place where |
| | you can create, ... |
+-------------+--------------------------------------------------------+
| template | docs |
+-------------+--------------------------------------------------------+
| robots | noindex, nofollow |
+-------------+--------------------------------------------------------+
+-----------------------------------------------------------------------+
| Metadata |
+--------------+--------------------------------------------------------+
| title | Getting started with Helix - Developer Tutorial |
+--------------+--------------------------------------------------------+
| description | This tutorial should have you up and running with your |
| | AEM Helix projects in 10 - 20 minutes to a place where |
| | you can create, ... |
+--------------+--------------------------------------------------------+
| twitter:card | summary\_large\_image |
+--------------+--------------------------------------------------------+
| template | docs |
+--------------+--------------------------------------------------------+
| robots | noindex, nofollow |
+--------------+--------------------------------------------------------+

[image0]: ./media_165bab297e15a33f4742a4f20d8e0a3c3ba42511a.png?width=750&format=png&optimize=medium

Expand Down Expand Up @@ -191,4 +193,4 @@ Once you are are ready to push your changes, simply git add, commit and push and

[image14]: ./media_1eba5dc6a44e0bb0b869153ad2b79b1904d5bdc07.png?width=750&format=png&optimize=medium

[image15]: ./media_172de918ec54e4a5f2267f64f63218b1ef0bf066b.png?width=750&format=png&optimize=medium
[image15]: ./media_172de918ec54e4a5f2267f64f63218b1ef0bf066b.png?width=750&format=png&optimize=medium
1 change: 1 addition & 0 deletions test/fixtures/meta-tags.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<meta property="product:price.currency" content="USD">
<meta property="invalid" content="foo">
<meta property="og:ignored" content="bar">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:label1" content="Price">
<meta name="twitter:data1" content="$3">
<meta name="twitter:label2" content="Availability">
Expand Down
40 changes: 21 additions & 19 deletions test/fixtures/meta-tags.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
# Hello, World.

+---------------------------------------+
| Metadata |
+------------------------+--------------+
| og:type | product |
+------------------------+--------------+
| product:availability | In stock |
+------------------------+--------------+
| product:price.amount | 3 |
+------------------------+--------------+
| product:price.currency | USD |
+------------------------+--------------+
| twitter:label1 | Price |
+------------------------+--------------+
| twitter:data1 | $3 |
+------------------------+--------------+
| twitter:label2 | Availability |
+------------------------+--------------+
| twitter:data2 | In stock |
+------------------------+--------------+
+------------------------------------------------+
| Metadata |
+------------------------+-----------------------+
| og:type | product |
+------------------------+-----------------------+
| product:availability | In stock |
+------------------------+-----------------------+
| product:price.amount | 3 |
+------------------------+-----------------------+
| product:price.currency | USD |
+------------------------+-----------------------+
| twitter:card | summary\_large\_image |
+------------------------+-----------------------+
| twitter:label1 | Price |
+------------------------+-----------------------+
| twitter:data1 | $3 |
+------------------------+-----------------------+
| twitter:label2 | Availability |
+------------------------+-----------------------+
| twitter:data2 | In stock |
+------------------------+-----------------------+
20 changes: 11 additions & 9 deletions test/fixtures/multiple-sections.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,16 @@ Find some of our favorite staff picks below:
| Style | highlight |
+---------+-----------+

+----------------------------------------------------------------------+
| Metadata |
+-------------+--------------------------------------------------------+
| title | Home \| Helix Project Boilerplate |
+-------------+--------------------------------------------------------+
| description | Use this template repository as the starting point for |
| | new Helix projects. |
+-------------+--------------------------------------------------------+
+-----------------------------------------------------------------------+
| Metadata |
+--------------+--------------------------------------------------------+
| title | Home \| Helix Project Boilerplate |
+--------------+--------------------------------------------------------+
| description | Use this template repository as the starting point for |
| | new Helix projects. |
+--------------+--------------------------------------------------------+
| twitter:card | summary\_large\_image |
+--------------+--------------------------------------------------------+

[image0]: ./media_12637fbb67cddc5d293b20975e89028d919270ac0.jpeg?width=750&format=jpeg&optimize=medium

Expand All @@ -109,4 +111,4 @@ Find some of our favorite staff picks below:

[image8]: ./media_1362767d232221ff20c67bc0694a8924d483687b1.jpeg?width=750&format=jpeg&optimize=medium

[image9]: ./media_1a620138deb385f05412f4f96f9b18e454a769c76.jpeg?width=750&format=jpeg&optimize=medium
[image9]: ./media_1a620138deb385f05412f4f96f9b18e454a769c76.jpeg?width=750&format=jpeg&optimize=medium

0 comments on commit 3efd0d1

Please sign in to comment.