Browse Source

Added new asciinema files.

master
Franco Masotti 1 year ago
parent
commit
ff4485dcb6
Signed by: frnmst
GPG Key ID: 24116ED85666780A
  1. 4
      README.rst
  2. 47
      asciinema/md_toc_asciinema_8_0_0.json
  3. 172
      asciinema/md_toc_asciinema_8_0_0_demo.sh

4
README.rst

@ -32,8 +32,8 @@ improve document readability.
Video
-----
.. image:: https://asciinema.org/a/406423.png
:target: https://asciinema.org/a/406423
.. image:: https://asciinema.org/a/416978.png
:target: https://asciinema.org/a/416978
:align: center
Description

47
asciinema/md_toc_asciinema_8_0_0.json

@ -0,0 +1,47 @@
{"version": 2, "width": 83, "height": 46, "timestamp": 1622221077, "env": {"SHELL": "/bin/bash", "TERM": "rxvt-unicode-256color"}}
[0.008049, "o", "Running a demo to show some of python -m md_toc's capabilities...\r\n\r\n"]
[1.015122, "o", "$ python -m md_toc -h\r\n"]
[1.356915, "o", "usage: __main__.py [-h] [-c | -i] [-l] [-m TOC_MARKER] [-n NEWLINE_STRING]\r\n [-p] [-s SKIP_LINES] [-v]\r\n {github,commonmarker,gitlab,cmark,goldmark,redcarpet} ...\r\n\r\nMarkdown Table Of Contents: Automatically generate a compliant table\r\nof contents for a markdown file to improve document readability.\r\n\r\noptional arguments:\r\n -h, --help show this help message and exit\r\n -c, --no-list-coherence\r\n avoids checking for TOC list coherence\r\n -i, --no-indentation avoids adding indentations to the TOC\r\n -l, --no-links avoids adding links to the TOC\r\n -m TOC_MARKER, --toc-marker TOC_MARKER\r\n set the string to be used as the marker for\r\n positioning the table of contents. Defaults to <!--\r\n TOC-->\r\n -n NEWLINE_STRING, --newline-string NEWLINE_STRING\r\n the string used to separate the lines of the TOC. Use\r\n quotes to delimit t"]
[1.357019, "o", "he string. Defaults to '\\n'\r\n -p, --in-place overwrite the input file\r\n -s SKIP_LINES, --skip-lines SKIP_LINES\r\n skip parsing of the first selected number of lines.\r\n Defaults to 0, i.e. do not skip any lines\r\n -v, --version show program's version number and exit\r\n\r\nmarkdown parser:\r\n {github,commonmarker,gitlab,cmark,goldmark,redcarpet}\r\n <markdown parser> --help\r\n\r\nPlease read the documentation to understand how each parser works\r\n\r\nReturn values: 0 ok, 1 error, 2 invalid command\r\n\r\nCopyright (C) 2017-2021 Franco Masotti, frnmst\r\nLicense GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\r\nThis is free software: you are free to change and redistribute it.\r\nThere is NO WARRANTY, to the extent permitted by law.\r\n"]
[1.449011, "o", "\r\n"]
[2.457318, "o", "Inspecting the file...\r\n$ cat foo.md\r\n"]
[2.458509, "o", "# Hi\r\n\r\n<!--TOC-->\r\n\r\nhey\r\n\r\n## How are you? !!!\r\n\r\n## fine, thanks\r\n\r\n### Bye\r\n\r\n## <small>__Bye bye__ **bye***</small>\r\n\r\n```python\r\n# This is a code\r\n# fence with comments that might represent ATX-style headings\r\n# if not properly parsed\r\n```\r\n\r\nbye\r\n\r\n# boo\r\n\r\n# a string with lots of spaces.\r\n"]
[2.459323, "o", "\r\n"]
[3.467115, "o", "Run with default options...\r\n$ python -m md_toc github foo.md\r\n"]
[3.932094, "o", "- [Hi](#hi)\r\n - [How are you? !!!](#how-are-you-----------)\r\n - [fine, thanks](#fine-thanks)\r\n - [Bye](#bye)\r\n - [<small>__Bye bye__ **bye***</small>](#bye-bye-bye)\r\n- [boo](#boo)\r\n- [a string with lots of spaces.](#a-string--------------with----------------lots-of-spaces)\r\n"]
[4.018819, "o", "\r\n"]
[5.020617, "o", "Ordered list...\r\n$ python -m md_toc gitlab -o '.' foo.md\r\n"]
[5.43953, "o", "1. [Hi](#hi)\r\n 1. [How are you? !!!](#how-are-you-)\r\n 2. [fine, thanks](#fine-thanks)\r\n 1. [Bye](#bye)\r\n 3. [<small>__Bye bye__ **bye***</small>](#bye-bye-bye)\r\n2. [boo](#boo)\r\n3. [a string with lots of spaces.](#a-string-with-lots-of-spaces)\r\n"]
[5.499317, "o", "\r\n"]
[6.501616, "o", "Constant ordered list...\r\n$ python -m md_toc github -c -o '.' foo.md\r\n"]
[6.897007, "o", "1. [Hi](#hi)\r\n 1. [How are you? !!!](#how-are-you-----------)\r\n 1. [fine, thanks](#fine-thanks)\r\n 1. [Bye](#bye)\r\n 1. [<small>__Bye bye__ **bye***</small>](#bye-bye-bye)\r\n1. [boo](#boo)\r\n1. [a string with lots of spaces.](#a-string--------------with----------------lots-of-spaces)\r\n"]
[6.963218, "o", "\r\n"]
[7.965299, "o", "No links...\r\n$ python -m md_toc -l github foo.md\r\n"]
[8.342501, "o", "- Hi\r\n - How are you? !!!\r\n - fine, thanks\r\n - Bye\r\n - <small>__Bye bye__ **bye***</small>\r\n- boo\r\n- a string with lots of spaces.\r\n"]
[8.419095, "o", "\r\n"]
[9.421119, "o", "No links and no indentation...\r\n$ python -m md_toc -l -i github foo.md\r\n"]
[9.951343, "o", "- Hi\r\n- How are you? !!!\r\n- fine, thanks\r\n- Bye\r\n- <small>__Bye bye__ **bye***</small>\r\n- boo\r\n- a string with lots of spaces.\r\n"]
[10.052129, "o", "\r\n"]
[11.053621, "o", "Inspecting the non-coherent file...\r\n$ cat foo_noncoherent.md\r\n"]
[11.055057, "o", "# Hi\r\n### boo\r\n"]
[11.055449, "o", "\r\n"]
[12.05725, "o", "Trying to parse a non coherent markdown file will raise an exception...\r\n$ python -m md_toc github foo_noncoherent.md\r\n"]
[12.513556, "o", "Traceback (most recent call last):\r\n File \"/home/vm/dev/personal/stable/md-toc/md_toc/__main__.py\", line 34, in main\r\n result = args.func(args)\r\n File \"/home/vm/dev/personal/stable/md-toc/md_toc/cli.py\", line 73, in write_toc\r\n newline_string=newline_string)\r\n File \"/home/vm/dev/personal/stable/md-toc/md_toc/api.py\", line 842, in build_multiple_tocs\r\n list_marker, skip_lines, constant_ordered_list, newline_string))\r\n File \"/home/vm/dev/personal/stable/md-toc/md_toc/api.py\", line 748, in build_toc\r\n raise TocDoesNotRenderAsCoherentList\r\nmd_toc.exceptions.TocDoesNotRenderAsCoherentList\r\n"]
[12.598876, "o", "\r\n"]
[13.601292, "o", "Try to parse a non coherent markdown file without checking for coherence...\r\n$ python -m md_toc -c github foo_noncoherent.md\r\n"]
[13.957473, "o", "- [Hi](#hi)\r\n - [boo](#boo)\r\n"]
[14.008105, "o", "\r\n"]
[15.008974, "o", "Use stdin, no links and no indentation...\r\n$ cat foo.md | python -m md_toc -l -i - cmark -u '*'\r\n"]
[15.429645, "o", "* Hi\r\n* How are you? !!!\r\n* fine, thanks\r\n* Bye\r\n* <small>__Bye bye__ **bye***</small>\r\n* boo\r\n* a string with lots of spaces.\r\n"]
[15.514497, "o", "\r\n"]
[16.516463, "o", "Inspecting a file where the first 5 lines need to be skipped...\r\n$ cat foo_skiplines.md\r\n# I want this line to be a comment\r\n#### And this as well\r\n## And this\r\n###### ByeBye\r\n\r\n# Hi\r\n## How\r\n### Are\r\n## You\r\n# Today ?\r\n"]
[16.519302, "o", "\r\n"]
[17.519869, "o", "Using the skip lines option...\r\n$ python -m md_toc -s 5 github foo_skiplines.md\r\n"]
[17.935135, "o", "- [Hi](#hi)\r\n - [How](#how)\r\n - [Are](#are)\r\n - [You](#you)\r\n- [Today ?](#today-)\r\n"]
[18.007388, "o", "\r\n"]
[19.009973, "o", "Showing Gitlab's removal of consecutive dashes in the link destination...\r\n$ python -m md_toc gitlab -l 6 foo.md\r\n"]
[19.41085, "o", "- [Hi](#hi)\r\n - [How are you? !!!](#how-are-you-)\r\n - [fine, thanks](#fine-thanks)\r\n - [Bye](#bye)\r\n - [<small>__Bye bye__ **bye***</small>](#bye-bye-bye)\r\n- [boo](#boo)\r\n- [a string with lots of spaces.](#a-string-with-lots-of-spaces)\r\n"]
[19.483543, "o", "\r\n"]
[20.486416, "o", "Editing the file in-place. As you can see, code fence detection still needs to be implemented for redcarpet...\r\n$ python -m md_toc -p redcarpet foo.md\r\n"]
[21.00377, "o", "$ cat foo.md\r\n"]
[21.007926, "o", "# Hi\r\n\r\n<!--TOC-->\r\n\r\n- [Hi](#hi)\r\n - [How are you? !!!](#how-are-you)\r\n - [fine, thanks](#fine-thanks)\r\n - [Bye](#bye)\r\n - [<small>__Bye bye__ **bye***</small>](#small>__bye-bye__-bye-small>)\r\n- [This is a code](#this-is-a-code)\r\n- [fence with comments that might represent ATX-style headings](#fence-with-comments-that-might-represent-atx-style-headings)\r\n- [if not properly parsed](#if-not-properly-parsed)\r\n- [boo](#boo)\r\n- [a string with lots of spaces.](#a-string-with-lots-of-spaces)\r\n\r\n<!--TOC-->\r\n\r\nhey\r\n\r\n## How are you? !!!\r\n\r\n## fine, thanks\r\n\r\n### Bye\r\n\r\n## <small>__Bye bye__ **bye***</small>\r\n\r\n```python\r\n# This is a code\r\n# fence with comments that might represent ATX-style headings\r\n# if not properly parsed\r\n```\r\n\r\nbye\r\n\r\n# boo\r\n\r\n# a string with lots of spaces.\r\n"]

