Skip to content

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