Highlight 4

0 views
Skip to first unread message

Jarrell Campbell

unread,
Aug 3, 2024, 5:49:17 PM8/3/24
to lydacorto

Highlight was designed to offer a flexible but easy to use syntax highlighterfor several output formats. Instead of hardcoding syntax or colouringinformation, all relevant data is stored in configuration scripts. Thesescripts may be altered or enhanced with plug-in scripts.

If no input filename is defined by --input or given at the prompt, highlight isnot able to determine the language type by means of the file extension (butsome scripting languages are determined by the shebang in the first inputline). In this case you have to pass highlight the given langage with --syntax(this should be the file suffix of the source file in most cases).

Highlight enters the batch processing mode if multiple input files are definedor if --batch-recursive is set.In batch mode, highlight will save the generated files using the originalfilename, appending the extension of the chosen output type.
If files in the input directories happen to share the same name, the outputfiles will be prefixed with their source path name.
The --out-dir option is recommended in batch mode. Use --quiet to improveperformance (recommended for usage in shell scripts).

With --style-infile you define a file to be included in the final formattinginformation of the document. This way you enhance or redefine the defaulthighlight style definitions without editing generated code.
Note: Using a plug-in script is the preferred way to enhance styling.

If highlight could be invoked with all kinds of input, you can disable parsingof binary files using --validate-input. This flag causes highlight to match theinput file header with a list of magic numbers. If a binary file type isdetected, highlight quits with an error message.

Inc_luatex is a Lua definition with TeX line comments.Note that the nested code section has to end with the ending delimiter definedin the host language definition.Tips and tricksTest new configuration scriptsThe option --config-file helps to test new config files before installing them.The given file must be a lang or theme file.

A language definition describes all elements of a programming language whichwill be highlighted by different colours and font types.Save the new file in langDefs/, using the following name convention:

The --plug-in option receives the name of a Lua script which can override andenhance the settings of theme and language definition files. Plug-ins makeit possible to apply costum settings without editing installed highlightconfiguration files.
See Plug-Ins for file format and examples.

@Ezana_Abebe no resolutions yet, as the team has been unable to reproduce the issue with highlights not appearing in the selected location. Have you tried adjusting the zoom levels (both on the viewer and the browser)? This has worked for some users.

Same problem happens on my M1 Macbook air (Sonoma 14.1.1, Chrome 120.0.6099.109). Mac OS and Chrome updates did not fix this bug. Highlighted area is shifted up by one line. This bug happened on all of my PDF, regardless the zoom. I can highlight lines correctly with the iPad app, and these highlighted lines also correctly shown in browser.

It would be nice if you could enable a feature in Operations Dashboard that would highlight the feature in the map that is currently selected in the details element. For example, if you're looking at a citywide map that is full of features that pertain to distinct small sections of the city, it would be great if the feature which is summarized in the details element were highlighted in the map, so the viewer could easily find the shape that corresponds to the information in the details element.

