Skip to content

Detect existing TOC and update it #40

@nojronatron

Description

@nojronatron

Describe the bug

Feature enhancement: If a well-formed (by definition of this tool) Table of Documents already exists, the tool could simply ask the user if they want to overwrite the existing one before doing so, or otherwise exit out.

To Reproduce

  1. Create a new Table of Contents following this Extension's lead e.g. ## Table of Contents ## etc.
  2. Open the Command Palette and select "Create Table of Contents".
  3. Toast appears with text "Table of Contents already exists.

Expected Requested behavior

  1. User has an existing Table of Contents that meets the Open ATX, Closed ATX, or Next-Line rule (see this tool's documentation).
  2. User opens Command Palette and chooses "Create Table of Contents".
  3. Tool notices existing, well formed Table of Contents and prompts user to decide whether to overwrite the existing one or not make any changes.
  4. User chooses "Overwrite" or "No" (examples, could be different text but same intentions)

User choice "Overwrite") select "overwrite" and the tool overwrites the existing link fragments and generates a new set of link fragments (as expected).

User choice "No") Tool exits and displays a toast with a message like "Existing Table of Contents Retained."

Screenshots

n/a

Environment

n/a

Additional context

Could enhance the extension and interactivity for a more joyful UX.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions