Is there an lang-delphi.js file on the Internet for Delphi posting on Prettify? Or you can somehow change lang-pascal.js so that it works correctly? At the moment, he doesn’t want to work normally - all words starting with a capital letter mark the class typ .

 prettyPrint(); 
 .str { color: #060 } .kwd { color: #006; font-weight: bold } .com { color: #600; font-style: italic } .typ { color: red; font-weight: bold } .lit { color: #044 } .pun, .opn, .clo { color: #440 } .tag { color: #006; font-weight: bold } .atn { color: #404 } .atv { color: #060 } 
 <pre class="prettyprint"> Function FunctionName(Param: Type): Result; Begin End; function functionname(param: type): result; begin end; FUNCTION FunctionName BEGIN END; </pre> 

As you can see, none of the options are highlighted correctly. The whole essence of the problem is visible in the first version - all words beginning with a capital letter are colored red (marked with the typ class), but this should not be. The second option is the most acceptable, but you need the opportunity to start the names of variables and functions with a capital letter - this is often used in Delphi.

Also, keywords (for example, Function ) should ideally be case-insensitive.

  • Try to write more detailed questions. To get an answer, explain exactly what you see the problem, how to reproduce it, what you want to get as a result, what you did to solve it, etc. Give a sample code. - kot-da-vinci
  • The problem is that the backlight is very limited in resources, and a full analysis of some languages ​​is very time consuming. In addition, languages ​​are constantly evolving, and keeping grammar in perfect condition is simply impossible for anyone. Therefore, a compromise solution is used: highlight keywords regardless of context, highlight names according to some traditions, etc. - Athari
  • For example, C # completely flies through in all parameters: the grammar is very complex, many context-dependent keywords, the naming rules are different from "java", so the problems are the same as for the delphi, only worse. Actually, look at the code - there is nothing there except for the regulars. It is obvious that it is impossible in principle to fully highlight code in any language. - Athari Nov.
  • Humble, such is the fate of all dead tongues. I tried to find a code formatter for a delphi (just indentation to arrange, online or offline), I did not find. Well, except for the IDE itself, which I have not installed - zenden2k
  • 3
    Discord, that is, the only way out is to format the code when added according to certain rules (parameter names with a small letter, etc.)? zenden2k, Latin is dead. And Old Russian. And they write in Delphi very often. - nup

1 answer 1

I've found a plugin on github , maybe this is what you need.

Google Prettify plug-in for Pascal and Delphi syntax highlighting

  • Unfortunately, the same problem - all words starting with a capital letter are highlighted with the class typ . - nup