You are here

README.txt in Toc.js 8

Same filename and directory in other branches
  1. 2.0.x README.txt
CONTENTS OF THIS FILE
---------------------

 * Introduction
 * Requirements
 * Recommended modules
 * Installation
 * Configuration
 * Troubleshooting
 * FAQ
 * Maintainers

INTRODUCTION
------------

Toc.js module integrate TOC.js library into Drupal.

TOC.js is a jQuery plugin which automatically generate a table of contents for
your page. This module provide :

* An extra field available on node. This extra field display a Toc based on the
  settings of the node type.
* A block which can generate a Toc for any kind of page.

The Table of content is generated from the front end and allow :
  - Smmoth scrolling when jumping to heading
  - Highlight on scroll
  - Custom configuration for the container and the heading you want to target.

You can put as many Toc, with specific settings, as you need on one page.

REQUIREMENTS
------------

Toc.js module works with the jquery TOC.js library.

Required modules

 * node
 * block

SIMILAR MODULES
-------------------

 * The TOC API module provide the API to generate a TOC based on
   configuration entity type. TOC are generate on the backend.
 * The TOC filter module use the TOC API and can generate a TOC for a body field
   using the a filter on the body.
 * The TOC API Node use the TOC API module and generate a TOC on a whole node,
    always from the backend.
 * TOC Formatter set a TOC to the top of a text area field. This module uses
   PHP DOMDocument to manipulate content.
 * See the Comparison of Table of Contents / TOC modules
   https://www.drupal.org/node/2278811

Toc.js have a more lightweight approch than theses modules and delegate the most
part of the work to the awesome TOC.js jquery library, which comes with natively
options (selectors, containers, smooth scrolling, highlight on scroll).

