Skip to content

feat: allow using filenames in codeblocks#2455

Merged
kfiven merged 1 commit intocinnyapp:devfrom
WebFreak001:codeblock-filenames
Mar 14, 2026
Merged

feat: allow using filenames in codeblocks#2455
kfiven merged 1 commit intocinnyapp:devfrom
WebFreak001:codeblock-filenames

Conversation

@WebFreak001
Copy link
Contributor

Description

Makes it possible to send code blocks as ```filename.json or ```src/app/example.js and having Cinny display the filename in the header of code blocks as well as only using the text after the dot as the language specifier.

  • If there is a dot in the syntax name, we instead treat it as the filename and only everything after the last dot as the syntax name
  • we use a custom "data-label" attribute on the code block to specify the name of the file (so only compatible with new Cinny versions, no support for other matrix clients and no spec/standard for this)

Preview in Cinny:

image

 

Preview in old Cinny and probably other clients:

image

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

- If there is a dot in the language name, we instead treat the first line after ``` as the filename and everything after the last dot as the language
- we use a custom "data-label" attribute on the code block to specify the name of the file (so only compatible with cinny from this point onwards)
@github-actions
Copy link

Preview: https://2455--pr-cinny.netlify.app
⚠️ Exercise caution. Use test accounts. ⚠️

Copy link
Member

@ajbura ajbura left a comment

Choose a reason for hiding this comment

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

While this can work within cinny this will break the every other client code highlight

@ajbura ajbura self-requested a review September 17, 2025 09:12
ajbura
ajbura previously requested changes Sep 26, 2025
Copy link
Member

@ajbura ajbura left a comment

Choose a reason for hiding this comment

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

While this looks fine it doesn't include changes to retrieve filename when editing a message.

@ajbura ajbura requested a review from kfiven September 26, 2025 03:11
@ajbura ajbura dismissed their stale review March 14, 2026 07:53

current changes looks fine. I can add the editing changes.

@kfiven kfiven changed the title Allow using filenames in codeblocks feat: allow using filenames in codeblocks Mar 14, 2026
@kfiven kfiven merged commit 8a78c96 into cinnyapp:dev Mar 14, 2026
3 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Mar 14, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants