Git Product home page Git Product logo

toc's People

Contributors

0xflotus avatar chrisgoffinet avatar hikhvar avatar jceb avatar joemiller avatar ycd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

toc's Issues

Skipping levels keeps the indentation as they weren't skipped

When you generate a ToC skipping a level the generated ToC keeps the indentation for the bullet as the skipped headers would be there producing a wrong rendering in GH.

Example

Original Markdown file (example.md):

# Header 1

<!-- toc -->

## Header 2.1

## Header 2.2

### Header 2.2.3.1

### Header 2.2.3.2

Result of executing toc -p example.md:

# Header 1

<!-- toc -->
- [Header 1](#header-1)
    * [Header 2.1](#header-21)
    * [Header 2.2](#header-22)
        * [Header 2.2.3.1](#header-2231)
        * [Header 2.2.3.2](#header-2232)

<!-- tocstop -->

## Header 2.1

## Header 2.2

### Header 2.2.3.1

### Header 2.2.3.2

It's rendered as
image

Result of executing toc -p example.md -s 1:

# Header 1

<!-- toc -->
    * [Header 2.1](#header-21)
    * [Header 2.2](#header-22)
        * [Header 2.2.3.1](#header-2231)
        * [Header 2.2.3.2](#header-2232)

<!-- tocstop -->

## Header 2.1

## Header 2.2

### Header 2.2.3.1

### Header 2.2.3.2

It's rendered as
image

[Fix] Write status messages to stderr instead.

Don’t write status messages to stdout.

  • Currently using pipes with --append=false writes
   ~$ toc -p <(curl https://raw.githubusercontent.com/ycd/toc/main/README.md 2>&-) --append=false > toc.md
   ~$ cat toc.md

    - [Table of Contents](#table-of-contents)
        * [Usage](#usage)
        * [Installation](#installation)
            * [Packages](#packages)
            * [Downloads](#downloads)
            * [Installation from source](#installation-from-source)
                * [Unix/Linux](#unixlinux)
        * [Contributing](#contributing)
        * [Licence](#licence)
    βœ” Table of contents generated successfully.
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ <- This shouldn't be included

request: publish docker images

It would be helpful if toc was available as a docker image. I think a simple scratch container with a static binary in it would be sufficient.

I'd offer a PR to your goreleaser.yaml but I can't really test it and don't know which docker registry you would prefer.

incorrect go.mod path

Looking over go.mod its currently set to toc. This should be changed to github.com/ycd/toc so this tool can be installed using:

$ go install github.com/ycd/toc

It currently fails with this:

go install: github.com/ycd/toc@latest: github.com/ycd/[email protected]: parsing go.mod:
	module declares its path as: toc
	        but was required as: github.com/ycd/toc

[Feature] Add support for skipping first n headers

Add support for specifying skip option for first n header.

-s <int>
--skip <int>

Using the --skip 1 flag for the markdown file below should preserve this output:

Markdown file:

# Test

# Actual header

# Actual header two

Expected output

- [Actual header](#actual-header)
- [Actual header two](#actual-header-two)



underscore is kept in links

Used this and found a small bug only relevant to headings containing _.

This is the current output:

- [ISSUE_TEMPLATE.md](#issue-templatemd)
- [PULL_REQUEST_TEMPLATE.md](#pull-request-templatemd)

These are the ones github uses for its links:

- [ISSUE_TEMPLATE.md](#issue_templatemd)
- [PULL_REQUEST_TEMPLATE.md](#pull_request_templatemd)

Or is there another standard which GitHub does not comply to?

Minor errors in README.md

$ git clone https://github.com/ycd/toc 
$ cd ycd

should say

$ git clone https://github.com/ycd/toc 
$ cd toc

because git clones to a directory called "toc".

Likewise

# May require you to use sudo
$ go build .
$ cp toc /usr/local/toc

should say

$ go build .
# May require you to use sudo
$ cp toc /usr/local/bin

because the go build . step writes to a place that the user can write to, but "/usr/local/bin" is not where a user can usually write to. "/usr/local" isn't in most people's $PATH but "/usr/local/bin" is.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.