Skip to content
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

added free form text pattern to use with example content #36

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

EvilGenius13
Copy link
Contributor

Closes: https://github.com/Shopify/developer-tools-team/issues/614

Adds proper highlighting for free form text pattern for @example that aligns with @description and @param tags

Before:
image

After:
image

@EvilGenius13 EvilGenius13 added the #gsd:44310 LiquidDoc label Mar 5, 2025
- include: '#javascript_codefence'
- include: '#object'
- include: '#tag'
- include: '#free_form_text'
Copy link
Contributor Author

@EvilGenius13 EvilGenius13 Mar 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one of the patterns that came with #core was the doc tag so I removed it so we didn't have any potential nested rule action.

Manually adding patterns also let us set the free_form_text above text.basic.html allowing us to properly highlight free form text anywhere within the example content.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since our hover in theme-tools assumes it's entirely liquid, how does it appear there?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this
image

Essentially the free form text is picked up as if you were writing plain text.


liquid_doc_fallback_tag:
match: '(@\w+)\b'
captures:
1: { name: comment.block.liquid }

free_form_text:
match: '(?:(?![{<]).)+'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this might capture too much. The second @example is being treated as part of the first example.

image

The current approach might be enough to handle free-form text. We don't even know if it's a feature we need. I'd keep this as draft for now or close it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good

@EvilGenius13 EvilGenius13 marked this pull request as draft March 5, 2025 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
#gsd:44310 LiquidDoc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants