Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How do I support syntax highlighting for a new language in Bitbucket

Hey,

Is there a way to add custom language for a specific extension in Bitbucket? 

I am working on DSL and would like to have support for highlighting.

 

Thanks you 

2 answers

1 accepted

1 vote
Answer accepted
evzijst Atlassian Team Jul 12, 2016

No, I'm afraid there's no easy way to do that. We use Pygments for syntax highlighting and so while that covers a lot of languages, it is not easy to extend it to custom DSLs.

Depending on how badly you want this, you could write a Connect Add-On for it. Connect Add-Ons are iframes that replace parts of Bitbucket's UI that you host and control. Using the Bitbucket API to pull down the contents of a file, you can then render it any way you like.

There are examples of how to do that:

 

one year later, how's the situation on this? i would like to install a custom pygments highlighter for my repository; but i don't want to go through the trouble of programming an extra site extension. i'm completely open to submitting my highlighter to the atlassian repos though.

Deleted user Jan 14, 2020

According to https://confluence.atlassian.com/bitbucketserverkb/configuring-syntax-highlighting-for-file-extensions-779171322.html version 6.8 of Bitbucket server use ComeMirror for systax highlighting. I even found folder, that store all supported modes, but added custom mode doen't work. 

Thank you so much for the answers! I will have to wait and see how bad I want it smile One final question for clarification.

Does the solution mean that each user has to install the add-on or it will be installed for the repository and everyone accessing it will see it?

evzijst Atlassian Team Jul 13, 2016

The file-viewer plugin point can be used on both "account" and "personal" add-ons. Add-ons of the former type can be installed on the account that owns the repo and then it'll be visible to anyone viewing files in that repo. Add-ons of the latter type are installed on your own personal account and sort of follow you around; they apply only to pages you visit.

For more detail: https://developer.atlassian.com/bitbucket/concepts/add-on-context.html

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

Calling any interview participants for Bitbucket Data Center

Hi everyone,  We are looking to learn more about development teams’ workflows and pain points, especially around DevOps, integrations, administration, scale, security, and the related challeng...

451 views 4 4
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you