Skip to content

Conversation

@bachand
Copy link
Contributor

@bachand bachand commented Nov 22, 2025

Summary

Adds the ability to convert the README.md to a website. This productionizes #336 following positive internal feedback on the direction.

The next steps will be to set up a GitHub workflow to publish the site to GitHub Pages. We may also want to continue to polish the style.

Reasoning

A website will make the style guide more accessible. We chose to generate the website from the README so that the existing workflow for updating the style guide remains the same.

Testing

  • Run bundle exec rake site:serve locally and check the content at http://localhost:4000
  • Verify that top badges and SPM command plugin sections are filtered out of the site
Top Code block Footer
image image image

Please review

@airbnb/swift-styleguide-maintainers

]
```

</details>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I noticed that some details closing tags were missing.

source 'https://rubygems.org' do
gem "rake", "~> 13.0.0"
end
source 'https://rubygems.org'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I reworked this file to address this warning from Bundler:

[DEPRECATED] This Gemfile does not include an explicit global source. Not using an explicit global source may result in a different lockfile being generated depending on the gems you have installed locally before bundler is run. Instead, define a global source in your Gemfile like this: source "https://rubygems.org".

Copy link
Member

Choose a reason for hiding this comment

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

Thanks!

@bachand bachand changed the title Build website from README Build MVP website from README Nov 22, 2025
@@ -0,0 +1,48 @@
body {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I relied on AI to generate this styling and it looks like a good starting point to me.

markdown: kramdown
kramdown:
input: GFM
parse_block_html: true
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was necessary for the code blocks to render correctly.

@@ -0,0 +1,16 @@
<!DOCTYPE html>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I decided to put files that are inputs into the site under a src/ subdirectory to avoid needing to manage excludes in the _config.yml file. In this way, only files under src/ will be used to generate the site.

Copy link
Member

Choose a reason for hiding this comment

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

Good idea

@bachand bachand marked this pull request as ready for review November 22, 2025 21:41
@bachand
Copy link
Contributor Author

bachand commented Nov 22, 2025

This PR is ready for review, and there is also no rush. I plan to address any feedback after Thanksgiving.

with:
bundler-cache: true
- name: Build site
run: bundle exec rake site:build
Copy link
Member

Choose a reason for hiding this comment

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

Is this actually deploying the site? Or just validating that it builds successfully? My guess it that it's just validating the build.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this is validating that it builds. We'll need to add a separate workflow for deployment.

Comment on lines +57 to +83
namespace :site do
desc 'Prints the README content used to build the site'
task :filter_readme do
require_relative 'site/site_content'
puts SiteContent.new.filter_readme
end

desc 'Prepares index.md and syntax highlighting assets'
task :prepare do
require_relative 'site/site_content'
puts '📋 Generating index.md from README.md with frontmatter...'
SiteContent.new.write_index
puts '🎨 Generating syntax highlighting CSS...'
SiteContent.new.generate_syntax_css
end

desc 'Builds the static site into _site/'
task build: :prepare do
env = { 'JEKYLL_ENV' => ENV.fetch('JEKYLL_ENV', 'production') }
sh env, 'bundle exec jekyll build --source site/src'
end

desc 'Serves the site to support previewing its content during development'
task serve: :prepare do
env = { 'JEKYLL_ENV' => 'development' }
sh env, 'bundle exec jekyll serve --source site/src'
end
Copy link
Member

Choose a reason for hiding this comment

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

When would you run these commands? Do they have to be ran manually each time we make content changes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for asking. I clarified two of the commands in #339. site:build is mostly for CI validation.

Copy link
Member

@calda calda left a comment

Choose a reason for hiding this comment

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

Awesome!! Looks great! I had no idea you could pre-process Jekyll input markdown. Such a great idea.

Is the site built and deployed automatically by GitHub on every commit, or do we have to do it manually? My past experience with Jekyll makes me think it's deployed automatically, but I don't know how exactly GitHub would know to run our custom build code. It would be good to document exactly how the deployment works in the site/README.md once we know for sure it all works.

@calda
Copy link
Member

calda commented Dec 1, 2025

The next steps will be to set up a GitHub workflow to publish the site to GitHub Pages.

I see, we haven't set this up yet. Handling this in a follow-up works for me. I also wouldn't mind setting up this part.

@bachand bachand merged commit 9cafcd9 into airbnb:master Dec 1, 2025
5 checks passed
@bachand bachand deleted the mb--site-mvp branch December 1, 2025 19:00
@bachand
Copy link
Contributor Author

bachand commented Dec 1, 2025

Awesome!! Looks great! I had no idea you could pre-process Jekyll input markdown. Such a great idea.

🎉 😃

The next steps will be to set up a GitHub workflow to publish the site to GitHub Pages.

I see, we haven't set this up yet. Handling this in a follow-up works for me. I also wouldn't mind setting up this part.

Yes. Thanks for taking a look @calda !

bachand added a commit that referenced this pull request Dec 1, 2025
#### Summary

I noticed when working on #338 that
the README.md has some trailing newlines. My VS Code is set up to remove
these on save. I avoided removing them in that PR to keep it focused, so
I'm following up to to remove them here. I'm also clarifying a couple of
the tasks that I added based on
[this](#338 (comment))
feedback.

#### Testing

CI

#### Please review

@airbnb/swift-styleguide-maintainers
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