{"id":79,"date":"2007-09-04T09:00:39","date_gmt":"2007-09-04T14:00:39","guid":{"rendered":"https:\/\/blogs.mathworks.com\/desktop\/2007\/09\/04\/editor-syntax-colors-for-non-m-file-types\/"},"modified":"2007-09-04T08:53:35","modified_gmt":"2007-09-04T13:53:35","slug":"editor-syntax-colors-for-non-m-file-types","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/community\/2007\/09\/04\/editor-syntax-colors-for-non-m-file-types\/","title":{"rendered":"Editor syntax colors for non-M file types"},"content":{"rendered":"<p>I recently had a customer ask me how to make his mex files have correct syntax highlighting.  He had a file type that was not specified in our default preferences.  This is very easy to fix using preferences.<\/p>\n<p>Here is an example.  I have to edit info.xml files a lot because one of the things that I work on is the start button. But when I edit an xml file there is no syntax highlighting.  <\/p>\n<p><a href=\"https:\/\/blogs.mathworks.com\/community\/..\/images\/desktop\/xmleditor.jpg\"><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/desktop\/xmleditor_sm.jpg\"\/><\/a><\/p>\n<p>If the editor hightlights the file as html, it does a pretty good job of syntax highlighting. To make xml files syntax highlight as an html file, go to the Editor Language preference panel (File->Preferences->Editor->Language).  Select &#8220;HTML&#8221; from the Language combobox.<\/p>\n<p><a href=\"https:\/\/blogs.mathworks.com\/community\/..\/images\/desktop\/editorlangpref1.jpg\"><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/community\/..\/images\/desktop\/editorlangpref1_sm.jpg\"\/><\/a><\/p>\n<p>This will open the html highlighting panel.  Near the bottom of this panel is a File Extensions list that shows which files will be highlighted using this set of colors. <\/p>\n<p><a href=\"https:\/\/blogs.mathworks.com\/community\/..\/images\/desktop\/editorlangpref2.jpg\"><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/community\/..\/images\/desktop\/editorlangpref2_sm.jpg\"\/><\/a><\/p>\n<p>Click on the &#8220;Add&#8221; button and type &#8220;xml&#8221; into the dialog.  <\/p>\n<p><a href=\"https:\/\/blogs.mathworks.com\/community\/..\/images\/desktop\/addextension.jpg\"><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/community\/..\/images\/desktop\/addextension.jpg\"\/><\/a><\/p>\n<p>Hit OK to exit the dialog and OK to exit the preference panel.  <\/p>\n<p>Close the file and <b>re-open it<\/b> to see the changes.  <\/p>\n<p><a href=\"https:\/\/blogs.mathworks.com\/community\/..\/images\/desktop\/xmlcoloreditor.jpg\"><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/community\/..\/images\/desktop\/xmlcoloreditor_sm.jpg\"\/><\/a><\/p>\n<p>From this point forward, all xml files will be colored as html files.  You can associate any file type with M, C\/C++, Java, or HTML highlighting sets.  <\/p>\n<p>And because I predict that you will ask, we are considering linking xml files to the html color set by default in a future release.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I recently had a customer ask me how to make his mex files have correct syntax highlighting.  He had a file type that was not specified in our default preferences.  This is very easy to fix using&#8230; <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/community\/2007\/09\/04\/editor-syntax-colors-for-non-m-file-types\/\">read more >><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[9],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/posts\/79"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/comments?post=79"}],"version-history":[{"count":0,"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/posts\/79\/revisions"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/media?parent=79"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/categories?post=79"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/tags?post=79"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}