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

--no-firsth1 option causes "undefined" words to appear in the toc #168

Open
trusktr opened this issue Feb 3, 2021 · 3 comments
Open

--no-firsth1 option causes "undefined" words to appear in the toc #168

trusktr opened this issue Feb 3, 2021 · 3 comments
Labels

Comments

@trusktr
Copy link

trusktr commented Feb 3, 2021

Example without the option:

$ npx markdown-toc README.md
- [my-project](#my-project)
- [Getting started](#getting-started)
- [Usage](#usage)
  * [Example](#example)
- [API](#api)
  * [The `` element](#the--element)
    + [Attributes/Properties](#attributesproperties)
    + [Methods](#methods)
    + [Events](#events)
- [More Examples](#more-examples)
  * [Usage with [`@lume/element`](https://github.com/lume/element)](#usage-with-lumeelementhttpsgithubcomlumeelement)
  * [Usage with React](#usage-with-react)
  * [Usage with React and TypeScript](#usage-with-react-and-typescript)
  * [Usage with other view libs/frameworks](#usage-with-other-view-libsframeworks)
- [Development](#development)
  * [Test it in the examples](#test-it-in-the-examples)
  * [Test it in another project](#test-it-in-another-project)

Example with the option:

$ npx markdown-toc --no-firsth1 README.md
undefined [Getting started](#getting-started)
undefined [Usage](#usage)
- [Example](#example)
undefined [API](#api)
- [The `` element](#the--element)
  * [Attributes/Properties](#attributesproperties)
  * [Methods](#methods)
  * [Events](#events)
undefined [More Examples](#more-examples)
- [Usage with [`@lume/element`](https://github.com/lume/element)](#usage-with-lumeelementhttpsgithubcomlumeelement)
- [Usage with React](#usage-with-react)
- [Usage with React and TypeScript](#usage-with-react-and-typescript)
- [Usage with other view libs/frameworks](#usage-with-other-view-libsframeworks)
undefined [Development](#development)
- [Test it in the examples](#test-it-in-the-examples)
- [Test it in another project](#test-it-in-another-project)
@doowb doowb added the bug label Feb 4, 2021
@doowb
Copy link
Collaborator

doowb commented Feb 4, 2021

@trusktr thank you for the issue and the example. Will you also include the source README.md to help determine where the bug is occurring?

@nicobo
Copy link

nicobo commented Mar 18, 2021

It happens only when the file contains <!-- toc -->. Sample file : README.md.txt.

Without <!-- toc --> :

mycomputer$ markdown-toc --no-firsth1 README.md 
- [About](#about)
- [Requirements & installation](#requirements--installation)
  * [Python package installation](#python-package-installation)
  * [Installation from source](#installation-from-source)
  * [Docker usage](#docker-usage)
...

With <!-- toc --> :

mycomputer$ markdown-toc --no-firsth1 README.md 
undefined [Requirements & installation](#requirements--installation)
- [Python package installation](#python-package-installation)
- [Installation from source](#installation-from-source)
- [Docker usage](#docker-usage)
...

@nicobo
Copy link

nicobo commented Mar 18, 2021

Also it's probably a duplicate of #42 and #131

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

3 participants