I usually use a List element to filter the Details element and pan/zoom/etc. on the Map. I have FLASH set as an action in my List, though Flash only lasts a couple of seconds on the Map. It would be good to have HIGHLIGHT as an Action (the same as or similar to FLASH but doesn't turn off) - this would stay on until the feature is unselected or another feature is selected.

Coming from the Altium world there is one thing I really miss in Allegro / Orcad PCB Designer: the ability to simply highlight a net by reducing the brightness of everything else. In Altium, there is a possibility to simply Ctrl-Click a net, everything else will go darker and the net will show more vivid. This way you can easily determine where the net is going, through all layers.

In Allegro/Orcad PCB Designer I have found the option to "highlight" a net which will make it a bit patterned, the rest will stay the same and it is really hard to distinguish it from the rest visible. I have found that you can give colors to a net which is slightly better but then I won't be able to determine the layers it is going through anymore. Also, the rest will still be bright, again - pretty hard to visually distinguish.

To get rid of the annoying bit-patterned highlight and make it solid and bright, go into User_Setup->Display->Highlight and select "display_nohiltefont".
The other trick for display contrast is as per steve's post.

Thanks, that makes it a bit better but I'd like to see the whole net to be highlighted, not just the tracks on the layer where I selected the Cline segment, including all involved Vias, CLines, Pads so you can easily see where the signal is going. Currently it will stop at the first via - is there an option for that?

Thanks, that definitely helps. It's interesting that sometimes I have a dialog popping up where I can actually select "No pattern" but the dialog on the Options panel only shows patterns without the "No pattern"

There are alternative extensions that you may be considering, like TODO Highlight, but this is more generic, this can apply different styles to different capturing groups within the same regex, and this is focused on doing only one thing and doing it well.

The following is the configuration I'm currently using for highlighting todos, it's much more robust than the previous demo configuration, and it supports JavaScript/HTML-style comments, urls, multiple todos in a single line, common templating languages, and Todo+-style tags.

Highlight is an extension that adds support for code highlighting. Its purpose is to provide a single place to configure syntax highlighting for code blocks. Both InlineHilite and SuperFences can use Highlight to configure their highlight settings, but Highlight will also run all non-fence code blocks through the highlighter as well.

The Highlight extension is inspired by CodeHilite, but differs in features. PyMdown Extensions chooses not to implement special language headers for standard Markdown code blocks like CodeHilite does; PyMdown Extensions takes the position that language headers are better suited in fenced code blocks. So standard Markdown code blocks will just be styled as plain text unless guess_language is enabled. If you wish to highlight lines and define line numbers per code block, it is advised to use the SuperFences extension.

By default, the prefix language- is applied to language classes when Pygments is disabled or when Pygments code blocks enable language classes via pygments_lang_class. This prefix can be changed via the language_prefix option.

extend_pygments_lang allows you to create a special Pygments alias language where you can configure the language settings to your liking. So if you wanted to enable startinline for php, you might create a language alias called php-inline that maps to php with startinline enabled. This would allow you to use php for normal PHP blocks, but also allow you to do use php-inline for code without specifying

extend_pygments_langis an array of dictionaries. Each dictionary contains three keys: name which is the new name you are adding, lang which is the language the new name maps to, and options which is a dictionary of the options you wish to apply.

To be clear the SuperFences extension does not strip leading and trailing new lines, this is the default behavior of the Pygments syntax highlighter, not the SuperFences extension's parsing logic. When Pygments is disabled, both leading and trailing newlines are preserved.

While it is rare for people to actually need leading and trailing newlines, if such behavior was desired, it can be retained by disabling the stripnl option in Highlight which will ensure that all Pygments lexers have this option disabled.

Inline code blocks, such as those provided by InlineHilite, will be unaffected. Indented code blocks will also not be affected as leading and trailing newlines are never retained in indented code blocks.

Pygments has two available styles when outputting source code with line numbers enabled: table and inline. table is the default output and creates a table output for lines with numbers. inline places the line numbers directly in the source code output and can sometimes be undesirable as copy and paste will always copy the line numbers as well.

The Highlight extension provides a third line number style called pymdownx-inline. Instead of writing line numbers directly in the pre like Pygments' default inline style does, it writes the line numbers as . This way the line numbers are un-selectable and can be displayed with CSS:

All options below control the Pygments' output. The three exceptions are use_pygments which disables Pygments, css_class which sets the name of the class assigned to the generated code blocks, and code_attr_on_pre which only apply when Pygments is disabled. Many of these options are demonstrated in the SuperFences documentation.

linenums now accepts None as the default for allow line numbers to be enabled per code block. False now disables line numbers globally preventing line numbers even if specified per code block. True still enables globally.

This sample shows how to highlight features in a SceneLayer representing campus buildings. When the SceneLayerView finished updating we loop through all the loaded features and put them in a list. An event listener is added on each list item which zooms to the 3D extent of the feature and highlights it.

c80f0f1006
Reply all
Reply to author
Forward
0 new messages