Giter Site home page Giter Site logo

dashaluna / hm-content-toc Goto Github PK

View Code? Open in Web Editor NEW
9.0 9.0 6.0 2.62 MB

WordPress plugin. Creates content TOC (table of contents) for specified header elements from the current post/page content. Adds anchor elements in the content just before the matched headers.

License: GNU General Public License v2.0

PHP 93.03% Shell 6.09% JavaScript 0.88%

hm-content-toc's People

Contributors

dashaluna avatar johnbillion avatar roborourke avatar tcrsavage avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

hm-content-toc's Issues

TOC's HTML markup

@sanchothefat Hey, wanted your feedback on TOC HTML structure. Currently I have the following:

<ul id="content-toc">
  <li><a href="#heading-1">Header 2.1</a></li>
  <li><a href="#heading-2">Header 2.2</a></li>
  <li><a href="#heading-3">Header 2.3</a></li>
  <li><a href="#heading-4">Header 3.1</a></li>
  <li><a href="#heading-5">Header 6</a></li>
</ul>

Can I improve it in any way? I was gonna add a class to either li or a with the header element, for example class="header-h2", so it can be targeted for styling. But then thought I'd ask your advice in general :) Thanks!

Exclude headings

Hello, I am working on a project where we don't all of headings add to the TOC as they are not related.

The simple text looks like this. When the shortcode is processed it outputs a title.

[testshortcode header="Test Heading"]

<h2>1. Allgemeine Voraussetzungen</h2>
<h2>2. Fördertätigkeit</h2>
<h3>2.1 Werkbeiträge</h3>

My initial idea was to add a filter so that I could remove heading from $post_content before it was processed for heading. What do you think of adding a filter to line 150 of class-content-toc.php ?

Do you have another idea how I could exclude certain headings?

Allow elements with attributes

At the moment regex works with simple elements, for example div, h2, h3 and so on. Allow elements to be matched with attributes, for example h2 class="section"

New Name & better tags

Whilst the current name does decribe the plugin I think it could be more user friendly.

I have a couple of issues with the current name:

  • Do people know what TOC means?
  • Content is mentioned twice.

Here's some suggestions

  • Inline Table of Contents
  • Table of Contents by Human Made
  • Digest
  • Compendium

Here's some other plugins that show up when searching for Table of Contents: https://wordpress.org/plugins/search.php?q=table+of+contents

Shortcake doesn't allow markup in description

So the description text for the Header Elements is Comma separated list of HTML element names to generate TOC for. For example, default elements are: . NOTE: use <code>h2</code>, not <code>&lt;h2&gt;</code>.

screen shot 2015-09-23 at 11 14 40

TOC link text needs any html removed

Currently the TOC links show escaped HTML if a heading contains a link for example.

Ideally the link text taken from the tag should just show the text. You can use the strip_tags() function on output to do this.

Instantiate plugin from itself

From @tcrsavage feedback
Probably put the class in it's own class file, then the main plugin file would just contain the plugin doc block, include the class file and instantiate the class.

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.