Skip to content

Support XDG base directory specification for user configuration resolution #400

@rpdelaney

Description

@rpdelaney

Context

In #263 we added support for .mdformat.toml as an on-disk configuration file.

I would like to revisit the possibility of also reading fall-back configuration from $XDG_CONFIG_HOME.

platformdirs provides tools that can assist with this in a cross-platform way.

Proposal

The best approach I could think of is to start with the lowest priority configuration files first and work down, applying changes as we go. That way, defaults can be over-ridden by $XDG_CONFIG_HOME/mdformat.toml (or whatever we call it) but project-specific settings still take priority over any other on-disk configuration.

Descending priority would look something like (subject to negotiation):

  1. $HOME/.mdformat.toml
  2. $HOME/.config/mdformat.toml
  3. $XDG_CONFIG_HOME/mdformat.toml
  4. /.mdformat.toml
  5. /path/to/repo/.mdformat.toml

Tasks and updates

  • Confirm general strategy for config resolution
  • Confirm prioritization of different paths where we might find a config
  • Implement!

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