172
asciinema/md_toc_asciinema_8_0_0_demo.sh

@ -0,0 +1,172 @@
#!/bin/bash
#
# python -m md_toc_asciinema_7_1_0_demo.sh
#
# Copyright (C) 2021 frnmst (Franco Masotti) <franco.masotti@live.com>
#
# This file is part of md-toc.
#
# md-toc is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# md-toc is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with md-toc. If not, see <http://www.gnu.org/licenses/>.
#
# Discover python -m md_toc of this repository not the one installed on the system.
export PYTHONPATH='..'
TIMEOUT=1
alias python='pipenv run python'
###
###
printf "Running a demo to show some of python -m md_toc's capabilities...\n"
printf "\n"
sleep ${TIMEOUT}
printf "$ python -m md_toc -h\n"
python -m md_toc -h
printf "\n"
sleep ${TIMEOUT}
cat <<-EOF > foo.md
# Hi
<!--TOC-->
hey
## How are you? !!!
## fine, thanks
### Bye
## <small>__Bye bye__ **bye***</small>
\`\`\`python
# This is a code
# fence with comments that might represent ATX-style headings
# if not properly parsed
\`\`\`
bye
# boo
# a string with lots of spaces.
EOF
cat <<-EOF > foo_noncoherent.md
# Hi
### boo
EOF
cat <<-EOF > foo_skiplines.md
# I want this line to be a comment
#### And this as well
## And this
###### ByeBye
# Hi
## How
### Are
## You
# Today ?
EOF
printf "Inspecting the file...\n"
printf "$ cat foo.md\n"
cat foo.md
printf "\n"
sleep ${TIMEOUT}
printf "Run with default options...\n"
printf "$ python -m md_toc github foo.md\n"
python -m md_toc github foo.md
printf "\n"
sleep ${TIMEOUT}
printf "Ordered list...\n"
printf "$ python -m md_toc gitlab -o '.' foo.md\n"
python -m md_toc gitlab -o '.' foo.md
printf "\n"
sleep ${TIMEOUT}
printf "Constant ordered list...\n"
printf "$ python -m md_toc github -c -o '.' foo.md\n"
python -m md_toc github -c -o '.' foo.md
printf "\n"
sleep ${TIMEOUT}
printf "No links...\n"
printf "$ python -m md_toc -l github foo.md\n"
python -m md_toc -l github foo.md
printf "\n"
sleep ${TIMEOUT}
printf "No links and no indentation...\n"
printf "$ python -m md_toc -l -i github foo.md\n"
python -m md_toc -l -i github foo.md
printf "\n"
sleep ${TIMEOUT}
printf "Inspecting the non-coherent file...\n"
printf "$ cat foo_noncoherent.md\n"
cat foo_noncoherent.md
printf "\n"
sleep ${TIMEOUT}
printf "Trying to parse a non coherent markdown file will raise an exception...\n"
printf "$ python -m md_toc github foo_noncoherent.md\n"
python -m md_toc github foo_noncoherent.md
printf "\n"
sleep ${TIMEOUT}
printf "Try to parse a non coherent markdown file without checking for coherence...\n"
printf "$ python -m md_toc -c github foo_noncoherent.md\n"
python -m md_toc -c github foo_noncoherent.md
printf "\n"
sleep ${TIMEOUT}
printf "Use stdin, no links and no indentation...\n"
printf "$ cat foo.md | python -m md_toc -l -i - cmark -u '*'\n"
cat foo.md | python -m md_toc -l -i cmark -u '*'
printf "\n"
sleep ${TIMEOUT}
printf "Inspecting a file where the first 5 lines need to be skipped...\n"
printf "$ cat foo_skiplines.md\n"
cat foo_skiplines.md
printf "\n"
sleep ${TIMEOUT}
printf "Using the skip lines option...\n"
printf "$ python -m md_toc -s 5 github foo_skiplines.md\n"
python -m md_toc -s 5 github foo_skiplines.md
printf "\n"
sleep ${TIMEOUT}
printf "Showing Gitlab's removal of consecutive dashes in the link destination...\n"
printf "$ python -m md_toc gitlab -l 6 foo.md\n"
python -m md_toc gitlab -l 6 foo.md
printf "\n"
sleep ${TIMEOUT}
printf "Editing the file in-place. As you can see, code fence \
detection still needs to be implemented for redcarpet...\n"
printf "$ python -m md_toc -p redcarpet foo.md\n"
python -m md_toc -p redcarpet foo.md
printf "$ cat foo.md\n"
cat foo.md
rm foo.md foo_noncoherent.md foo_skiplines.md
Loading…
Cancel
Save