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

playing with child qmd files as rules #38

Merged
merged 3 commits into from
Sep 16, 2024
Merged

playing with child qmd files as rules #38

merged 3 commits into from
Sep 16, 2024

Conversation

sckott
Copy link
Member

@sckott sckott commented Aug 26, 2024

Description

Per our conversations, playing here with using child .qmd files to organize rules that we want to track/use/etc.

Related Issue

#37

Example

I've only done this in one chapter: Package maintenance, open that up and scroll down towards the bottom.

Screenshot 2024-08-26 at 4 12 27 PM

Testing

N/A

Discussion

We could not use callouts too. We could instead do:

  • Just plain text of the rule in a child qmd file, then include it
  • Something other than callouts that's not plain text?

Advantages of callouts:

  • It's easy for humans to find rules when they are reading a chapter

Disadvantages of callouts:

  • Does it look awkward having callouts throughout?
  • Maybe callouts won't always work? e.g. may want a list of 10 rules, and then it'd be 10 callouts in a row.

In terms of machine reading, e.g.,

pak::pak("rundel/parsermd")
library(parsermd)

z <- parse_qmd("rules//main-branch.qmd")
z
#> └── Open Fenced div [.callout-note, icon=false]
#>     └── Heading [h2] - {{< iconify carbon rule-draft >}} Rule
#>         └── Markdown [1 line]
#>         └── Close Fenced div

rmd_select(z, has_type("rmd_markdown")) %>% as_document(collapse = "")
#> [1] "Every project should have a `main` branch which contains the most 
#> stable version of the software, or the version of the software that 
#> corresponds to the most recent release of the software."

That's just a quick example in R, could do in python too.

@sckott sckott requested review from seankross and tefirman August 26, 2024 22:50
Copy link

Copy link

@seankross seankross left a comment

Choose a reason for hiding this comment

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

I LOVE this! Full support, I think the implementation is right. I say ship it.

@sckott
Copy link
Member Author

sckott commented Aug 29, 2024

Thanks @seankross - Let me know what you think @tefirman

@sckott
Copy link
Member Author

sckott commented Aug 31, 2024

p.s. I can't ship this as is, as this is just for one chapter. I'll do the rest adding to this PR, then can merge once its all set

- instead of callouts use _variables.yml file to define rules
- and combination of bootstrap badge + text of rule
- provides more flexiblity in where rules can be placed (e..g, in lists)
- most rules were in lists so it would have been awkward to have callouts combined with lists
Copy link

@sckott sckott requested a review from seankross September 12, 2024 22:07
@sckott
Copy link
Member Author

sckott commented Sep 12, 2024

@seankross can you look at this again (see preview link above)? I changed my mind about how to organize and display rules. callouts were kinda cool but take up a lot of space and have to be on their own lines (can't be in a list, etc.) and most of of our rules are naturally falling within a markdown list of things, so after a bit of trial and error, looks like quarto var shortcocdes https://quarto.org/docs/authoring/variables.html#var might be our best option.

I've reworked the rules using var shortcodes, with the following highlights:

  • All rules are now in a _variables.yml file in the root of the repo https://github.com/getwilds/guide/pull/38/files#diff-8d85c8bb2b6fc2aa55722bcd0dd3fd43b81e6ccdbd0fe7eefbd900609c63875d It would be easy to fetch and parse that file to do whatever needed with it
  • Rules are pulled into the text anywhere you want them.
  • I made a yml field for the bootstrap badge with the shield icon so we can reference that instead of being repeated in every rule
  • a rule can now be referenced like {{< var rule-badge >}} {{< var rules.release-tags >}}
  • we could in the future add a link to the badge so a reader could go to another page/repo for more information on that rule - perhaps how we check it
  • The single place where the badge and icon are defined too makes it easy to tweak those in one place and ripples out to all uses of it
Screenshot 2024-09-12 at 3 07 21 PM

Thoughts?

Copy link

@seankross seankross left a comment

Choose a reason for hiding this comment

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

I like this too! Full endorsement and full speed ahead.

@sckott
Copy link
Member Author

sckott commented Sep 16, 2024

Thanks Sean, merging and we'll continue to iterate from here

@sckott sckott merged commit 53a5d6c into main Sep 16, 2024
2 checks passed
@sckott sckott deleted the children branch September 16, 2024 16:29
This was referenced Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants