Skip to content

Commit 1ac1d6d

Browse files
authored
fix: embed wrapper (#231)
1 parent 48eb5d8 commit 1ac1d6d

File tree

24 files changed

+47
-24
lines changed

24 files changed

+47
-24
lines changed

config/services.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ services:
117117

118118
Spatie\CommonMarkHighlighter\FencedCodeRenderer: ~
119119
Spatie\CommonMarkHighlighter\IndentedCodeRenderer: ~
120+
League\CommonMark\Extension\Embed\EmbedRenderer: ~
120121

121122
League\CommonMark\Environment\Environment:
122123
arguments:
@@ -135,6 +136,14 @@ services:
135136
- addExtension: [ '@JSW\Figure\FigureExtension' ]
136137
- addRenderer: [ League\CommonMark\Extension\CommonMark\Node\Block\FencedCode, '@Spatie\CommonMarkHighlighter\FencedCodeRenderer', 10 ]
137138
- addRenderer: [ League\CommonMark\Extension\CommonMark\Node\Block\IndentedCode, '@Spatie\CommonMarkHighlighter\IndentedCodeRenderer', 10 ]
139+
- addRenderer:
140+
- League\CommonMark\Extension\Embed\Embed
141+
- !service
142+
class: League\CommonMark\Renderer\HtmlDecorator
143+
arguments:
144+
- '@League\CommonMark\Extension\Embed\EmbedRenderer'
145+
- 'div'
146+
- class: "embedded-content"
138147
League\CommonMark\Environment\EnvironmentInterface: '@League\CommonMark\Environment\Environment'
139148

140149
League\CommonMark\MarkdownConverter: ~
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
11
body {
22
background-color: #eee;
33
}
4+
5+
.embedded-content {
6+
aspect-ratio: 16 / 9;
7+
width: 100%;
8+
max-width: 100%;
9+
position: relative;
10+
}
11+
12+
.embedded-content iframe {
13+
width: 100%;
14+
height: 100%;
15+
border: 0;
16+
display: block;
17+
}

tests/functional/site/fixtures/assets/app.1f8584ad.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/functional/site/fixtures/assets/app.d4da4e7e.css

Lines changed: 0 additions & 1 deletion
This file was deleted.

tests/functional/site/fixtures/assets/entrypoints.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
"/sub/dir/another/assets/app.9267444a.js"
77
],
88
"css": [
9-
"/sub/dir/another/assets/app.d4da4e7e.css"
9+
"/sub/dir/another/assets/app.1f8584ad.css"
1010
]
1111
}
1212
},
1313
"integrity": {
1414
"/sub/dir/another/assets/runtime.4d1205b9.js": "sha384-J2jFm3DPgrcqyvls0fZlS51nUYgiBB+JLwWiU5v7vxEbLwKolmaHrRuz4BjP6qaE",
1515
"/sub/dir/another/assets/app.9267444a.js": "sha384-WbAUi92ziCGFD1kGZRzpOP8Nxymnw5vXM3szOB1JmBrCU+MVGXBRReCttizXHDdI",
16-
"/sub/dir/another/assets/app.d4da4e7e.css": "sha384-t9qUhz8OfBEKvYdnnNndPZAf+S5Q3p0dBnxLn+5SShoNhInHUF+Bu8WJTo+FQJYJ"
16+
"/sub/dir/another/assets/app.1f8584ad.css": "sha384-3NHt86+2NcsnDmkRSTRUVveqFlyObtNR/TvbopmMrXQ6jOZEChrYwg7DsIhL0q+J"
1717
}
1818
}

tests/functional/site/fixtures/assets/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"assets/app.css": "/sub/dir/another/assets/app.d4da4e7e.css",
2+
"assets/app.css": "/sub/dir/another/assets/app.1f8584ad.css",
33
"assets/app.js": "/sub/dir/another/assets/app.9267444a.js",
44
"assets/runtime.js": "/sub/dir/another/assets/runtime.4d1205b9.js",
55
"assets/images/sigwin.svg": "/sub/dir/another/assets/images/sigwin.6f9a3d5b.svg"

tests/functional/site/fixtures/de/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<title>Homepage</title>
99

10-
<link rel="stylesheet" href="/sub/dir/another/assets/app.d4da4e7e.css" integrity="sha384-t9qUhz8OfBEKvYdnnNndPZAf+S5Q3p0dBnxLn+5SShoNhInHUF+Bu8WJTo+FQJYJ">
10+
<link rel="stylesheet" href="/sub/dir/another/assets/app.1f8584ad.css" integrity="sha384-3NHt86+2NcsnDmkRSTRUVveqFlyObtNR/TvbopmMrXQ6jOZEChrYwg7DsIhL0q+J">
1111
</head>
1212
<body>
1313

