Add support for document-level configuration parameters in fence markers

Summary

Extend the fence marker system to support additional document-level configuration parameters beyond the currently implemented max-depth.

Current State

The plugin currently supports only one document-level parameter:

<!-- mtoc-start max-depth=2 -->

This allows documents to override the global headings.max_depth configuration.

Motivation

Users often need to customize TOC generation for specific documents without modifying their global configuration. Common scenarios include:

  • Documents hosted on different platforms (GitHub vs GitLab) requiring different link formats
  • Documents with different formatting standards (indentation, markers)
  • Documents with specific headings to exclude
  • Mixed repositories with varying style requirements

Proposed Configuration Parameters

High Priority

  1. link-format - Override link formatting style

    • Example: <!-- mtoc-start link-format=gitlab -->
    • Values: gfm, gitlab, bitbucket, generic
  2. markers - Override list markers

    • Example: <!-- mtoc-start markers=1. -->
    • Values: *, -, +, 1., or comma-separated for cycling
  3. exclude - Document-specific heading exclusion patterns

    • Example: <!-- mtoc-start exclude=^TOC$,^Table.*Contents$ -->
    • Values: Comma-separated Lua patterns

Medium Priority

  1. before-toc - Include headings before TOC location

    • Example: <!-- mtoc-start before-toc=true -->
    • Values: true, false
  2. indent-size - Override indentation size

    • Example: <!-- mtoc-start indent-size=4 -->
    • Values: Integer
  3. cycle-markers - Enable marker cycling

    • Example: <!-- mtoc-start markers=*,+,- cycle-markers=true -->
    • Values: true, false

Low Priority

  1. padding-lines - Blank lines before/after TOC
    • Example: <!-- mtoc-start padding-lines=0 -->
    • Values: Integer

Implementation Notes

The existing max-depth implementation (lua/mtoc/toc.lua:9-15, 229-244) provides a good pattern:

  1. Create parser functions like parse_max_depth() for each parameter
  2. Parse all parameters in find_fences() and return them
  3. Pass parameters to gen_toc_list() to override config values
  4. Use pattern: value = fence_value or config.opts.section.value

Example multi-parameter fence:

<!-- mtoc-start max-depth=3 link-format=gitlab markers=1. indent-size=4 -->

Related Code

  • lua/mtoc/toc.lua:9-15 - parse_max_depth() function
  • lua/mtoc/toc.lua:229-244 - find_fences() function
  • lua/mtoc/toc.lua:284-387 - gen_toc_list() function
  • lua/mtoc/config.lua - Configuration defaults

Acceptance Criteria

  • Support multiple parameters in a single fence marker
  • Parameters override global configuration without modifying it
  • Maintain backward compatibility with existing max-depth parameter
  • Update documentation with examples
  • Add tests for parameter parsing