Skip to content

Commit

Permalink
fix: responsive youtube embed (closes jackyzha0#1167)
Browse files Browse the repository at this point in the history
  • Loading branch information
jackyzha0 committed Aug 6, 2024
1 parent 6c4ed24 commit ca3943b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 2 additions & 4 deletions quartz/plugins/transformers/ofm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -616,11 +616,10 @@ export const ObsidianFlavoredMarkdown: QuartzTransformerPlugin<Partial<Options>
// YouTube video (with optional playlist)
node.tagName = "iframe"
node.properties = {
class: "external-embed",
class: "external-embed youtube",
allow: "fullscreen",
frameborder: 0,
width: "600px",
height: "350px",
src: playlistId
? `https://www.youtube.com/embed/${videoId}?list=${playlistId}`
: `https://www.youtube.com/embed/${videoId}`,
Expand All @@ -629,11 +628,10 @@ export const ObsidianFlavoredMarkdown: QuartzTransformerPlugin<Partial<Options>
// YouTube playlist only.
node.tagName = "iframe"
node.properties = {
class: "external-embed",
class: "external-embed youtube",
allow: "fullscreen",
frameborder: 0,
width: "600px",
height: "350px",
src: `https://www.youtube.com/embed/videoseries?list=${playlistId}`,
}
}
Expand Down
7 changes: 7 additions & 0 deletions quartz/styles/base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -541,3 +541,10 @@ ol.overflow {
overflow-x: auto;
overflow-y: hidden;
}

.external-embed.youtube {
aspect-ratio: 16 / 9;
height: 100%;
width: 100%;
border-radius: 5px;
}

0 comments on commit ca3943b

Please sign in to comment.