Jupyter ์ ๋ด๋ถ์์ ์ง์ ์บ์คํธ๋ฅผ ์ฌ์ํ๋ ๋ฐ ์ผ๋ง๋ ๋ง์ ๋ ธ๋ ฅ์ด ํ์ํ ์ง ๊ถ๊ธํฉ๋๋ค. ์ด๊ฒ์ ์์ HTML ๋ดํฌ์ ํ ์คํธ ์ถ๋ ฅ์ ๋ํํด์ผ _ํ ์๋_ ์์ง๋ง, ์ด์ฉ๋ฉด ๊ทธ๊ฒ ํ์ํ์ง ์์ ์๋ ์์ต๋๋ค.
๋๋ ์๋ asciinema-player์ ๋ํ ๋ฌธ์ ๋ฅผ ์ฌ๊ธฐ์์ ์ ๊ธฐํ์ต๋๋ค: https://github.com/asciinema/asciinema-player/issues/85 ํ์ง๋ง ์ ์ฒด ์์ด ์บ์คํธ๋ฅผ ์ง์ ๋ณด์ฌ์ค ์ ์๋ค๋ฉด ์ฌ๊ธฐ๋ ์ข์ ๊ณณ์ผ ๊ฒ์ ๋๋ค. asciinema ํ๋ ์ด์ด ๊ธฐ๊ณ.
@deeplook๋ , Jupyter ๋ ธํธ๋ถ์ ๋ด์ฅ ์ฝ๋๋ฅผ ์ฝ์ ํ๊ณ Jupyter ๋ ธํธ๋ถ์ asciinema ์บ์คํธ๋ฅผ ์ง์ ์ฝ์ ํ ์ ์์ต๋๋ค.
from IPython.display import HTML
HTML("""<script src="https://asciinema.org/a/1wkyfecyj2qa4t9gm4bank61y.js" id="asciicast-1wkyfecyj2qa4t9gm4bank61y" async></script>""")
๋ง๋ฒ์ ๊ธฐ๋ฅ %%html
๋ ์๋ํฉ๋๋ค
์ด ๋น๋์ค๋ฅผ ๋ณด์ญ์์ค: https://www.useloom.com/share/e606957f1aa0431399c30c1b95cb5207
@zodiacfireworks ๊ฐ์ฌํฉ๋๋ค! asciinema.org์์ ํธ์คํ ๋๋ ์๊ฒฉ ์คํฌ๋ฆฐ์บ์คํธ๋ฅผ ์คํํ ์ ์๋ค๋ ๊ฒ์ ํ์คํ ๋ฉ์ง ์ผ์ ๋๋ค.
๋ด ์ง๋ฌธ์ ๋ค์ ์ฝ์ผ๋ฉด ๊ทธ๋ ๊ฒ ๋ถ๋ช ํ์ง ์๋ค๋ ๊ฒ์ ์ธ์ ํ์ง๋ง asciinama-player๊ฐ ์๋ "์ผ๋ฐ" Jupyter ์ ์์ ๋ก์ปฌ ์คํฌ๋ฆฐ์บ์คํธ๋ฅผ ์คํํ๋ ๊ฒ์ ๋ํด ๋ ์๊ฐํ์ต๋๋ค. ํ์ง ์บ์คํธ์์ asciinama-player๋ฅผ ์ฌ์ฉํด ๋ณด์์ง๋ง ํ์๊ณ ์์ต๋๋ค. ๋ก์ปฌ ํ์ผ์ ๋ํด ์น์ํ asciinama-player ์ธํฐํ์ด์ค๋ก ์ด ์์ ์ ์ํํ๋ ๊ฒ๋ ๋งค์ฐ ์ข์ต๋๋ค.
ํ์ง๋ง, ์... ์ ๋ ๊ฐ์ฅ ๊ฐ๋ฅ์ฑ์ด ๋ฎ์ ์ผ์ ์๋ํ๊ณ ๋๋๊ฒ๋ ์ด๊ฒ์ด ํจ๊ณผ ๊ฐ ์์์ต๋๋ค! ๋๋ ๋จ์ํ ์ฝ๋ ์
์ ! /my/path/asciinema play demo.cast
๋ฅผ ์
๋ ฅํ์ต๋๋ค! ๊ทธ๋ฆฌ๊ณ ์์งํ ๋งํด์, ๋๋ ์ด๊ฒ์ด ํจ๊ณผ๊ฐ ์์ ๊ฑฐ๋ผ๊ณ ๊ธฐ๋ํ์ง ์์์ง๋ง, ํจ๊ณผ๊ฐ ์๋ ๊ฒ ๊ฐ์ต๋๋ค! ์ถ๋ ฅ์ ํ์ด๋ฐ ์ ๋ณด ๋ฐ ANSI ์ด์ค์ผ์ดํ ์ฝ๋์ ๋ฐ๋ผ ํ์์ ๊ฐ์ด ํ์๋ฉ๋๋ค. ๊ทธ๋ฌ๋ ํฐ๋ฏธ๋์ ๋๋น์ ๋์ด์ ๋ํด ๊ธฐ๋ก๋ ๊ฐ์ "๋ฌด์"ํ์ฌ ์ ์ฒด ์
๋๋น๋ฅผ ์ฌ์ฉํ๊ณ ์์ง ์ฐฝ์ ์ํํ์ง ์์ต๋๋ค. ๊ทธ๋ฌ๋ ์ด๋ด, ์ด๊ฒ์ ๋๋๋ค!
๊ทธ๋ผ ๋ซ์๋ณผ๊น์? ;)
Asciinema ํ๋ ์ด์ด ๋นํธ๋ฅผ Jupyter์ ์ถ๊ฐํ์ฌ ๋ก์ปฌ ์บ์คํธ๋ ์คํํ๋๋ก ํ๋ ์ ์ ์๋ ๋ฐฉ๋ฒ์ด ์๋ค๋ฉด ๊ทธ๋ ๊ฒ ํ ์ ์์ต๋๋ค. ์ฒ์์ ์๋ํ์ง๋ง ์ด์ด ์์ต๋๋ค.
์, ์ฌ๊ธฐ์์ ํ๋ ์ด์ด๋ฅผ ํฌํจํ๋ 3๊ฐ์ง ๋ฐฉ๋ฒ์ ๋ํด ์ด์ผ๊ธฐํ๊ณ ์์ต๋๋ค.
! /my/path/asciinema play demo.cast
<script>
: HTML("""<script src="https://asciinema.org/a/1wkyfecyj2qa4t9gm4bank61y.js" ...
asciinema-player.js
+ ๋ก์ปฌ .cast
ํ์ผ์ ๋ก์ปฌ ์ฌ๋ณธ์ ํตํด2ํธ์ ์ด๋ฏธ ํ๋ฆฐ๊ฑฐ ๊ฐ์๋ฐ ๋ง๋์?
@deeplook 3์
@sickill ๋ง์ต๋๋ค. (2)๋ asciinema-player๊ฐ ์ค์น๋ ๋ค๋ฅธ ์ฌ์ดํธ์์๋ ์๋ํ๋ค๊ณ ๊ฐ์ ํฉ๋๋ค.
์ค์ ๋ก ๋ค์๊ณผ ๊ฐ์ด ์์ฒด ํฌํจ๋ HTML ํ์ผ์ ๊ฐ๋ฆฌํฌ ์ ์๋ TermRecord ๋ฅผ ๋ฐ๋ผ์ก๋ ๋ฐ ๋์์ด ๋ฉ๋๋ค.
from IPython.display import IFrame
IFrame('http://theonewolf.github.io/TermRecord/hello-static.html', 800, 300)
TermRecord์ ํ์ผ์ ๋ชจ๋ ๊ฒ์ด ์ธ๋ผ์ธ์ผ๋ก ํฌํจ๋์ด ์์ต๋๊น? js/data ํ์ผ์ด ์๋ ๋จ์ผ html ํ์ผ๋ง ์์ต๋๊น?
์น๊ตฌ๋ค์ด ์๋ ค์ค ์ด์ผ๊ธฐ๋ผ ์ ๋ชจ๋ฅด๊ฒ ์ต๋๋ค. HTML์ JS/CSS๊ฐ ํฌํจ๋์ด ์๋ค๊ณ ๊ฐ์ ํด์ผ ํฉ๋๋ค...
CSS/JS ๋ฐ ๋ฐ์ดํฐ๋ฅผ ํฌํจํ์ฌ ๋ ๋ฆฝ์ ์ธ HTML blob์ ์์ฑํ๊ธฐ ์ํด asciinema-player์ ์ต์ ์ ์ถ๊ฐํ๋ ๊ฒ์ด ์ฌ์ธ ๊ฒ์ด๋ผ๊ณ ๊ฐ์ ํฉ๋๋ค.
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
@deeplook๋ , Jupyter ๋ ธํธ๋ถ์ ๋ด์ฅ ์ฝ๋๋ฅผ ์ฝ์ ํ๊ณ Jupyter ๋ ธํธ๋ถ์ asciinema ์บ์คํธ๋ฅผ ์ง์ ์ฝ์ ํ ์ ์์ต๋๋ค.
๋ง๋ฒ์ ๊ธฐ๋ฅ
%%html
๋ ์๋ํฉ๋๋ค์ด ๋น๋์ค๋ฅผ ๋ณด์ญ์์ค: https://www.useloom.com/share/e606957f1aa0431399c30c1b95cb5207