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

Reusable Sass utilities API documentation section #39756

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

guilhermejcgois
Copy link

@guilhermejcgois guilhermejcgois commented Mar 7, 2024

Description

I separated the change into 3 parts:

  • I transformed a shortcode into a partial without losing compatibility with other uses of scss-docs;
  • I adapted the docsref shortcode to work with both positional and named parameters, this change was an attempt to use the shortcode as the parameter for the sass-utilities-api-section shortcode that I ultimately use through .Inner;
  • Finally, in addition to building the new shortcode, I used the Overflow page as an example, but I found this approach a little strange, I would make the same change made to the scss-docs shortcode, so I kept the refactoring to accept the two types of parameters that Hugo behaves.

Type of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Refactoring (non-breaking change)
  • Breaking change (fix or feature that would change existing functionality)

Checklist

  • I have read the contributing guidelines
  • My code follows the code style of the project (using npm run lint)
  • My change introduces changes to the documentation
  • I have updated the documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed

Live previews

Related issues

Closes #38434

- call the partial from the shortcode to not introduces a breaking
  change
- use it in the Overflow doc as example
Copy link
Member

@julien-deramond julien-deramond left a comment

Choose a reason for hiding this comment

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

Thanks a lot @guilhermejcgois for this PR!
I haven't had the time to look at everything. Just made 2 quick comments based on recent modifications we've done in the docs.
I'll look at it more closely this week.

Overflow utilities are declared in our utilities API in `scss/_utilities.scss`. [Learn how to use the utilities API.]({{< docsref "/utilities/api#using-the-api" >}})

{{< scss-docs name="utils-overflow" file="scss/_utilities.scss" >}}
{{< sass-utilities-api-section title="Overflow" name="utils-overflow" file="scss/_utilities.scss" >}}
Copy link
Member

Choose a reason for hiding this comment

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

There's an edge case I haven't seen before in borders.md where there are two calls to scss-docs:

{{< scss-docs name="utils-borders" file="scss/_utilities.scss" >}}

{{< scss-docs name="utils-border-radius" file="scss/_utilities.scss" >}}

Let's perhaps wait for the discussion on the global approach to take place and not tackle it right away if it's too complicated, but here we might need to manage an array of names instead of a simple name="utils-overflow".

This comment was marked as off-topic.

Copy link
Member

Choose a reason for hiding this comment

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

FYI, some refactoring is happening in our docs right now. I haven't voluntarily clicked on "Update branch" to avoid breaking your changes. I'll let you rebase your branch yourself and adapt your changes to the latest modifications. This site/layouts/shortcodes/docsref.html might for instance be impacted depending on when you've created this branch.

Copy link
Author

Choose a reason for hiding this comment

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

Certainly! When the refactoring is over, I can rebase my branch. Are you tracking these refactorings in any issue? If you think it's safe, I can do it as soon as I can and look at the borders.md issue as well

Copy link
Member

Choose a reason for hiding this comment

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

I think you can rebase it from now on. There's no tracking issue; it's basically all the commits from this week and last week. They won't probably have any impacts on your PR directly, but some elements would maybe need to be backported here; I'll take care of it when the PR is rebased as it might be difficult and long for you to handle :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reusable Sass utilities API documentation section
3 participants