osteele / osteele/liquid

Add structured render warnings and diagnostics

Open
#144 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement research
Dominant language
Go
Stars
354
Forks
72
PR merge metrics
No merged PRs in 30d

Description

Summary

Add a backward-compatible API for reporting non-fatal diagnostics alongside rendered output. Callers should be able to surface portability problems or suspicious template constructs without failing a render.

Current status

The original dot-assignment motivation no longer describes the implementation. With Jekyll extensions enabled, {% assign page.canonical_url = value %} is parsed as a path assignment and updates a nested map through SetPath; it is not stored under an inaccessible literal key. With Jekyll extensions disabled, the syntax remains a parse error.

The diagnostics API is still useful, but dot assignment should not be changed into a warning or no-op as part of this issue.

Proposed direction

Add a detailed render method that returns output plus structured diagnostics, while leaving existing render methods unchanged. For example:

type RenderResult struct {
    Output   []byte
    Warnings []Warning
}

type Warning struct {
    Loc     parser.SourceLoc
    Code    string
    Message string
}

The exact names are open to design review.

Requirements

  • Existing parse and render APIs keep their current behavior.
  • Diagnostics belong to one render operation, not shared mutable engine configuration.
  • Concurrent renders remain safe and cannot mix diagnostics.
  • Locations identify the originating template, including included or rendered files.
  • Callers can choose whether warnings are informational or promoted to errors.
  • Tests cover multiple warnings, nested templates, and concurrent renders.

Candidate uses

  • Compatibility behavior that is accepted but differs from Shopify Liquid.
  • Deprecated syntax or features.
  • Recoverable template-store or rendering fallbacks.
  • Suspicious constructs that are valid but likely unintended.

Related

  • osteele/gojekyll#60
  • osteele/gojekyll#120

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the existing parse and render APIs and the parser.SourceLoc type. Use the proposed RenderResult and Warning fields as design context, then assess how diagnostics can remain per-render and concurrency-safe across included or rendered files. Done means the API preserves existing behavior and tests cover multiple warnings, nested templates, and concurrent renders.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.