Skip to content

✨ feat: support Zola's native code block names#489

Merged
welpo merged 3 commits into
mainfrom
feature/support-native-code-names
Feb 15, 2025
Merged

✨ feat: support Zola's native code block names#489
welpo merged 3 commits into
mainfrom
feature/support-native-code-names

Conversation

@welpo

@welpo welpo commented Feb 15, 2025

Copy link
Copy Markdown
Owner

Summary

Adds (CSS) support for Zola's native code block name syntax (lang,name=file.rs) added in 0.20.0.

URLs in names become clickable links through setting code_block_name_links = true.

Deprecates the custom shortcode in favor of the native syntax.

Changes

  • Rename setting that loads JS from add_src_to_code_block to code_block_name_links (old name supported for compatibility)
  • Consolidate CSS
  • Add legacy support for existing shortcode usage

Accessibility

The clickable links maintain the same color contrast as before and are keyboard accessible. The URLs are visible to screen readers and maintain the same semantic structure.

Type of change

  • Bug fix (fixes an issue without altering functionality)
  • New feature (adds non-breaking functionality)
  • Breaking change (alters existing functionality)
  • UI/UX improvement (enhances user interface without altering functionality)
  • Refactor (improves code quality without altering functionality)
  • Documentation update
  • Other (please describe below)

Checklist

  • I have verified the accessibility of my changes
  • I have tested all possible scenarios for this change
  • I have updated theme.toml with a sane default for the feature
  • I have updated config.toml in tabi-start
  • I have made corresponding changes to the documentation:
  • Updated config.toml comments
  • Updated theme.toml comments
  • Updated "Mastering tabi" post in English
  • (Optional) Updated "Mastering tabi" post in Spanish
  • (Optional) Updated "Mastering tabi" post in Catalan

Add support for Zola's native code block name syntax (```lang,name=file.rs```).
URLs in names become clickable links. Deprecate custom shortcode in favor of
native syntax.

- Rename `add_src_to_code_block` setting to clickable_code_names (old name supported for compatibility)
- Consolidate CSS
- Update documentation
- Rename JS
@welpo welpo added the enhancement New feature or request label Feb 15, 2025
@netlify

netlify Bot commented Feb 15, 2025

Copy link
Copy Markdown

Deploy Preview for tabi-demo ready!

Name Link
🔨 Latest commit d728fad
🔍 Latest deploy log https://app.netlify.com/sites/tabi-demo/deploys/67b1076f2431530008bd29f0
😎 Deploy Preview https://deploy-preview-489--tabi-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@welpo welpo force-pushed the feature/support-native-code-names branch from 1a7cea7 to d728fad Compare February 15, 2025 21:30
@welpo welpo merged commit 61793b2 into main Feb 15, 2025
@welpo welpo deleted the feature/support-native-code-names branch February 15, 2025 21:31
welpo added a commit to welpo/tabi-start that referenced this pull request Feb 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant