Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] [Windows release] Doesn't output any TOC, just a list of HTTP headers #41

Closed
focustense opened this issue Dec 9, 2022 · 9 comments
Labels

Comments

@focustense
Copy link

Describe the bug

I downloaded the Windows binary release to try out. It seems to succeed in converting the Markdown to HTML, but instead of printing a Markdown TOC, it prints a list of what appear to be HTTP response headers from GitHub.

To Reproduce

  1. Download and extract the Windows binary (I also had to give it an .exe extension)
  2. Run it on a local markdown file in the same directory (doesn't seem to be able to handle drive letters in paths, but relative paths are OK)

Example command:

gh-md-toc.exe Home.md --debug

I also tried using the --token argument with my GitHub token, did not see any difference.

The file being used does have headings in the form of #, ## and so on.

Expected behavior

Markdown TOC, like the examples in the readme.

Environment (please complete the following information):

  • OS: Windows 10
  • Version: 1.2.0

Additional context

Here's a complete copy/paste of the command line:

gh-md-toc.exe Home.md --debug

Table of Contents
=================

2022/12/08 20:26:46 Convert2HTML: start.
2022/12/08 20:26:46 IsRemoteFile: false
2022/12/08 20:26:46 Convert2HTML: local file: Home.md
Header: X-Commonmarker-Version=0.23.6
Header: Cache-Control=public, max-age=60, s-maxage=60
Header: X-Ratelimit-Resource=core
Header: Access-Control-Expose-Headers=ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset
Header: X-Content-Type-Options=nosniff
Header: X-Xss-Protection=0
Header: Content-Security-Policy=default-src 'none'
Header: Content-Type=text/html;charset=utf-8
Header: Vary=Accept
Header: X-Github-Media-Type=github.v3; format=json
Header: Access-Control-Allow-Origin=*
Header: X-Frame-Options=deny
Header: X-Github-Request-Id=<redacted>
Header: Server=GitHub.com
Header: Date=Fri, 09 Dec 2022 01:26:47 GMT
Header: Etag=<redacted>
Header: X-Github-Api-Version-Selected=2022-11-28
Header: X-Ratelimit-Reset=1670552242
Header: X-Ratelimit-Used=6
Header: Strict-Transport-Security=max-age=31536000; includeSubdomains; preload
Header: X-Ratelimit-Limit=60
Header: X-Ratelimit-Remaining=54
Header: Referrer-Policy=origin-when-cross-origin, strict-origin-when-cross-origin
2022/12/08 20:26:47 Convert2HTML: converted to html, size: 19997
2022/12/08 20:26:47 Convert2HTML: write html file: Home.md.debug.html
2022/12/08 20:26:47 Convert2HTML: done.
2022/12/08 20:26:47 GrabToc: start, html size: 19997
2022/12/08 20:26:47 GrabToc: matching ...
2022/12/08 20:26:47 GrabToc: processing groups ...
2022/12/08 20:26:47 Including starting frome level 0
2022/12/08 20:26:47 GrabToc: done.

Created by [gh-md-toc](https://github.com/ekalinin/github-markdown-toc.go)

I'd rather not post the entire converted HTML but I verified that it does have <h1>, <h2> etc. tags.

@focustense focustense added the bug label Dec 9, 2022
@focustense
Copy link
Author

I forgot to mention earlier, I get the same result if I run it against the HTTP link to the readme without TOC link posted in the readme. Both the link as-is, and the raw-file version. So I'm pretty confident it's not an issue with the markdown file itself.

@HappySeaFox
Copy link

I can confirm the error on my Windows machine:

>gh-md-toc FAQ.md

Table of Contents
=================

Header: X-Xss-Protection=0
Header: Date=Thu, 26 Jan 2023 08:44:22 GMT
Header: Content-Type=text/html;charset=utf-8
Header: X-Ratelimit-Reset=1674726065
Header: Strict-Transport-Security=max-age=31536000; includeSubdomains; preload
Header: X-Github-Request-Id=14B0:11526:274D2CB:28017FF:63D23D65
Header: X-Commonmarker-Version=0.23.7
Header: X-Github-Api-Version-Selected=2022-11-28
Header: X-Ratelimit-Used=4
Header: Access-Control-Allow-Origin=*
Header: Access-Control-Expose-Headers=ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource
, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset
Header: Referrer-Policy=origin-when-cross-origin, strict-origin-when-cross-origin
Header: Cache-Control=public, max-age=60, s-maxage=60
Header: X-Github-Media-Type=github.v3; format=json
Header: X-Ratelimit-Limit=60
Header: X-Ratelimit-Resource=core
Header: X-Frame-Options=deny
Header: X-Content-Type-Options=nosniff
Header: Content-Security-Policy=default-src 'none'
Header: Server=GitHub.com
Header: Vary=Accept
Header: Etag=W/"be9682e4ccedb91841c9d587b5c1c2ecd25f1bd1ebf9a9b4d804b09db3567ff9"
Header: X-Ratelimit-Remaining=56

Created by [gh-md-toc](https://github.com/ekalinin/github-markdown-toc.go)

@cgrindel
Copy link

@HappySeaFox @focustense I am not sure if it is the same issue. However, I have a pull request that fixes an issue with the TOC not generating properly due to the GitHub response having changed slightly. Can you give try building it and see if it fixes your issue?

@ekalinin
Copy link
Owner

ekalinin commented Feb 3, 2023

Hi,

Could you provide Home.md's source?

Just tried with README of the current project and it worked well:

❯ go run cmd/gh-md-toc/main.go README.md

Table of Contents
=================

* [github\-markdown\-toc](#github-markdown-toc)
* [Table of Contents](#table-of-contents)
* [Installation](#installation)
  * [Precompiled binaries](#precompiled-binaries)
  * [Compiling from source](#compiling-from-source)
  * [Go Install](#go-install)
  * [Homebew (Mac only)](#homebew-mac-only)
* [Tests](#tests)
* [Usage](#usage)
  * [STDIN](#stdin)
  * [Local files](#local-files)
  * [Remote files](#remote-files)
  * [Multiple files](#multiple-files)
  * [Combo](#combo)
  * [Starting Depth](#starting-depth)
  * [Depth](#depth)
  * [No escape](#no-escape)
  * [Github token](#github-token)
  * [Bash/ZSH auto\-complete](#bashzsh-auto-complete)
* [Alpine Linux](#alpine-linux)
* [LICENSE](#license)

Created by [gh-md-toc](https://github.com/ekalinin/github-markdown-toc.go)

❯ go version
go version go1.19.4 darwin/arm64

@HappySeaFox
Copy link

HappySeaFox commented Feb 3, 2023

Hi, FAQ: https://github.com/HappySeaFox/sail/blob/master/FAQ.md

Version is 1.2.0 from the releases page.

@ekalinin
Copy link
Owner

ekalinin commented Feb 3, 2023

@HappySeaFox Could you, please, try 1.2.1 version I just released:

@HappySeaFox
Copy link

Sure, I can try. I'm not at home currently, so it can take a couple of days.

@HappySeaFox
Copy link

Yeah, 1.2.1 works fine!

@ekalinin
Copy link
Owner

ekalinin commented Feb 5, 2023

Yeah, 1.2.1 works fine!

Great! Thank you very much!

@ekalinin ekalinin closed this as completed Feb 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants