Examples of concrete use of some hidden features of Bitbucket

Avertissement

Javascript is required!

This web page embeds some small programs written in javascript. This should work in any recent web browser, supporting javascript (and it should not be disabled).


About this page

This page demonstrates some hidden features of the awesome website Bitbucket (you know, the Australian concurrent of GitHub, to which I participated in his French translation and that I enjoy very much).


Include a file with ?t=embed

How does it work?

Pattern

Bitbucket.org allows to include a file (with syntax coloring) easily, with the following piece of HTML code:

<script type="text/javascript" src="https://bitbucket.org/NAME/REPOSITORY/src/master/PATH?t=embed"></script>

Example

You have to replace:

  1. NAME by your Bitbucket username (for me, it is lbesson);

  2. REPOSITORY by the name of the repository (for instance, for me, bin);

  3. PATH by the complete path to the file (for instance, pdflatex which is also here bin/pdflatex localement).

And so, in the example below, the HTML code embedded is:

<script type="text/javascript" src="https://bitbucket.org/lbesson/src/master/pdflatex?t=embed"></script>

In reStructuredText

And finally, we can include this in a webpage generated with Sphinx thanks to the following piece of rST code:

.. raw:: html

   <script type="text/javascript" src="https://bitbucket.org/lbesson/src/master/pdflatex?embed=t">File bin/pdflatex</script>
   <noscript>Javascript is disabled, impossible to include this file <a href="https://bitbucket.org/lbesson/raw/master/pdflatex">bin/pdflatex</a>.</noscript>

Examples

bin/pdflatex

A rST file (the source code of this page!)