Skip to content

Commit f4e6d72

Browse files
committed
Github gist does not block rendering now
1 parent 5a906ad commit f4e6d72

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

.github/workflows/static.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ jobs:
108108
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
109109
DATABASE_URL: ${{ secrets.DATABASE_URL }}
110110
SYSLOG_ADDRESS: ${{ secrets.SYSLOG_ADDRESS }}
111-
if: ${{ endswith(github.run_id, '3') || endswith(github.run_id, '6') || endswith(github.run_id, '9') }}
111+
if: ${{ github.event_name == 'push' || endswith(github.run_id, '3') || endswith(github.run_id, '6') || endswith(github.run_id, '9') }}
112112

113113
- name: Generate Home Page
114114
run: make gh_home_page

page_content_extractor/embeddable.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -116,4 +116,6 @@ def gist_github_com_parser(self, url):
116116
path = urlsplit(url).path
117117
if path.count('/') < 2:
118118
raise ParseError('Invalid gist.github.com embeddable url(%s)' % url)
119-
return '<script src="https://gist.github.com%s.js"></script>' % path
119+
# See https://milanaryal.com.np/how-to-embed-github-gists-in-an-iframe-tag/
120+
return f'<iframe src="https://gist.github.com{path}.pibb" style="width: 100%; height: 250px; border: 0;"></iframe>'
121+
# return '<script src="https://gist.github.com%s.js"></script>' % path

test/test_embeddable_parser.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,5 @@ def test_pdf_yt_parser(self):
6969
def test_gist_github_com(self):
7070
parser = EmbeddableExtractor('<html></html>', 'https://gist.github.com/polyrabbit/5693787')
7171
self.assertEqual(parser.get_content(),
72-
'<script src="https://gist.github.com/polyrabbit/5693787.js"></script>')
72+
'<iframe src="https://gist.github.com/polyrabbit/5693787.pibb" style="width: 100%; height: 250px; border: 0;"></iframe>')
7373
self.assertRaises(ParseError, EmbeddableExtractor, 'whatever', 'https://gist.github.com/')

0 commit comments

Comments
 (0)