INSTALLATION
------------

 * Install as you would normally install a contributed Drupal module. See:
   https://www.drupal.org/docs/8/extending-drupal-8/installing-modules
   for further information.
 * Download the library TOC.js
   (https://github.com/jgallen23/toc/tree/greenkeeper/update-all)
   and place the following file toc.min.js under the libraries/toc folder.
   The complete path of shuffle file attended is :
   - libraries/toc/toc.min.js
 * Check the status report
 * You can use composer to download and install the jQuery library. For this you
   have to add to your composer.json file the following repository:

 "repositories": [
         {
             "type": "composer",
             "url": "https://packages.drupal.org/8"
         },
 		{
             "type": "package",
             "package": {
                 "name": "toc/toc",
                 "version": "v0.3.2",
                 "type": "drupal-library",
                 "dist": {
                     "url": "https://raw.githubusercontent.com/jgallen23/toc/greenkeeper/update-all/dist/toc.min.js",
                     "type": "file"
                 }
             }
         }
     ],

 And "toc/toc": "*" in the require part.

CONFIGURATION
-------------

For the Toc.js Block
  * Place a Toc.js block and configure the Toc settings. Toc settings are the
    same that for node. See below.

For node
  * Enable the Table of content on the content type you want place a TOC
  * configure the Toc settings
  * In the manage display page configuration of this content type, place the
  TOC extra field in the region you content to display it, in any view mode you
  need.

The Toc.js settings available are :

  * Title : the title displayed on top of the Toc list.
    Default: "Table of contents".
  * Selectors : the elements to use as headings. Each element separated by
    comma. Default: "h2,h3".
  * container : Element to find all selectors in. Default: ".node".
  * Prefix : Prefix for anchor tags and class names. Default: "toc".
  * List type: The HTML list type to use (ul or ol).
  * Back to top: Add back to top link on heading.
  * Bck to top label: The back to top link label.
  * Smooth scrolling : Enable or disable smooth scrolling on click.
  * ScrollTo offset : Offset to trigger with smooth scrolling enabled.
  * Highlight on scroll : Add a class to heading that is currently in focus.
  * Highlight offset : Offset to trigger the next headline.

This module contains a sub module "Toc.js per node" which permit to
enable/disable the Toc per node. Once this sub module enabled, you must allow
the override per node for the content type.

You have a new Toc.js settings :
  * Permit to enable/disable toc per node

Once this option checked, you can for each node disable the TOC generated.


TROUBLESHOOTING
---------------


FAQ
---


MAINTAINERS
-----------

Current maintainers:
 * flocondetoile - https://drupal.org/u/flocondetoile

File

README.txt
View source
  1. CONTENTS OF THIS FILE
  2. ---------------------
  3. * Introduction
  4. * Requirements
  5. * Recommended modules
  6. * Installation
  7. * Configuration
  8. * Troubleshooting
  9. * FAQ
  10. * Maintainers
  11. INTRODUCTION
  12. ------------
  13. Toc.js module integrate TOC.js library into Drupal.
  14. TOC.js is a jQuery plugin which automatically generate a table of contents for
  15. your page. This module provide :
  16. * An extra field available on node. This extra field display a Toc based on the
  17. settings of the node type.
  18. * A block which can generate a Toc for any kind of page.
  19. The Table of content is generated from the front end and allow :
  20. - Smmoth scrolling when jumping to heading
  21. - Highlight on scroll
  22. - Custom configuration for the container and the heading you want to target.
  23. You can put as many Toc, with specific settings, as you need on one page.
  24. REQUIREMENTS
  25. ------------
  26. Toc.js module works with the jquery TOC.js library.
  27. Required modules
  28. * node
  29. * block
  30. SIMILAR MODULES
  31. -------------------
  32. * The TOC API module provide the API to generate a TOC based on
  33. configuration entity type. TOC are generate on the backend.
  34. * The TOC filter module use the TOC API and can generate a TOC for a body field
  35. using the a filter on the body.
  36. * The TOC API Node use the TOC API module and generate a TOC on a whole node,
  37. always from the backend.
  38. * TOC Formatter set a TOC to the top of a text area field. This module uses
  39. PHP DOMDocument to manipulate content.
  40. * See the Comparison of Table of Contents / TOC modules
  41. https://www.drupal.org/node/2278811
  42. Toc.js have a more lightweight approch than theses modules and delegate the most
  43. part of the work to the awesome TOC.js jquery library, which comes with natively
  44. options (selectors, containers, smooth scrolling, highlight on scroll).
  45. INSTALLATION
  46. ------------
  47. * Install as you would normally install a contributed Drupal module. See:
  48. https://www.drupal.org/docs/8/extending-drupal-8/installing-modules
  49. for further information.
  50. * Download the library TOC.js
  51. (https://github.com/jgallen23/toc/tree/greenkeeper/update-all)
  52. and place the following file toc.min.js under the libraries/toc folder.
  53. The complete path of shuffle file attended is :
  54. - libraries/toc/toc.min.js
  55. * Check the status report
  56. * You can use composer to download and install the jQuery library. For this you
  57. have to add to your composer.json file the following repository:
  58. "repositories": [
  59. {
  60. "type": "composer",
  61. "url": "https://packages.drupal.org/8"
  62. },
  63. {
  64. "type": "package",
  65. "package": {
  66. "name": "toc/toc",
  67. "version": "v0.3.2",
  68. "type": "drupal-library",
  69. "dist": {
  70. "url": "https://raw.githubusercontent.com/jgallen23/toc/greenkeeper/update-all/dist/toc.min.js",
  71. "type": "file"
  72. }
  73. }
  74. }
  75. ],
  76. And "toc/toc": "*" in the require part.
  77. CONFIGURATION
  78. -------------
  79. For the Toc.js Block
  80. * Place a Toc.js block and configure the Toc settings. Toc settings are the
  81. same that for node. See below.
  82. For node
  83. * Enable the Table of content on the content type you want place a TOC
  84. * configure the Toc settings
  85. * In the manage display page configuration of this content type, place the
  86. TOC extra field in the region you content to display it, in any view mode you
  87. need.
  88. The Toc.js settings available are :
  89. * Title : the title displayed on top of the Toc list.
  90. Default: "Table of contents".
  91. * Selectors : the elements to use as headings. Each element separated by
  92. comma. Default: "h2,h3".
  93. * container : Element to find all selectors in. Default: ".node".
  94. * Prefix : Prefix for anchor tags and class names. Default: "toc".
  95. * List type: The HTML list type to use (ul or ol).
  96. * Back to top: Add back to top link on heading.
  97. * Bck to top label: The back to top link label.
  98. * Smooth scrolling : Enable or disable smooth scrolling on click.
  99. * ScrollTo offset : Offset to trigger with smooth scrolling enabled.
  100. * Highlight on scroll : Add a class to heading that is currently in focus.
  101. * Highlight offset : Offset to trigger the next headline.
  102. This module contains a sub module "Toc.js per node" which permit to
  103. enable/disable the Toc per node. Once this sub module enabled, you must allow
  104. the override per node for the content type.
  105. You have a new Toc.js settings :
  106. * Permit to enable/disable toc per node
  107. Once this option checked, you can for each node disable the TOC generated.
  108. TROUBLESHOOTING
  109. ---------------
  110. FAQ
  111. ---
  112. MAINTAINERS
  113. -----------
  114. Current maintainers:
  115. * flocondetoile - https://drupal.org/u/flocondetoile