welpo / tabi

A modern Zola theme with search, multilingual support, optional JavaScript, a perfect Lighthouse score, and a focus on accessibility.
https://welpo.github.io/tabi/
MIT License
97 stars 32 forks source link

✨ feat: enable adding URL/path to code blocks #307

Closed welpo closed 2 months ago

welpo commented 2 months ago

Summary

Adds a add_src_to_code_block shortcode with its corresponding—sadly necessary—JavaScript. This allows showing a path or URL on a code block.

Related issue

Resolves #304.

Changes

Accessibility

Uses semantic HTML. Tested with VoiceOver on macOS.

Screenshots

Example usage with the remote text shortcode:

{{/* add_src_to_code_block(src="https://raw.githubusercontent.com/welpo/doteki/main/.gitignore") */}}
```.gitignore
__pycache__/
*coverage*
.vscode/
dist/


![ss](https://github.com/welpo/tabi/assets/6399341/2e3885cc-f913-4de4-b6b0-45912905d1ac)

### Type of change

<!-- Mark the relevant option with an `x` like so: `[x]` (no spaces) -->

- [ ] Bug fix (fixes an issue without altering functionality)
- [X] 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

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