From 42441dbd2828e3109eee5c7c07f9a8427a86ae4a Mon Sep 17 00:00:00 2001 From: Sivin Varghese <64252451+iamsivin@users.noreply.github.com> Date: Mon, 30 Mar 2026 14:19:02 +0530 Subject: [PATCH] feat: add GuideJar embed support in HC (#13944) --- config/markdown_embeds.yml | 12 +++++++++++ spec/config/markdown_embeds_spec.rb | 8 ++++++- spec/lib/custom_markdown_renderer_spec.rb | 26 +++++++++++++++++++++++ 3 files changed, 45 insertions(+), 1 deletion(-) diff --git a/config/markdown_embeds.yml b/config/markdown_embeds.yml index b826931ec..cc5b997d6 100644 --- a/config/markdown_embeds.yml +++ b/config/markdown_embeds.yml @@ -134,6 +134,18 @@ codepen: +guidejar: + regex: 'https?://(?:www\.)?guidejar\.com/(?:embed|guides)/(?[^&/?]+)' + template: | +
+ +
+ github_gist: regex: 'https?://gist\.github\.com/(?[^/]+)/(?[a-f0-9]+)' template: | diff --git a/spec/config/markdown_embeds_spec.rb b/spec/config/markdown_embeds_spec.rb index f609ac113..e9938aea0 100644 --- a/spec/config/markdown_embeds_spec.rb +++ b/spec/config/markdown_embeds_spec.rb @@ -21,7 +21,7 @@ describe 'Markdown Embeds Configuration' do end it 'contains expected embed types' do - expected_types = %w[youtube loom vimeo mp4 arcade_tab arcade wistia bunny codepen github_gist] + expected_types = %w[youtube loom vimeo mp4 arcade_tab arcade wistia bunny codepen guidejar github_gist] expect(config.keys).to match_array(expected_types) end end @@ -73,6 +73,12 @@ describe 'Markdown Embeds Configuration' do { url: 'https://codepen.io/username/pen/abcdef', expected: { 'user' => 'username', 'pen_id' => 'abcdef' } }, { url: 'https://www.codepen.io/testuser/pen/xyz123', expected: { 'user' => 'testuser', 'pen_id' => 'xyz123' } } ], + 'guidejar' => [ + { url: 'https://www.guidejar.com/embed/i2qMQRp26rtRxpZczmaA', expected: { 'guide_id' => 'i2qMQRp26rtRxpZczmaA' } }, + { url: 'https://guidejar.com/guides/i2qMQRp26rtRxpZczmaA', expected: { 'guide_id' => 'i2qMQRp26rtRxpZczmaA' } }, + { url: 'https://guidejar.com/guides/d6a6fdc2-4812-4777-897e-ec1b0c64238f', + expected: { 'guide_id' => 'd6a6fdc2-4812-4777-897e-ec1b0c64238f' } } + ], 'github_gist' => [ { url: 'https://gist.github.com/username/1234567890abcdef1234567890abcdef', expected: { 'username' => 'username', 'gist_id' => '1234567890abcdef1234567890abcdef' } }, diff --git a/spec/lib/custom_markdown_renderer_spec.rb b/spec/lib/custom_markdown_renderer_spec.rb index 1237eae2c..3415a811d 100644 --- a/spec/lib/custom_markdown_renderer_spec.rb +++ b/spec/lib/custom_markdown_renderer_spec.rb @@ -184,6 +184,32 @@ describe CustomMarkdownRenderer do end end + context 'when link is a GuideJar embed URL' do + let(:guidejar_url) { 'https://www.guidejar.com/embed/i2qMQRp26rtRxpZczmaA' } + + it 'renders an iframe with GuideJar embed code' do + output = render_markdown_link(guidejar_url) + expect(output).to include('src="https://www.guidejar.com/embed/i2qMQRp26rtRxpZczmaA?type=1&controls=on"') + expect(output).to include('allowfullscreen') + end + end + + context 'when link is a GuideJar guides URL' do + let(:guidejar_url) { 'https://guidejar.com/guides/d6a6fdc2-4812-4777-897e-ec1b0c64238f' } + + it 'renders an iframe with GuideJar embed code' do + output = render_markdown_link(guidejar_url) + expect(output).to include('src="https://www.guidejar.com/embed/d6a6fdc2-4812-4777-897e-ec1b0c64238f?type=1&controls=on"') + expect(output).to include('allowfullscreen') + end + + it 'wraps iframe in responsive container' do + output = render_markdown_link(guidejar_url) + expect(output).to include('position: relative; padding-bottom: 62.5%; height: 0;') + expect(output).to include('position: absolute; top: 0; left: 0; width: 100%; height: 100%;') + end + end + context 'when link is a Bunny.net iframe URL' do let(:bunny_url) { 'https://iframe.mediadelivery.net/play/431789/1f105841-cad9-46fe-a70e-b7623c60797c' }