tests/functional/site/fixtures/en/article/embeds/index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<title>Embeds</title>
99

10-
<link rel="stylesheet" href="/sub/dir/another/assets/app.d4da4e7e.css" integrity="sha384-t9qUhz8OfBEKvYdnnNndPZAf+S5Q3p0dBnxLn+5SShoNhInHUF+Bu8WJTo+FQJYJ">
10+
<link rel="stylesheet" href="/sub/dir/another/assets/app.1f8584ad.css" integrity="sha384-3NHt86+2NcsnDmkRSTRUVveqFlyObtNR/TvbopmMrXQ6jOZEChrYwg7DsIhL0q+J">
1111
</head>
1212
<body>
1313

@@ -16,8 +16,8 @@
1616
<div class="bg-white py-8 px-4 shadow sm:rounded-lg sm:px-10 prose">
1717
<h1>Embeds</h1>
1818
<p>01.10.2023. 00:00</p>
19-
<iframe width="800" height="450" src="https://www.youtube.com/embed/oGcLClv_IFU?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen title="Your code coverage is LYING!"></iframe>
20-
<blockquote class="twitter-tweet" data-width="550"><p lang="en" dir="ltr">Using the code coverage percentage as a measure of quality of your codebase is a bad idea, here&#39;s what to do instead: <a href="https://twitter.com/hashtag/quality?src=hash&amp;ref_src=twsrc%5Etfw">#quality</a> <a href="https://twitter.com/hashtag/SoftwareEngineering?src=hash&amp;ref_src=twsrc%5Etfw">#SoftwareEngineering</a> <a href="https://twitter.com/hashtag/testing?src=hash&amp;ref_src=twsrc%5Etfw">#testing</a> <a href="https://t.co/94vpY6F4mC">https://t.co/94vpY6F4mC</a></p>&mdash; Dalibor Karlović (@dkarlovi) <a href="https://twitter.com/dkarlovi/status/1784950485595623522?ref_src=twsrc%5Etfw">April 29, 2024</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
19+
<div class="embedded-content"><iframe width="800" height="450" src="https://www.youtube.com/embed/oGcLClv_IFU?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen title="Your code coverage is LYING!"></iframe></div>
20+
<div class="embedded-content"><blockquote class="twitter-tweet" data-width="550"><p lang="en" dir="ltr">Using the code coverage percentage as a measure of quality of your codebase is a bad idea, here&#39;s what to do instead: <a href="https://twitter.com/hashtag/quality?src=hash&amp;ref_src=twsrc%5Etfw">#quality</a> <a href="https://twitter.com/hashtag/SoftwareEngineering?src=hash&amp;ref_src=twsrc%5Etfw">#SoftwareEngineering</a> <a href="https://twitter.com/hashtag/testing?src=hash&amp;ref_src=twsrc%5Etfw">#testing</a> <a href="https://t.co/94vpY6F4mC">https://t.co/94vpY6F4mC</a></p>&mdash; Dalibor Karlović (@dkarlovi) <a href="https://twitter.com/dkarlovi/status/1784950485595623522?ref_src=twsrc%5Etfw">April 29, 2024</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script></div>
2121
<p><a href="https://github.com/sigwinhq/yassg">https://github.com/sigwinhq/yassg</a></p>
2222

2323
</div>

tests/functional/site/fixtures/en/article/hello-world/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<title>Hello World!</title>
99

10-
<link rel="stylesheet" href="/sub/dir/another/assets/app.d4da4e7e.css" integrity="sha384-t9qUhz8OfBEKvYdnnNndPZAf+S5Q3p0dBnxLn+5SShoNhInHUF+Bu8WJTo+FQJYJ">
10+
<link rel="stylesheet" href="/sub/dir/another/assets/app.1f8584ad.css" integrity="sha384-3NHt86+2NcsnDmkRSTRUVveqFlyObtNR/TvbopmMrXQ6jOZEChrYwg7DsIhL0q+J">
1111
</head>
1212
<body>
1313

tests/functional/site/fixtures/en/article/images/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<title>Images!</title>
99

10-
<link rel="stylesheet" href="/sub/dir/another/assets/app.d4da4e7e.css" integrity="sha384-t9qUhz8OfBEKvYdnnNndPZAf+S5Q3p0dBnxLn+5SShoNhInHUF+Bu8WJTo+FQJYJ">
10+
<link rel="stylesheet" href="/sub/dir/another/assets/app.1f8584ad.css" integrity="sha384-3NHt86+2NcsnDmkRSTRUVveqFlyObtNR/TvbopmMrXQ6jOZEChrYwg7DsIhL0q+J">
1111
</head>
1212
<body>
1313

0 commit comments

Comments
 (0)