Section/blocks improvments #149
Replies: 1 comment 2 replies
-
I like this idea of sectioning. I've ben mulling over this for a couple of days. I admire the idea to utilize markdown-style section definition and nesting with "#" declarations, but my concern is that the proposed syntax might be too easily confused with comments and also prone to user error (could be easy to miss what should be a comment vs a first-level section, and users may accidentally comment out blocks of code during development which may then impact sections and section nesting. This feels like a semi-fragile approach toward sectioning. I've been thinking of possible alternatives that could achieve the same results while still having good UX / DX, and preserving the desired section behaviors. I have two alternative options for consideration... Option A: Decorator-Based Sections (
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
It is often useful to group multiple items in a .env file together somehow. Currently with @env-spec, while we can add a comment block before a group of items, there is no additional semantic link between those items and the comment block, or any way to end a section. We would like to introduce some mechanism for creating an explicit "section" within a file that multiple items can then be a part of, and ideally be able to nest sections to provide further hierarchy.
This notion of items being part of a section allows a few new things:
Proposal
Introduce into the language a new concept of a "heading" which will begin a "section". Taking the familiar syntax from markdown, a heading begins with multiple
#
symbols, for example## This is a heading
. Like markdown, using additional#
characters allows us to have a notion of depth/levels, which can then be used to create hierarchy.Further details:
#
is always just treated as a regular comment. Using 2 or more leading#
characters before a space and some text would be treated as a "heading"#
will still work, and result in something like this###
characters is considered a divider. We may want to completely discontinue the use of#
as a divider character, set some upper threshold (for example 5), or require an additional space after the first#
to consider it as a dividerWhen looking for root decorators tied to an item, we would follow up the chain of section parents to the document header
EDGE CASE, if a file begins with a section header, we would not automatically apply the root decorators to everything in the file. Which means that no global level decorators (like disabling security measures) could be used.
versus
Beta Was this translation helpful? Give feedback.
All reactions