Skip to content

Commit ea465a6

Browse files
Split demo into separate files. Update tests / demos accordingly.
1 parent 8e9f001 commit ea465a6

18 files changed

+485
-251
lines changed

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
large.md
22
test.md
3+
*.cast

Diff for: README.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22

33
Plugin to improve viewing Markdown files in Neovim
44

5-
![Demo](demo/demo.gif)
5+
| | |
6+
| ------------------------------------------ | ---------------------------------- |
7+
| ![Heading Code](demo/heading_code.gif) | ![List Table](demo/list_table.gif) |
8+
| ![Box Dash Quote](demo/box_dash_quote.gif) | ![LaTeX](demo/latex.gif) |
9+
| ![Callout](demo/callout.gif) | |
610

711
# Features
812

Diff for: demo/box_dash_quote.gif

69.4 KB
Loading

Diff for: demo/box_dash_quote.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Checkbox / Dash / Quote
2+
3+
- [ ] Unchecked Checkbox
4+
- [x] Checked Checkbox
5+
6+
---
7+
8+
> Quote line 1
9+
> Quote line 2

Diff for: demo/callout.gif

102 KB
Loading

Diff for: demo/callout.md

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Note
2+
3+
> [!NOTE]
4+
> A regular note
5+
6+
# Tip
7+
8+
> [!TIP]
9+
> Standard tip
10+
11+
# Important
12+
13+
> [!IMPORTANT]
14+
> Exceptional info
15+
16+
# Warning
17+
18+
> [!WARNING]
19+
> Dastardly surprise
20+
21+
# Caution
22+
23+
> [!CAUTION]
24+
> Cautionary tale

Diff for: demo/demo.gif

-713 KB
Binary file not shown.

Diff for: demo/heading_code.gif

239 KB
Loading

Diff for: demo/heading_code.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Heading 1
2+
3+
### Heading 3
4+
5+
#### Heading 4
6+
7+
##### Heading 5
8+
9+
###### Heading 6
10+
11+
```python
12+
def main() -> None:
13+
sum = 0
14+
for i in range(10):
15+
sum += i
16+
print(sum)
17+
18+
19+
if __name__ == "__main__":
20+
main()
21+
```

Diff for: demo/latex.gif

88.2 KB
Loading

Diff for: demo/latex.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# LaTeX
2+
3+
$\sqrt{3x-1}+(1+x)^2$
4+
5+
$$
6+
f(x,y) = x + \sqrt{y}
7+
f(x,y) = \sqrt{y} + \frac{x^2}{4y}
8+
$$

Diff for: demo/list_table.gif

113 KB
Loading

