Package Control

The official Sublime Text package manager.

EDIBlime

By encefalopiatto
Created July 7, 2026, last updated July 20, 2026.

Links

Version

0.4.0 (>ST4094) ·
2026-07-20 17:46

EDIBlime

A Sublime Text package to beautify, clean, minify and annotate EDI documents — with first-class support for UN/EDIFACT and the other major delimiter-based EDI standards.

Raw EDI arrives as one long, unreadable line. EDIBlime turns it into something a human can actually work with: one segment per line, syntax highlighting, and optional inline hints that name every segment — without ever changing the data.

UNA:+.? 'UNB+UNOC:3+SENDER:14+RECEIVER:14+200101:1200+1'UNH+1+ORDERS:D:96A:UN'BGM+220+PO12345+9'...

becomes

UNA:+.? '
UNB+UNOC:3+SENDER:14+RECEIVER:14+200101:1200+1'   UNB — Interchange Header
UNH+1+ORDERS:D:96A:UN'                            UNH — Message Header
BGM+220+PO12345+9'                                BGM — Beginning of Message
DTM+137:20200101:102'                             DTM — Date/Time/Period
NAD+BY+5412345000013::9'                          NAD — Name and Address
UNT+6+1'                                          UNT — Message Trailer
UNZ+1+1'                                          UNZ — Interchange Trailer

The segment descriptions on the right are non-destructive annotations — they are rendered by the editor, not written into your file, so the buffer stays a valid, byte-for-byte EDI document.

Features

Supported formats

# Format Family Notes
1 UN/EDIFACT EDIFACT Full delimiter + UNA service-string detection
2 ANSI ASC X12 X12 Delimiters read from the fixed-width ISA header
3 TRADACOMS TRADACOMS UK retail; = tag separator
4 HL7 v2.x HL7 MSH encoding characters; CR-delimited segments
5 EANCOM EDIFACT subset Shares EDIFACT delimiters
6 ODETTE EDIFACT subset Automotive; shares EDIFACT delimiters
7 EDIG@S EDIFACT subset Gas industry; shares EDIFACT delimiters
8 IATA / PADIS EDIFACT subset Air transport; shares EDIFACT delimiters
9 VDA (planned) German automotive, fixed-length records
10 VICS / EDIFICE / GS1 X12 / EDIFACT subsets Industry profiles of X12 / EDIFACT

EDIFACT and its subsets (EANCOM, ODETTE, EDIG@S, IATA/PADIS) share one parsing engine because they use identical delimiters and service strings; the dialect is still reported individually so segment tables can diverge over time.

Commands

All commands are available from the Command Palette (Ctrl/Cmd+Shift+P, type "EDI") and the Tools → EDIBlime menu; the editor context menu carries the common actions (beautify, minify, hints, explain, validate, repair, outline, convert).

Command Palette entry Default key binding
edi_beautify EDI: Beautify (one segment per line) Ctrl+Alt+B / Cmd+Alt+B
edi_minify EDI: Minify (collapse to single line) Ctrl+Alt+M / Cmd+Alt+M
edi_toggle_hints EDI: Toggle Inline Hints Ctrl+Alt+H / Cmd+Alt+H
edi_explain_segment EDI: Explain Segment Under Caret Ctrl+Alt+E / Cmd+Alt+E
edi_validate EDI: Validate Structure Ctrl+Alt+V / Ctrl+Cmd+V
edi_repair EDI: Repair Envelope (fix counts and references) Ctrl+Alt+R / Ctrl+Cmd+R
edi_outline EDI: Outline (browse segments) Ctrl+Alt+O / Ctrl+Cmd+O
edi_convert (json) EDI: Convert to JSON
edi_convert (jsonc) EDI: Convert to JSONC (with descriptions)
edi_convert (xml) EDI: Convert to XML
edi_convert (normalized) EDI: Normalize to JSON (named elements)
edi_set_dialect EDI: Set Dialect…
edi_detect_syntax EDI: Detect Syntax

Key bindings are scoped to the package's own syntaxes, so they never fire (or shadow other packages) in ordinary files.

Conversion output

EDI: Convert to JSONC produces a self-documenting document:

