0

In Sublime Text 3, is it possible to achieve multiple syntax highlighting in the same document?

I am aware that I can change the syntax of an entire document, using:

  • View => Syntax => [LANGUAGE OPTIONS]

But I note that when I am (for example) writing a PHP document which also contains:

  • HTML
  • CSS
  • Javascript

Example:

<?php

$stringVariable_1 = 'String Variable1';        // <= THIS IS PHP

echo '
<!DOCTYPE html>                                // <= THIS IS HTML
<html lang="en-GB">
<meta charset="utf-8">
<title>Title Here</title>

<style>

/* CSS STYLES HERE */                          // <= THIS IS CSS

</style>
</head>

<body>

<!-- HTML BODY HERE -->

<script>

/* JAVASCRIPT HERE */                         // <= THIS IS JAVASCRIPT

</script>
</body>
</html>
';
?>

that when I highlight one of those sections and change the Language Option from PHP to one of the others the code-hinting still changes to that Language for the entire document.

Is there any way (native feature, plugins etc.) I can straightforwardly indicate to Sublime Text 3 that different areas of the document are written in different languages?

1 Answer 1

-1

Yes it's possible to use multiple syntax highlighting in the same document.

Check out the solution to multiple syntax highlighting in sublimetext 3 with .sublime-syntax file type by Marco Mazzon.

1
  • Please quote the essential parts of the answer from the reference link(s), as the answer can become invalid if the linked page(s) change.
    – DavidPostill
    Commented Apr 29, 2020 at 16:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .