From Wiki
Revision as of 13:44, 19 June 2020 by Taco (talk | contribs) (Initial documentation page for the source browser)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


The ConTeXt source browser at has recently been replaced by a Lua implementation that uses Hans Hagen's SciTE lexers for syntax highlighting and a search index that is built up using a Lua script.

Browsing the installed files

You can use the source browser to walk through the directory tree of the ConTeXt installation that is on the server. This is the same ConTeXt installation that is used for ConTeXt live, the <context> examples, and the <syntax> extension on the wiki.

This installation is not always completely in sync with the latest ConTeXt distribution, because setting up the installation on the server is quite elaborate (as various auxiliary databases need to be updated as well).

Searching the sources

You can use the search field to search for a particular (part of a) word in the ConTeXt distribution.

Note: At the moment, you cannot do AND/OR searches or search for multiple words at the same time.

The search field uses Lua patterns by default.

Quick start: Lua patterns have roughly the same list of special characters as simple regular expressions, but they use the % character for escaping those. See the Patterns section of the Lua manual for details.

There are four option checkboxes below the search input. Each of these are optional, with irrelevant values. The script only looks at the existence of the option, it never checks the actual values except for the value of the search parameter itself.

ignore comments

Name: igncomments Default: ON

This skips everything that is marked as 'comment' by the SciTE lexers.

ignore doc tree

Name: igndocs Default: ON

This skips all files in the doc/ subtree.

whole words only

Name: wholewords Default: OFF

Modifies the search pattern by anchoring it to the begin and end of the search index keys, as if it was enclosed in ^...$

plain text matches

Name: p Default: OFF

Treats the input as plain text instead of a lua pattern.

Highlighting of search terms

If you select a file that matches your search term, it will highlight the found matches with a yellow background. It also makes the page number of matching lines into a hyperlink to the next match in that file.

The highlighting is done separate from the search index, which means that it will sometimes find extra matches. For example, if you search for def, you would not see all the thousands of hits for \def in the file list on the left. But if you click on a particular file, the syntax highlighter will highlight all of the def substrings it finds in the entire file.

Sometime in the future, I will try to limit the highlighter to only highlight lines that are actually in the match list.

Linking from the wiki

From the wiki, you can use the {{src}} template to link directly to a file in the tex/context/base/mkiv folder. If you want to do a search as well:






Note that you have to write the equals sign as {{=}}.

A note about the search index

The search index is generated by a Lua script that parses the output of the SciTE Lexers. This process is not always perfect due to both small errors in the SciTE Lexers and in the lua script that parses its output.

Some limitations of the search index are hardcoded, and unlikely to change:

  • Only ASCII is indexed: the index is not unicode-aware. Fixing this may be doable but would be a lot of work for very little gain (the only non-ASCII in the source is in the interface translation files).
  • Only included are 'words' that contain at least one ASCII letter.
  • Only words longer than three letters are indexed.
  • Lua language keywords and matches that occur more than 1000 times (approx.) are not indexed.
  • All of the files in the patterns/ subtree are skipped.

If you find a problem that is not caused by one of the aforementioned limitations, please report it to User:taco by sending an email to