Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add processors bundle configuration #169

Merged
merged 1 commit into from
Mar 1, 2023
Merged

Conversation

ogizanagi
Copy link
Member

@ogizanagi ogizanagi commented Feb 22, 2023

Allowing to tweaks the defaults and/or disable some of the built-in processors

Fixes #90

Default config

$> symfony console debug:config stenope processor

Current configuration for "stenope.processors"
==============================================

enabled: true
content_property: content
slug:
    enabled: true
    property: slug
assets:
    enabled: true
resolve_content_links:
    enabled: true
external_links:
    enabled: true
anchors:
    enabled: true
    selector: 'h1, h2, h3, h4, h5'
html_title:
    enabled: true
    property: title
html_elements_ids:
    enabled: true
code_highlight:
    enabled: true
toc:
    enabled: true
    property: tableOfContent
    min_depth: 2
    max_depth: 6
last_modified:
    enabled: true
    property: lastModified
    git:
        enabled: true
        path: git

Config reference

$> symfony console config:dump-ref stenope processors
# Default configuration for extension with alias: "stenope" at path "processors"

# Built-in processors configuration. Disable to unregister all of the preconfigured processors.
processors:
    enabled:              true

    # Key used by default by every processors to access and modify the main text of your contents
    content_property:     content
    slug:
        enabled:              true

        # Inject the content slug in a property of your model. See SlugProcessor.
        property:             slug

    # Attempt to resolve local assets URLs using the Asset component for images and links. See AssetsProcessor.
    assets:
        enabled:              true

    # Attempt to resolve relative links between contents using the route declared in config. See ResolveContentLinksProcessor.
    resolve_content_links:
        enabled:              true

    # Automatically add target="_blank" to external links. See HtmlExternalLinksProcessor.
    external_links:
        enabled:              true

    # Automatically add anchor links to elements with an id. See HtmlAnchorProcessor.
    anchors:
        enabled:              true
        selector:             'h1, h2, h3, h4, h5'

    # Extract a content title from a HTML property by using the first available h1 tag. See ExtractTitleFromHtmlContentProcessor.
    html_title:
        enabled:              true

        # Property where to inject the title in your model
        property:             title

    # Add ids to titles, images and other HTML elements in the content. See HtmlIdProcessor.
    html_elements_ids:
        enabled:              true

    # Enabled the syntax highlighting for code blocks using Prism.js. See CodeHighlightProcessor.
    code_highlight:
        enabled:              true

    # Build a table of content from the HTML titles. See TableOfContentProcessor.
    toc:
        enabled:              true

        # Property used to configure and inject the TableOfContent object in your model
        property:             tableOfContent
        min_depth:            2
        max_depth:            6

    # Attempt to fetch and populate the last modified date to a property. See LastModifiedProcessor.
    last_modified:
        enabled:              true

        # Property where to inject the last modified date of the content according to its provider.
        property:             lastModified

        # Whether to attempt using Git to get the last modified date of the content according to commits.
        git:
            enabled:              true

            # Git binary path to use
            path:                 git

Allowing to tweaks the defaults and/or disable some of the built-in
processors
Copy link
Collaborator

@Tom32i Tom32i left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome work, love it! 👍

@ogizanagi ogizanagi merged commit 22b831e into master Mar 1, 2023
@ogizanagi ogizanagi deleted the processors-configuration branch March 1, 2023 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Configure/disable default processors
2 participants