CudaText: Wish to highlight fenced code-blocks in Markdown (and other lexers)

From @WebMechanic

is there a way to get syntax coloring in fenced code blocks such as this:

```html
<aside><h1>Feature request</h1></aside>
```

that is using ```html et al.

If I have a document with loads of these blocks I have to run Code to get a nicer preview (or to eventually render the file into .html or .pdf)

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 18 (11 by maintainers)

Commits related to this issue

Most upvoted comments

@WebMechanic I moved the PHP heredoc wish to the new topic #3853

I wrote about lite lexers this

CudaText has lexer preinstalled, it’s lite lexer “SQL ^”, and it cannot be used here, because lite lexer cannot be called from normal lexer.

Beta is here http://uvviewsoft.com/c/

Pls test?

@jairomartinezA @eltonfabricio10 @kvichans @GHNewbiee

Jairo,I am going to write this to the wiki. not sure it’s OK solution, because it needs the editing of alias.ini

Note about SQL blocks. CudaText has SQL lexer preinstalled, it’s lite lexer “SQL ^”, and it cannot be used here, because lite lexer cannot be called from normal lexer. But you can install (from “Plugins / Addons Manager”) normal SQL lexers: SQL; SQL White; SQL Blue; MySQL; T-SQL (this one has the special alias “tsql”); PL-SQL. After you installed one of them, make the fix in the file “data/lexlib/aliases.ini” to the line “sql=”.

This is looking great!

It appears the PHP lexer requires one to include <?php at the top of the block or there’s no colouring. It does however also faall back toHTML if hte PHP block is closed ?>. Just wondering if this is required and if other langages that req. such a prolog are also “affected” by this; maybe ASP and JSP? I’ll take it as a feature though, not a bug, 'Cos you can have PHP and HTML in the fenced block.

```php
<?php
$foo = "bar";
```

is it needed in other lexers? examples?

out of my head it’d be useful for heredocs in PHP. Here the bits between <<<HTML and HTML; would be highlighted.

$markup = <<<HTML
<p>Some HTML Code</p>
HTML;

The String ‘HTML’ is not explicitly naming the language within the block, could be any “label” and just has to be identical at the ende. It’S just convention to use HTML oder CSS or SQL and some IDE’s use this as a hint to switch sytax highlighting inside this block.

Partially fixed yet only for HTML, not for others. Screenshot from 2021-11-14 05-36-27