Git Product home page Git Product logo

danger-toc's Introduction

danger-toc

A plugin for danger.systems that makes sure your project’s README.md has a TOC.

Gem Version Build Status

Table of Contents

Installation

Add danger-toc to your Gemfile.

gem 'danger-toc', '~> 0.1'

Add toc.check to your Dangerfile. Make a pull request and see this plugin in action.

Usage

Methods and settings from this plugin are available in your Dangerfile under the toc namespace.

toc.files

List of files to ensure TOC in, default is README.md.

config.files = [ 'README.md', 'DEV.md' ]

toc.header

The Table of Contents header, without #, default is Table of Contents.

config.header = 'Custom Table of Contents'

toc.check!

Run all checks.

Contributing

See CONTRIBUTING.

Copyright

Copyright (c) Daniel Doubrovkine, 2017-2019

MIT License, see LICENSE for details.

danger-toc's People

Contributors

dblock avatar mr-dxdy avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

danger-toc's Issues

Support other formats than GFM

Danger-toc can be used outside of Github. We now default to the GFM parser, support other Kramdown parsers, notably the default markdown. Coming from #7.

Underscore in section name

Example:

require 'kramdown'
require 'html/pipeline'

text = <<TEXT
# Prelude

The quick brown fox jumps over the lazy dog.

## Table of Contents

- [What_is_this?](#what_is_this)

## What_is_this?

The quick brown fox jumps over the lazy dog.
TEXT

puts Kramdown::Document.new(text).to_html

# ...
# <h2 id="whatisthis">What_is_this?</h2>
# ...

MarkdownPipeline = HTML::Pipeline.new [
  HTML::Pipeline::MarkdownFilter,
  HTML::Pipeline::TableOfContentsFilter
]

result = MarkdownPipeline.call text
puts result[:output].to_s

# ...
# <h2>
#   <a id="what_is_this" class="anchor" href="#what_is_this" aria-hidden="true">
#      <span aria-hidden="true" class="octicon octicon-link"></span>
#    </a>What_is_this?
# </h2>

Two different anchors: whatisthis and what_is_this.
Github uses anchor what_is_this.
How the gem "danger-toc" should behave in this case?

@dblock, i need your help.

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.