mirror of
https://github.com/Hopiu/lychee.git
synced 2026-03-16 20:50:25 +00:00
Add new SVG-based screencast (#693)
This is taken from https://github.com/sharkdp/fd, so all credits go to the original authors. The demo was a bit dated. We've since added more features and changed the output. On top of that, the gif was a bit blurry. The new version is in SVG and the commands can be scripted, so we can change them with a PR and render them through CI. Co-authored-by: Brennan Kinney <5098581+polarathene@users.noreply.github.com>
This commit is contained in:
parent
435eadd96b
commit
601adcefd3
5 changed files with 66 additions and 2 deletions
4
Makefile
4
Makefile
|
|
@ -33,3 +33,7 @@ run: ## Run project locally
|
|||
.PHONY: docs
|
||||
docs: ## Generate and show documentation
|
||||
cargo doc --open
|
||||
|
||||
.PHONY: screencast
|
||||
screencast: ## Create a screencast for the docs
|
||||
svg-term --command 'assets/screencast.sh' --out 'assets/screencast.svg' --width 100 --padding 10 --window
|
||||
|
|
@ -12,7 +12,7 @@ reStructuredText, or any other text file or website!
|
|||
|
||||
Available as a command-line utility, a library and a [GitHub Action](https://github.com/lycheeverse/lychee-action).
|
||||
|
||||

|
||||

|
||||
|
||||
## Installation
|
||||
|
||||
|
|
|
|||
60
assets/screencast.sh
Normal file
60
assets/screencast.sh
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# Adapted from
|
||||
# https://github.com/marionebl/svg-term-cli
|
||||
# https://github.com/sharkdp/fd/blob/master/doc/screencast.sh
|
||||
#
|
||||
# Designed to be executed via svg-term from the lychee root directory:
|
||||
# svg-term --command="bash assets/screencast.sh" --out assets/screencast.svg --padding=10
|
||||
# Then run this (workaround for https://github.com/sharkdp/fd/issues/1003):
|
||||
# sed -i '' 's/<text/<text font-size="1.67"/g' assets/screencast.svg
|
||||
set -e
|
||||
set -u
|
||||
|
||||
PROMPT="❯"
|
||||
|
||||
# Always use latest version of lychee for screencast
|
||||
alias lychee="cargo run --"
|
||||
|
||||
enter() {
|
||||
INPUT=$1
|
||||
DELAY=1
|
||||
|
||||
prompt
|
||||
sleep "$DELAY"
|
||||
type "$INPUT"
|
||||
sleep 0.5
|
||||
printf '%b' "\\n"
|
||||
eval "$INPUT"
|
||||
type "\\n"
|
||||
}
|
||||
|
||||
prompt() {
|
||||
printf '%b ' "$PROMPT" | pv -q
|
||||
}
|
||||
|
||||
type() {
|
||||
printf '%b' "$1" | pv -qL $((10+(-2 + RANDOM%5)))
|
||||
}
|
||||
|
||||
main() {
|
||||
IFS='%'
|
||||
|
||||
enter "lychee README.md"
|
||||
|
||||
enter "lychee --verbose --format=json fixtures/TEST.html"
|
||||
|
||||
enter "lychee --no-progress --format detailed https://example.com"
|
||||
|
||||
enter "lychee --dump --include github -- './**/*.md'"
|
||||
|
||||
prompt
|
||||
|
||||
sleep 3
|
||||
|
||||
echo ""
|
||||
|
||||
unset IFS
|
||||
}
|
||||
|
||||
main
|
||||
1
assets/screencast.svg
Normal file
1
assets/screencast.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 114 KiB |
1
fixtures/TEST.html
vendored
1
fixtures/TEST.html
vendored
|
|
@ -10,7 +10,6 @@
|
|||
>
|
||||
</li>
|
||||
<li><a href="https://hello-rust.show/10/">Hello Rust</a></li>
|
||||
<li><a href="20/">Hello Rust</a></li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
Loading…
Reference in a new issue