Browse Source

Added new demo. Updated demo link.

master
Franco Masotti 3 years ago
parent
commit
d68ec25a15
  1. 4
      README.rst
  2. 40
      asciinema/md_toc_asciinema_5_0_0.json
  3. 130
      asciinema/md_toc_asciinema_5_0_0_demo.sh

4
README.rst

@ -30,8 +30,8 @@ improve document readability.
Video
-----
.. image:: https://asciinema.org/a/237581.png
:target: https://asciinema.org/a/237581
.. image:: https://asciinema.org/a/240852.png
:target: https://asciinema.org/a/240852
:align: center
Description

40
asciinema/md_toc_asciinema_5_0_0.json

@ -0,0 +1,40 @@
{"version": 2, "width": 174, "height": 46, "timestamp": 1555259634, "env": {"SHELL": "/bin/bash", "TERM": "rxvt-unicode-256color"}}
[0.010556, "o", "Running a demo to show some of md_toc's capabilities...\r\n\r\n"]
[1.012344, "o", "$ md_toc -h\r\n"]
[1.197964, "o", "usage: md_toc [-h] [-c | -i] [-l] [-m TOC_MARKER] [-p] [-v]\r\n [FILE_NAME [FILE_NAME ...]]\r\n {github,cmark,gitlab,commonmarker,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\npositional arguments:\r\n FILE_NAME the I/O file name\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 [](TOC)\r\n -p, --in-place overwrite the input file\r\n -v, --version show program's version number and exit\r\n\r\nmarkdown parser:\r\n {github,cmark,gitlab,commonmarker"]
[1.198643, "o", ",redcarpet}\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) 2018-2019 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.210429, "o", "\r\n"]
[2.215499, "o", "Inspecting the file...\r\n$ cat foo.md\r\n"]
[2.216698, "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## Bye bye\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"]
[2.21728, "o", "\r\n"]
[3.218615, "o", "Run with default options...\r\n$ md_toc foo.md github\r\n"]
[3.401344, "o", "- [Hi](#hi)\r\n - [How are you? !!!](#how-are-you-----------)\r\n - [fine, thanks](#fine-thanks)\r\n - [Bye](#bye)\r\n - [Bye bye](#bye-bye)\r\n- [boo](#boo)\r\n"]
[3.413, "o", "\r\n"]
[4.41438, "o", "Ordered list...\r\n$ md_toc foo.md gitlab -o\r\n"]
[4.605895, "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. [Bye bye](#bye-bye)\r\n2. [boo](#boo)\r\n"]
[4.617561, "o", "\r\n"]
[5.619173, "o", "No links...\r\n$ md_toc -l foo.md github\r\n"]
[5.801036, "o", "- Hi\r\n - How are you? !!!\r\n - fine, thanks\r\n - Bye\r\n - Bye bye\r\n- boo\r\n"]
[5.812618, "o", "\r\n"]
[6.814147, "o", "No links and no indentation...\r\n$ md_toc -l -i foo.md github\r\n"]
[6.998235, "o", "- Hi"]
[6.998534, "o", "\r\n"]
[6.9986, "o", "- How are you? !!!"]
[6.998829, "o", "\r\n"]
[6.998944, "o", "- fine, thanks\r\n- Bye\r\n- Bye bye\r\n- boo\r\n"]
[7.010849, "o", "\r\n"]
[8.012481, "o", "Inspecting the non-coherent file...\r\n$ cat foo_noncoherent.md\r\n"]
[8.014395, "o", "# Hi\r\n### boo\r\n"]
[8.014576, "o", "\r\n"]
[9.01643, "o", "Trying to parse a non coherent markdown file will raise an exception...\r\n$ md_toc foo_noncoherent.md github\r\n"]
[9.200414, "o", "Traceback (most recent call last):\r\n File \"/home/vm/md-toc/md_toc/__main__.py\", line 34, in main\r\n result = args.func(args)\r\n File \"/home/vm/md-toc/md_toc/cli.py\", line 67, in write_toc\r\n list_marker=list_marker)\r\n File \"/home/vm/md-toc/md_toc/api.py\", line 288, in build_multiple_tocs\r\n list_marker))\r\n File \"/home/vm/md-toc/md_toc/api.py\", line 213, in build_toc\r\n raise TocDoesNotRenderAsCoherentList\r\nmd_toc.exceptions.TocDoesNotRenderAsCoherentList\r\n"]
[9.212276, "o", "\r\n"]
[10.213782, "o", "Try to parse a non coherent markdown file without checking for coherence...\r\n$ md_toc -c foo_noncoherent.md github\r\n"]
[10.399526, "o", "- [Hi](#hi)\r\n - [boo](#boo)\r\n"]
[10.411949, "o", "\r\n"]
[11.413447, "o", "Use stdin, no links and no indentation...\r\n$ cat foo.md | md_toc -l -i cmark -u '*'\r\n"]
[11.599078, "o", "* Hi\r\n* How are you? !!!\r\n* fine, thanks\r\n* Bye\r\n* Bye bye\r\n* boo\r\n"]
[11.611748, "o", "\r\n"]
[12.61327, "o", "Editing the file in-place. As you can see, code fence detection still needs to be implemented for redcarpet..\r\n$ md_toc -p foo.md redcarpet\r\n"]
[12.867298, "o", "$ cat foo.md\r\n"]
[12.867999, "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 - [Bye bye](#bye-bye)\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\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## Bye bye\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"]

130
asciinema/md_toc_asciinema_5_0_0_demo.sh

@ -0,0 +1,130 @@
#!/bin/bash
#
# md_toc_asciinema_3_1_0_demo.sh
#
# Copyright (C) 2019 frnmst (Franco Masotti) <franco.masotti@live.com>
# <franco.masotti@student.unife.it>
#
# 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 5 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 md_toc of this repository not the one installed on the system.
export PYTHONPATH='..'
TIMEOUT=1
printf "Running a demo to show some of md_toc's capabilities...\n"
printf "\n"
sleep ${TIMEOUT}
printf "$ md_toc -h\n"
md_toc -h
printf "\n"
sleep ${TIMEOUT}
cat <<-EOF > foo.md
# Hi
[](TOC)
hey
## How are you? !!!
## fine, thanks
### Bye
## Bye bye
\`\`\`python
# This is a code
# fence with comments that might represent ATX-style headings
# if not properly parsed
\`\`\`
bye
# boo
EOF
cat <<-EOF > foo_noncoherent.md
# Hi
### boo
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 "$ md_toc foo.md github\n"
md_toc foo.md github
printf "\n"
sleep ${TIMEOUT}
printf "Ordered list...\n"
printf "$ md_toc foo.md gitlab -o\n"
md_toc foo.md gitlab -o
printf "\n"
sleep ${TIMEOUT}
printf "No links...\n"
printf "$ md_toc -l foo.md github\n"
md_toc -l foo.md github
printf "\n"
sleep ${TIMEOUT}
printf "No links and no indentation...\n"
printf "$ md_toc -l -i foo.md github\n"
md_toc -l -i foo.md github
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 "$ md_toc foo_noncoherent.md github\n"
md_toc foo_noncoherent.md github
printf "\n"
sleep ${TIMEOUT}
printf "Try to parse a non coherent markdown file without checking for coherence...\n"
printf "$ md_toc -c foo_noncoherent.md github\n"
md_toc -c foo_noncoherent.md github
printf "\n"
sleep ${TIMEOUT}
printf "Use stdin, no links and no indentation...\n"
printf "$ cat foo.md | md_toc -l -i cmark -u '*'\n"
cat foo.md | md_toc -l -i cmark -u '*'
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 "$ md_toc -p foo.md redcarpet\n"
md_toc -p foo.md redcarpet
printf "$ cat foo.md\n"
cat foo.md
rm foo.md foo_noncoherent.md
Loading…
Cancel
Save