LiquidDoc #1865
benjaminsehl
started this conversation in
Requests for Suggestions
LiquidDoc
#1865
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Originally posted as issue #1852
Author: Shopify
Expected end date: December 5, 2024
Background
Snippets are the primary method for reusing logic in Liquid. However, their weak interfaces make it easy to overlook dependencies when rendering them.
Is
render
missing some dependency?It shouldn't be hard to answer this question. Projects such as Dawn have adopted headers as a convention to define such interfaces. This makes it easier to render snippets, as all dependencies are clearly listed, and there is no need to review the entire snippet to check if we're missing a dependency.
While that convention is very helpful, it relies heavily on manual work to keep the list of dependencies updated and to manually check them when rendering.
Proposal
We should officially support these headers in Liquid as documentation, similar to how JSDoc works. This way, tools such as the Liquid language server can support features around these definitions, such as:
{% render "icon", █
){% doc %}
tag with the proper type inference (thus, for a@param {string} foo
,{{ foo |█ }}
displays filters for string objects){% render ... %}
is missing parameters@param
) in the{% doc %}
tag (auto-fix means: add missing parameters and remove unused ones){% render ... %}
snippetsThe
doc
tag behaves just like thecomment
tag but has a special name to be handled differently by Liquid tooling.Call for suggestions
We welcome any feedback or opinions on this proposal. Please share your thoughts by December 5, 2024. Your input is valuable as we prepare to begin active development on this initiative.
Context
Beta Was this translation helpful? Give feedback.
All reactions