# How to Customize Export Output with the [export] Section Config in tuicr

> Master tuicr export output customization using the [export] section config. Control headers, scope lines, PR metadata, and legends in your Markdown exports.

- Repository: [Almog Gavra/tuicr](https://github.com/agavra/tuicr)
- Tags: how-to-guide
- Published: 2026-08-07

---

**The `[export]` table in `tuicr`'s [`config.toml`](https://github.com/agavra/tuicr/blob/main/config.toml) lets you control every element of the Markdown export—including headers, scope lines, PR metadata, and legends—by mapping directly to the `ExportConfig` struct defined in the source code.**

When generating review exports, `tuicr` outputs formatted Markdown to your clipboard or stdout via the `:clip` or `:export` commands. You can customize export output with the `[export]` section config to suppress default preamble lines, rename section headings, or hide PR identifiers without modifying the application code.

## Understanding the ExportConfig Structure

The `[export]` configuration table maps directly onto the `ExportConfig` struct located in [[`src/config/mod.rs`](https://github.com/agavra/tuicr/blob/main/src/config/mod.rs) at lines 50-66](https://github.com/agavra/tuicr/blob/main/src/config/mod.rs#L50-L66). This struct exposes six fields that govern the visual structure of the generated Markdown:

- **`intro`**: String printed above the comment list. An empty value disables the line entirely.
- **`scope_line`**: Boolean controlling the "Reviewing \<scope>" line that identifies the file or pull request under review.
- **`pr_metadata`**: Boolean determining whether URL and Head lines appear when reviewing pull requests.
- **`comments_header`**: String heading that precedes local comments.
- **`remote_comments_header`**: String heading that precedes unresolved remote threads in PR review mode.
- **`legend`**: Boolean toggling the "Comment types:" legend that explains `[TYPE]` markers.

Each field provides a sensible default when omitted, ensuring backward compatibility while allowing surgical customization.

## Configuration Resolution and Defaults

During application startup, `AppConfig::resolved_export()` computes the effective export settings. According to the implementation in [[`src/config/mod.rs`](https://github.com/agavra/tuicr/blob/main/src/config/mod.rs) at lines 59-65](https://github.com/agavra/tuicr/blob/main/src/config/mod.rs#L59-L65), this method performs a legacy migration: if you have not explicitly set the `legend` key in the `[export]` table, it automatically imports the deprecated top-level `export_legend` flag.

The `ExportConfig` implementation provides accessor methods—`intro()`, `scope_line()`, `pr_metadata()`, `comments_header()`, `remote_comments_header()`, and `legend()`—that return the final resolved values, as defined in [[`src/config/mod.rs`](https://github.com/agavra/tuicr/blob/main/src/config/mod.rs) at lines 68-94](https://github.com/agavra/tuicr/blob/main/src/config/mod.rs#L68-L94).

## Export Generation Pipeline

The actual Markdown assembly occurs in `generate_export_content()` within [[`src/output/markdown.rs`](https://github.com/agavra/tuicr/blob/main/src/output/markdown.rs) at lines 28-49](https://github.com/agavra/tuicr/blob/main/src/output/markdown.rs#L28-L49). This function receives an `ExportConfig` reference and conditionally renders content based on the configuration methods:

- `export.intro()` gates the output at lines 276-282
- `export.scope_line()` controls lines 288-293
- `export.pr_metadata()` controls lines 298-303
- `export.comments_header()` controls lines 411-416
- `export.remote_comments_header()` controls lines 473-478
- `export.legend()` controls lines 317-322

By manipulating the `[export]` table, you directly influence these conditional branches without touching the Rust source.

## Practical Configuration Examples

### Minimal Default Configuration

To accept all hardcoded defaults, declare an empty table:

```toml

# ~/.config/tuicr/config.toml

[export]

# No keys – all defaults are applied.

```

This produces output containing the standard "Review" intro, the scope line, PR metadata (when applicable), default section headers, and the comment type legend.

### Suppress Intro and Legend

To generate a compact export without the introductory line or explanatory legend:

```toml
[export]
intro = ""
legend = false

```

### Custom Headings and Hide PR Metadata

For personalized section titles while suppressing pull request identifiers:

```toml
[export]
comments_header = "My Local Comments"
remote_comments_header = "Unresolved Review Threads"
pr_metadata = false

```

### Complete Custom Preamble

To fully restructure the export layout:

```toml
[export]
intro = "=== My Review Export ==="
scope_line = false
pr_metadata = true
comments_header = "=== Draft Comments ==="
remote_comments_header = "=== Remote Threads ==="
legend = true

```

## Summary

- The `[export]` table in [`config.toml`](https://github.com/agavra/tuicr/blob/main/config.toml) maps to the `ExportConfig` struct in [`src/config/mod.rs`](https://github.com/agavra/tuicr/blob/main/src/config/mod.rs), providing granular control over Markdown export formatting.
- Six fields—`intro`, `scope_line`, `pr_metadata`, `comments_header`, `remote_comments_header`, and `legend`—determine which preamble elements appear in the final output.
- Legacy `export_legend` flags automatically migrate to the new `legend` field only when not explicitly configured, ensuring backward compatibility.
- The export pipeline in [`src/output/markdown.rs`](https://github.com/agavra/tuicr/blob/main/src/output/markdown.rs) uses these configuration values to conditionally render each section at specific line ranges.
- Empty strings disable text elements entirely, while boolean flags toggle structural components like metadata blocks and legends.

## Frequently Asked Questions

### What happens if I omit the entire [export] section?

If you omit the `[export]` table entirely, `tuicr` initializes `ExportConfig` with hardcoded defaults defined by constants such as `DEFAULT_EXPORT_INTRO` and `DEFAULT_EXPORT_COMMENTS_HEADER`. The export continues to function normally, using these preset values for all formatting decisions.

### Does setting intro to an empty string remove the line entirely?

Yes. When `intro` is set to `""`, the `intro()` method returns an empty string, and the export generator in [`src/output/markdown.rs`](https://github.com/agavra/tuicr/blob/main/src/output/markdown.rs) (lines 276-282) skips printing that line entirely rather than emitting a blank line in the output.

### How does tuicr handle the deprecated export_legend flag?

The `resolved_export()` method in [`src/config/mod.rs`](https://github.com/agavra/tuicr/blob/main/src/config/mod.rs) checks whether you have explicitly set the `legend` key in the `[export]` table. If the key is absent, it promotes the legacy top-level `export_legend` boolean into the new structure, preserving existing configurations while encouraging migration to the nested table format.

### Can I use the [export] settings when exporting to stdout?

Yes. The `[export]` configuration applies universally to all export operations, whether you use the `:clip` TUI command to copy to the clipboard or the `--stdout` CLI flag for terminal output. Both invocation paths ultimately call `generate_export_content()` with the resolved `ExportConfig`.