Syntax highlighting in org mode. List of languages?

When I try to highlight SQL code in org-mode, the highlighting is not performed:

#+BEGIN_SRC SQL
SELECT *
FROM Production.Product
ORDER BY Name ASC;
#+END_SRC SQL

It works great for Python, shell, etc., but not for SQL. I wonder if I'm using the wrong keyword.

Considering this:

  • How can I highlight SQL code?
  • Where can I find a list of supported languages?
+4
source share
2 answers

SQLmust be lowercase, SQLand you do not need to repeat the language name in the string END_SRC:

#+BEGIN_SRC sql
  SELECT *
  FROM Production.Product
  ORDER BY Name ASC;
#+END_SRC

org-mode simply adds -modeto the specified language name and tries to find the main function of the mode. Emacs Lisp function names are case-sensitive, therefore sql-modeexists, but sql-modenot.

, C-h a -mode$, .. , -mode, , .

+8

- org-mode, sql-mode SQL . org-src-lang-modes:

(add-to-list 'org-src-lang-modes (cons "SQL" 'sql))

, C (c-mode) C++/C++ (cpp-mode).

+1

Source: https://habr.com/ru/post/1532321/


All Articles