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

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

Merged
merged 3 commits into from
May 3, 2024

Conversation

welpo
Copy link
Owner

@welpo welpo commented May 3, 2024

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

  • Add the shortcode to add an invisible span with the src.
  • Add JavaScript to show this src on the next code block found. If it's a URL, it makes it an <a> tag.
  • Updates debugging code.
  • Updates documentation.

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

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 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

@welpo welpo added the enhancement New feature or request label May 3, 2024
@welpo welpo merged commit 9be86de into main May 3, 2024
3 checks passed
@welpo welpo deleted the feat/add_src_to_code_block-shortcode branch May 3, 2024 15:33
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.

Allow fetching code blocks from external source, display reference in code block title
1 participant