github-markdown-toc
github-markdown-toc copied to clipboard
[ BUG ] Insert does not work on MacOS 10.15.7 zsh
Describe the bug
When running gh-md-toc --insert ./Readme.md i get
You don't have <!--ts--> or <!--te--> in your file...exiting
It seems this comes down to this command not working
kyle@Emilys-MacBook-Pro kubectl-opslevel % grep -Fxq "<\!--ts-->" Readme.md
but this one does
kyle@Emilys-MacBook-Pro kubectl-opslevel % grep -F "<\!--ts-->" Readme.md
<!--ts-->
Notice the arguments to grep. I'm using zsh (the macos native shell now - not sure if that has an impact)
on 11.5.2 i am now getting blank output all the sudden :(
Could you provide a full example? Like:
➜ cat README.md
gh-md-toc
=========
gh-md-toc — is for you if you **want to generate TOC** for README.md or
GitHub's wiki page and **don't want to install any additional software**.
It's my try to fix a problem:
...
➜ ./gh-md-toc README.md
Table of Contents
=================
* [gh-md-toc](#gh-md-toc)
* [Table of contents](#table-of-contents)
* [Installation](#installation)
* [Usage](#usage)
* [STDIN](#stdin)
* [Local files](#local-files)
* [Remote files](#remote-files)
* [Multiple files](#multiple-files)
* [Combo](#combo)
* [Auto insert and update TOC](#auto-insert-and-update-toc)
* [GitHub token](#github-token)
* [TOC generation with Github Actions](#toc-generation-with-github-actions)
* [Tests](#tests)
* [Dependency](#dependency)
* [Docker](#docker)
* [Local](#local)
* [Public](#public)
➜ ./gh-md-toc --version
0.7.0
os: Ubuntu 18.04.5 LTS
kernel: Linux version 5.13.9-xanmod1 (root@mascote) (gcc-11 (Debian 11.2.0-1) 11.2.0, GNU ld (GNU Binutils for Debian) 2.35.2) #0~git20210808.d88fe64 SMP PREEMPT Sun Aug 8 15:57:07 UTC 2021
shell: zsh 5.4.2 (x86_64-ubuntu-linux-gnu)
curl : curl 7.58.0 (x86_64-pc-linux-gnu) libcurl/7.58.0 OpenSSL/1.1.1 zlib/1.2.11 libidn2/2.0.4 libpsl/0.19.1 (+libidn2/2.0.4) nghttp2/1.30.0 librtmp/2.3
wget : GNU Wget 1.19.4 built on linux-gnu.
grep : grep (GNU grep) 3.1
awk : GNU Awk 4.1.4, API: 1.1 (GNU MPFR 4.0.1, GNU MP 6.1.2)
sed : sed (GNU sed) 4.4
having same problem on ubuntu 20.04
➜ github-markdown-toc git:(master) cat tests/test_plussign.md
# C vs C++
Blabla...
➜ github-markdown-toc git:(master) ./gh-md-toc tests/test_plussign.md
Table of Contents
=================
<!-- Created by https://github.com/ekalinin/github-markdown-toc -->
➜ github-markdown-toc git:(master) ./gh-md-toc --version
0.8.0
os: Linux
arch: x86_64
kernel: 6.0.0-060000-generic
shell: zsh 5.8 (x86_64-ubuntu-linux-gnu)
curl : curl 7.68.0 (x86_64-pc-linux-gnu) libcurl/7.68.0 OpenSSL/1.1.1f zlib/1.2.11 brotli/1.0.7 libidn2/2.2.0 libpsl/0.21.0 (+libidn2/2.2.0) libssh/0.9.3/openssl/zlib nghttp2/1.40.0 librtmp/2.3
wget : GNU Wget 1.20.3 built on linux-gnu.
grep : grep (GNU grep) 3.4
awk : GNU Awk 5.0.1, API: 2.0 (GNU MPFR 4.0.2, GNU MP 6.2.0)
sed : sed (GNU sed) 4.7
Same here, Mac OS X Ventura or debian rodete
debian:
0.8.0
os: Linux
arch: x86_64
kernel: 6.3.11-1rodete2-amd64
shell: GNU bash, version 5.2.15(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
curl : curl 7.88.1 (x86_64-pc-linux-gnu) libcurl/7.88.1 OpenSSL/3.0.10 zlib/1.2.13 brotli/1.0.9 zstd/1.5.5 libidn2/2.3.3 libpsl/0.21.2 (+libidn2/2.3.3) libssh2/1.11.0 nghttp2/1.54.0 librtmp/2.3 OpenLDAP/2.5.13
wget : GNU Wget 1.21.3 built on linux-gnu.
grep : grep (GNU grep) 3.8
awk : GNU Awk 5.2.1, API 3.2, PMA Avon 8-g1, (GNU MPFR 4.2.0, GNU MP 6.2.1)
sed : sed (GNU sed) 4.9
Mac:
0.8.0
os: Darwin
arch: arm64
kernel: 22.6.0
shell: GNU bash, version 3.2.57(1)-release (arm64-apple-darwin22)
Copyright (C) 2007 Free Software Foundation, Inc.
curl : curl 8.1.2 (x86_64-apple-darwin22.0) libcurl/8.1.2 (SecureTransport) LibreSSL/3.3.6 zlib/1.2.11 nghttp2/1.51.0
wget : GNU Wget 1.21.4 built on darwin22.4.0.
grep : grep (BSD grep, GNU compatible) 2.6.0-FreeBSD
awk : awk version 20200816
sed : sed: illegal option -- -
usage: sed script [-Ealnru] [-i extension] [file ...]
sed [-Ealnu] [-i extension] [-e script] ... [-f script_file] ... [file ...]