'How to add PHP syntax highlighting in Pug files?

I need to write PHP code in Pug files for a project.

How can I extend pug syntax highlighting with PHP syntax, without recreating a full language syntax?

For example, for this piece of code, I would like that PHP code be colored like a regular .php file and keep at the same time pug syntax highlighting.

    section 
      .container
        .row
          .col 
            .image-100-wrapper
              <?= wp_img($content['image'], 'large') ?>
        .row.justify-content-center.mt-5
          .col-auto
            <?php wp_btn($content['bouton']) ?>

I looked if there was an existing VS code extension that does what I am looking for and I searched if there was a simple way to edit the .pug TextMate rules, but I didn't find it.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source