Skip to content

Conversation

@butschster
Copy link
Collaborator

@butschster butschster commented Mar 16, 2025

This PR introduces the ability to define modifiers at the document level that apply to all compatible sources within that document.

Problem

Previously, modifiers could only be defined at the source level, requiring repetition when the same modifier needed to be applied to multiple sources within a document.

Solution

Implemented an immutable ModifiersApplier system that:

  • Allows documents to have their own set of modifiers
  • Passes these modifiers to all source fetchers during compilation
  • Combines document-level and source-level modifiers when applicable
  • Applies modifiers to content after fetching

Example Usage

{
  "documents": [
    {
      "description": "API Documentation",
      "outputPath": "docs/api.md",
      "modifiers": ["php-signature"],
      "sources": [
        {
          "type": "file",
          "sourcePaths": ["src/Api"],
          "filePattern": "*.php"
        }
      ]
    }
  ]
}

Add support for modifier aliases in configuration

This PR adds support for defining and using modifier aliases in the configuration. This feature allows users to define common modifier configurations once and reference them by name, reducing duplication in the configuration.

Problem

Currently, users need to repeat the same modifier configurations across multiple documents or sources, leading to duplication and maintenance challenges.n

Example Usage

Users can now define modifier aliases in their configuration:

{
  "settings": {
    "modifiers": {
      "api-docs": {
        "name": "php-content-filter",
        "options": {
          "keep_doc_comments": false,
          "keep_method_bodies": false
        }
      }
    }
  },
  "documents": [
    {
      "description": "API Documentation",
      "outputPath": "docs/api.md",
      "sources": [
        {
          "type": "file",
          "sourcePaths": ["src/Api"],
          "modifiers": ["api-docs"]
        }
      ]
    }
  ]
}

butschster and others added 4 commits March 16, 2025 11:18
Implement document-level modifiers in addition to source-level modifiers. This allows applying modifiers to all compatible sources within a document.
@butschster butschster linked an issue Mar 16, 2025 that may be closed by this pull request
- Improve user experience by allowing reusable modifier configurations
@butschster butschster linked an issue Mar 16, 2025 that may be closed by this pull request
@butschster butschster added the enhancement New feature or request label Mar 16, 2025
@butschster butschster self-assigned this Mar 16, 2025
@butschster butschster merged commit 62b4ad1 into main Mar 16, 2025
8 checks passed
@butschster butschster deleted the issue/44 branch March 16, 2025 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

modifiers on document (for all supported sourcres) modifier aliases

2 participants