Fabric configuration language

Fabric Configuration Language (FCL) serves as the core feature for Fabric, a powerful tool designed to streamline document generation. FCL enables users to express data requirements and template structures within configuration files using a lightweight syntax.

The document templates, defined in the configuration files, act as blueprints for consolidating data and creating Markdown documents. FCL empowers users to define, manage, and automate the document production process, delivering a sturdy and adaptable solution for content generation.

Fabric configuration files have the extension .fabric and contain configurations, data requirements, and content definitions. The Fabric configuration codebase may consist of many files and subdirectories.

Core concepts

Building upon the HashiCorp Configuration Language (HCL), Fabric language shares similarities with the Terraform Configuration Language and comprises two fundamental elements:

  • Blocks: serve as containers defining objects, such as configurations, data requirements, or content structures. Blocks always include a block type and may have zero or more labels.
  • Arguments assign values to names within blocks, facilitating the configuration process.
# Named data block:

data elasticsearch "alerts" {
    index = ".alerts-security.alerts-*"
    query_string = "kibana.alert.severity:critical"
}

<BLOCK-TYPE> <PLUGIN> "<BLOCK-NAME>" {
    <ARGUMENT> = <VALUE>
}

# Anonymous configuration block for a data plugin:
config data elasticsearch {
    cloud_id = "my-elastic-cloud-id"
    api_key = "my-elastic-cloud-api-key"
}

<CONFIG-LABEL> <BLOCK-TYPE> <PLUGIN> {
    <ARGUMENT> = <VALUE>
}

See Syntax for more details on the FCL syntax.

IDE support

Visual Studio Code

For those who use Visual Studio Code, we’ve created the vscode-fabric extension. This extension brings FCL syntax support, with syntax highlighting for embedded JQ in Fabric templates, making it easier to create, understand, and maintain FCL files.

Visual Studio Code support for Fabric Configuration Language with syntax highlighting for embedded languages

You can find installation details in the extension’s README.

Neovim

For the Neovim users, we’ve developed fabric.nvim, a Neovim plugin that adds syntax support for FCL. The plugin uses a FCL-specific tree-sitter dialect for tree-sitter-hcl parser.

This plugin not only improves the readability of the template files but also brings code highlighting to embedded JQ and Go-templates code blocks. Whether you’re writing complex JQ queries or template blocks, Neovim now provides clear color-coded feedback to make your work smoother and faster.

Neovim support for Fabric Configuration Language with syntax highlighting for embedded
languages

For installation instructions, check out the plugin’s README.

Others

Given that Fabric configuration language is built on HCL, IDE extensions designed for HCL syntax highlighting are applicable to Fabric files. It may be necessary to explicitly set the file type for *.fabric files to HCL.

Next steps

See Syntax to learn FCL core syntax components.