-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CLIENT-SPECIFICATION: fix typo, add a way to escape the placeholder syntax #10730
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
aa10306
CLIENT-SPECIFICATION: add a way to escape the placeholder syntax
acuteenvy 1c031e0
Merge branch 'main' into client-spec-10125
kbdharun 24ac759
Update CLIENT-SPECIFICATION.md
kbdharun 6db1d0d
CLIENT-SPECIFICATION: update page structure section
kbdharun File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would personally lighten the syntax to only one backslash:
docker inspect --format '\{{range.NetworkSettings.Networks\}}\{{.IPAddress\}}\{{end\}}' {{container}}
.This is maybe easier to parse than what I had proposed, but still not too heavy for reading source pages (even though this isn't done often). The drawback could if we needed to render something like
\{{ <...> }}
But since I've seen only 3 occurrences of this problem, maybe this change is not needed. 🤷🏻
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I favor a backslash for each curly brace. I think it's much more intuitive to treat things per character, rather than by our special definition attributed to combinations of characters.
In Markdown,
\{
already means a literal{
. So we should run with it. This will also be more backward compatible. When we don't mean the placeholder syntax,{{
is never found, so even if the client doesn't know to ignore it, it'll inadvertently ignore it anyway.This will be simpler than giving
{{
conditional meaning based on an escape sequence multiple characters away.If a client finds
\{{range.NetworkSettings.Networks\}}
, and processes placeholders before delegating to the CommonMark library, it's probably going to mess up unless it knows to check for a backslash. If a client finds\{\{range.NetworkSettings.Networks\}\}
without any special handling, it knows it's not a placeholder, and the CommonMark library will just do its magic.For nested curly braces inside the placeholder syntax:
{{uwu}}
uwu
{{\{uwu\}}}
\{uwu\}
{{\{\{uwu\}\}}}
\{\{uwu\}\}
The main difference, here, is that having a single escape sequence affect multiple characters would require special handling from clients, while doing one escape sequence per character is already supported/expected by clients and CommonMark parsers. The benefits assume the client is using a CommonMark library to parse the page.