Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

  • b1cdd2a
  • /
  • docsearch.js
Raw File Download

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
content badge
swh:1:cnt:b35504cd3a282816130a16881f3ebeead9c1bcb4
directory badge
swh:1:dir:b1cdd2a785242f9ea8b88041762422490030ba2f

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
docsearch.js
$(function() {

  // register a handler to move the focus to the search bar
  // upon pressing shift + "/" (i.e. "?")
  $(document).on('keydown', function(e) {
    if (e.shiftKey && e.keyCode == 191) {
      e.preventDefault();
      $("#search-input").focus();
    }
  });

  $(document).ready(function() {
    // do keyword highlighting
    /* modified from https://jsfiddle.net/julmot/bL6bb5oo/ */
    var mark = function() {

      var referrer = document.URL ;
      var paramKey = "q" ;

      if (referrer.indexOf("?") !== -1) {
        var qs = referrer.substr(referrer.indexOf('?') + 1);
        var qs_noanchor = qs.split('#')[0];
        var qsa = qs_noanchor.split('&');
        var keyword = "";

        for (var i = 0; i < qsa.length; i++) {
          var currentParam = qsa[i].split('=');

          if (currentParam.length !== 2) {
            continue;
          }

          if (currentParam[0] == paramKey) {
            keyword = decodeURIComponent(currentParam[1].replace(/\+/g, "%20"));
          }
        }

        if (keyword !== "") {
          $(".contents").unmark({
            done: function() {
              $(".contents").mark(keyword);
            }
          });
        }
      }
    };

    mark();
  });
});

/* Search term highlighting ------------------------------*/

function matchedWords(hit) {
  var words = [];

  var hierarchy = hit._highlightResult.hierarchy;
  // loop to fetch from lvl0, lvl1, etc.
  for (var idx in hierarchy) {
    words = words.concat(hierarchy[idx].matchedWords);
  }

  var content = hit._highlightResult.content;
  if (content) {
    words = words.concat(content.matchedWords);
  }

  // return unique words
  var words_uniq = [...new Set(words)];
  return words_uniq;
}

function updateHitURL(hit) {

  var words = matchedWords(hit);
  var url = "";

  if (hit.anchor) {
    url = hit.url_without_anchor + '?q=' + escape(words.join(" ")) + '#' + hit.anchor;
  } else {
    url = hit.url + '?q=' + escape(words.join(" "));
  }

  return url;
}

back to top

Software Heritage — Copyright (C) 2015–2026, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API