Diff for: demo/list_table.md

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Unordered List
2+
3+
- List Item 1: with [link](https://example.com)
4+
* List Item 2: with `inline` code
5+
* Nested List 1 Item 1
6+
* Nested List 1 Item 2
7+
- Nested List 2 Item 1
8+
- Nested List 3 Item 1
9+
- Nested List 4 Item 1
10+
+ List Item 3
11+
12+
# Ordered List
13+
14+
1. Item 1
15+
2. Item 2
16+
3. Item 3
17+
18+
# Table
19+
20+
| Heading 1 | Heading 2 |
21+
| ------------ | ------------ |
22+
| Row 1 Item 1 | Row 1 Item 2 |
23+
| Row 2 Item 1 | Row 2 Item 2 |
24+
| Row 3 Item 1 | Row 3 Item 2 |

Diff for: demo/record.py

+17-20
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,28 @@
44
import pyautogui
55

66

7-
def main(zoom: int, file: str, cast: str) -> None:
7+
def main(rows: int, cols: int, file: str, cast: str, content: str) -> None:
88
# Open new tmux window
99
pyautogui.hotkey("`", "c")
1010
time.sleep(1.0)
1111

12-
# Zoom in / out
13-
zoom_key = "=" if zoom >= 0 else "-"
14-
for _ in range(abs(zoom)):
15-
pyautogui.hotkey("command", zoom_key)
16-
1712
# Start recording demo file
1813
# https://docs.asciinema.org/manual/cli/usage/
19-
pyautogui.write(f"asciinema rec -c 'nvim {file}' {cast}")
14+
pyautogui.write("asciinema rec")
15+
pyautogui.write(f" --rows {rows} --cols {cols}")
16+
pyautogui.write(f" --command 'nvim {file}' {cast}")
2017
pyautogui.press("enter")
21-
time.sleep(1.5)
18+
time.sleep(2.0)
2219

23-
# Start typing in new heading
24-
pyautogui.press("o")
25-
pyautogui.press("enter")
26-
pyautogui.write("## Heading 2", interval=0.1)
20+
if len(content) > 0:
21+
# Start typing in content
22+
pyautogui.press("o")
23+
pyautogui.press("enter")
24+
pyautogui.write(content, interval=0.1)
2725

28-
# Enter normal mode
29-
pyautogui.press("esc")
30-
time.sleep(2.0)
26+
# Enter normal mode
27+
pyautogui.press("esc")
28+
time.sleep(2.0)
3129

3230
# Swith between insert and normal mode a few times
3331
for i in range(2):
@@ -41,18 +39,17 @@ def main(zoom: int, file: str, cast: str) -> None:
4139
pyautogui.press("enter")
4240
time.sleep(0.5)
4341

44-
# Zoom out
45-
pyautogui.hotkey("command", "0")
46-
4742
# Close tmux window
4843
pyautogui.write("exit")
4944
pyautogui.press("enter")
5045

5146

5247
if __name__ == "__main__":
5348
parser = ArgumentParser(description="Generate a demo recording using asciinema")
54-
parser.add_argument("--zoom", type=int, required=True)
49+
parser.add_argument("--rows", type=int, required=True)
50+
parser.add_argument("--cols", type=int, required=True)
5551
parser.add_argument("--file", type=str, required=True)
5652
parser.add_argument("--cast", type=str, required=True)
53+
parser.add_argument("--content", type=str, required=True)
5754
args = parser.parse_args()
58-
main(args.zoom, args.file, args.cast)
55+
main(args.rows, args.cols, args.file, args.cast, args.content)

Diff for: demo/sample.md

-61
This file was deleted.

Diff for: doc/render-markdown.txt

+7-6
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,19 @@ Table of Contents *render-markdown-table-of-contents*
1818
- Render in Neovim |render-markdown-markdown-ecosystem-render-in-neovim|
1919
- Render in Browser |render-markdown-markdown-ecosystem-render-in-browser|
2020
- Orthogonal |render-markdown-markdown-ecosystem-orthogonal|
21-
10. Links |render-markdown-links|
2221

2322
==============================================================================
2423
1. markdown.nvim *render-markdown-markdown.nvim*
2524

2625
Plugin to improve viewing Markdown files in Neovim
2726

27+
--------------------------------------- -------------------------------
28+
[Heading Code] [List Table]
29+
30+
[Box Dash Quote] [LaTeX]
31+
32+
[Callout]
33+
--------------------------------------- -------------------------------
2834

2935
==============================================================================
3036
2. Features *render-markdown-features*
@@ -384,11 +390,6 @@ also have no issues running alongside this plugin.
384390
- markdown.nvim <https://github.com/tadmccorkle/markdown.nvim> - Adds `markdown`
385391
specific keybindings for interacting with `markdown` files
386392

387-
==============================================================================
388-
10. Links *render-markdown-links*
389-
390-
1. *Demo*: demo/demo.gif
391-
392393
Generated by panvimdoc <https://github.com/kdheepak/panvimdoc>
393394

394395
vim:tw=78:ts=8:noet:ft=help:norl:

Diff for: justfile

+17-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
init := "tests/minimal.lua"
2-
default_zoom := "0"
2+
default_cols := "55"
33

44
test:
55
nvim --headless --noplugin -u {{init}} \
@@ -8,17 +8,26 @@ test:
88
health:
99
nvim -c "checkhealth render-markdown" -- .
1010

11-
demo zoom=default_zoom:
12-
rm -f demo/demo.gif
11+
demo-all cols=default_cols:
12+
just demo "40" {{cols}} "heading_code" "## Heading 2"
13+
just demo "40" {{cols}} "list_table" ""
14+
just demo "20" {{cols}} "box_dash_quote" ""
15+
just demo "20" {{cols}} "latex" ""
16+
just demo "40" {{cols}} "callout" ""
17+
18+
demo rows cols file content:
19+
rm -f demo/{{file}}.gif
1320
python demo/record.py \
14-
--zoom {{zoom}} \
15-
--file demo/sample.md \
16-
--cast demo.cast
21+
--rows {{rows}} \
22+
--cols {{cols}} \
23+
--file demo/{{file}}.md \
24+
--cast {{file}}.cast \
25+
--content "{{content}}"
1726
# https://docs.asciinema.org/manual/agg/usage/
18-
agg demo.cast demo/demo.gif \
27+
agg {{file}}.cast demo/{{file}}.gif \
1928
--font-family "Monaspace Neon,Hack Nerd Font" \
2029
--last-frame-duration 1
21-
rm demo.cast
30+
rm {{file}}.cast
2231

2332
update:
2433
python -Wignore scripts/update.py

0 commit comments

Comments
 (0)