{
  // EDIFACT message converted by EDIBlime
  "dialect": "EDIFACT",
  "delimiters": { "segment": "'", "element": "+", "component": ":" },
  "segments": [

    // UNB — Interchange Header
    // Opens the interchange. Carries the syntax identifier and version (e.g. UNOC:3), ...
    {
      "tag": "UNB",
      "name": "Interchange Header",
      "elements": [
        ["UNOC", "3"],  // 1. Syntax identifier : version (e.g. UNOC:3)
        ["SENDER", "14"],  // 2. Interchange sender (id : qualifier)
        "1"  // 5. Interchange control reference (repeated in UNZ)
      ]
    }
  ]
}

Qualifier codes are decoded inline where known — a DTM+137:... element's comment reads [137 = Document/message date].

JSON is the same structure without comments; XML nests <segment><element><component> with name attributes.

Normalized output

EDI: Normalize to JSON produces the semantic view instead of the structural one — the shape EDI integration platforms work with. Keys are the snake_cased official names followed by the code that names the item in the standard:

{
  "payloads": [
    {
      "interchange_header_UNB": { "...": "..." },
      "messages": [
        {
          "MESSAGE_TYPE": "ORDERS",
          "message_header_UNH": { "...": "..." },
          "beginning_of_message_BGM": {
            "document_message_name_C002": { "document_message_name_coded_1001": "220" },
            "document_message_number_1004": "PO12345"
          },
          "date_time_period_DTM_list": [ { "...": "..." } ],
          "line_item_LIN_groups": [ { "...": "..." } ],
          "message_trailer_UNT": { "...": "..." }
        }
      ],
      "interchange_trailer_UNZ": { "...": "..." }
    }
  ],
  "context": {}
}

The envelope becomes real nesting (one payload per interchange, functional groups when UNG/GS are present), repeatable segments become stable ..._list arrays, and EDIFACT segment groups become ..._groups arrays named after their trigger segment, nested per the official message definitions. The EDIFACT names come from the bundled UNTDID D.96A directory (the basis of EANCOM 1997) plus ISO 9735 for service segments; message structures are bundled for ORDERS, ORDRSP, ORDCHG, DESADV, RECADV, INVOIC, REMADV, PRICAT, SLSRPT, INVRPT, DELFOR, DELJIT, PARTIN, QUOTES and REQOTE. X12, TRADACOMS and HL7 use the same convention with positional suffixes (purchase_order_number_03, patient_name_5) and their own envelopes (ISA/GS/ST, STX/MHD, MSH). Anything unknown degrades gracefully to tag/position keys, and stray segments are collected under unparsed_segments — nothing is dropped.

Settings

Preferences → Package Settings → EDIBlime → Settings:

{
    // Turn on inline hints automatically when an EDI file is opened.
    "auto_hints": false,

    // Add a short description to each inline hint (hover for the full one).
    "hints_show_descriptions": false,

    // Explain segments in a popup on mouse hover.
    "hover_help": true,

    // Re-run envelope validation on every save and mark problem segments
    // with a squiggly underline.
    "validate_on_save": false,

    // Colour for the inline hint annotations. Empty = inherit the colour
    // scheme's "comment" colour. Accepts any CSS colour.
    "hint_color": ""
}

Installation

  1. Open the Command Palette and run Package Control: Install Package.
  2. Search for EDIBlime and install.

Manual

Clone into your Sublime Text Packages directory (the folder revealed by Preferences → Browse Packages…):

git clone https://github.com/encefalopiatto/EDIBlime.git

Name the folder EDIBlime. (Resource paths are resolved from the installed folder name, so another name still works — but menus and docs assume EDIBlime.)

Requires Sublime Text 4, build 4095 or later — any stable ST4 release (4107+) qualifies. The floor is set by the coloured quick-panel kinds (4095); QuickPanelItem (4083) and the inline annotation API (4050) are older.

How it works

The package is split into a Sublime-independent engine and a thin editor layer. edi.py is the only plugin at the package root (Sublime Text loads every root-level .py file as a plugin); the engine lives in the core/ subpackage:

Try it

Sample messages live in samples/. With a git clone, just open one; with a Package Control install the package is zipped, so run View Package File from the Command Palette, type EDIBlime/samples and pick one, then copy its contents into a new tab (package files open read-only). Run EDI: Beautify, then EDI: Toggle Inline Hints.

Development

Run the test suite from the package root:

python -m unittest discover -s tests -v

The tests cover dialect detection, delimiter extraction, release-character handling, beautify ↔ minify round-tripping, and segment description lookups for every supported family.

Segment reference tables are plain dictionaries in core/edi_data.py — adding names or a new dialect subset needs no code changes to the engine.

License

MIT

Results

Packages