{"id":1121,"date":"2020-02-28T09:10:56","date_gmt":"2020-02-28T08:10:56","guid":{"rendered":"https:\/\/www.pschatzmann.ch\/home\/?p=1121"},"modified":"2020-11-21T22:22:46","modified_gmt":"2020-11-21T21:22:46","slug":"syntax-hightlighting-for-openscad-in-jupyterlab","status":"publish","type":"post","link":"https:\/\/www.pschatzmann.ch\/home\/2020\/02\/28\/syntax-hightlighting-for-openscad-in-jupyterlab\/","title":{"rendered":"Syntax Hightlighting for OpenSCAD in Jupyterlab"},"content":{"rendered":"<p>Out of the box <a href=\"https:\/\/jupyter.org\/\">Jupyterlab<\/a> is providing a rich set of supported languages for <strong>Syntax Highlighting<\/strong>. Unfortunately <a href=\"https:\/\/www.openscad.org\/\">OpenSCAD<\/a> is not one of them.<\/p>\n<p>So I tried to research this topic: Internally Jupyterlab is using the <a href=\"https:\/\/codemirror.net\/\">CodeMirror<\/a> editor and Codemirror allows to extend the syntax highlighting by defining custom modes. The easiest way is to use a <a href=\"https:\/\/codemirror.net\/demo\/simplemode.html\">Simple Mode<\/a>.<\/p>\n<p>Jupyterlab as well supports the functionality of <a href=\"https:\/\/jupyterlab.readthedocs.io\/en\/stable\/user\/extensions.html\">Extensions<\/a>. So the challenge is to provide a <strong>Jupyterlab Extension which implements a SimpleMode<\/strong>.<\/p>\n<p>On Github I found that <a href=\"https:\/\/github.com\/HuygensING\/jupyterlab-tagml-extension\">&#8216;Huygens ING&#8217; provides an implementation for TAGML<\/a>, so I took this as a template to provide <a href=\"https:\/\/github.com\/pschatzmann\/jupyterlab-openscad-syntax-highlighting\">my implementation for OpenSCAD<\/a>.<\/p>\n<p>You can add this extension into Jupyterlab using the built in <strong>Extension Manager<\/strong>. Just search for OpenSCAD, select the extension and hit the install button. After Jupyterlab has re-built, the functionality is available<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2020\/02\/OpenSCAD-Syntax-300x206.png\" alt=\"\" width=\"820\" height=\"563\" class=\"alignnone wp-image-1122\" srcset=\"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2020\/02\/OpenSCAD-Syntax-300x206.png 300w, https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2020\/02\/OpenSCAD-Syntax-768x528.png 768w, https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2020\/02\/OpenSCAD-Syntax.png 967w\" sizes=\"auto, (max-width: 820px) 100vw, 820px\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Out of the box Jupyterlab is providing a rich set of supported languages for Syntax Highlighting. Unfortunately OpenSCAD is not one of them. So I tried to research this topic: Internally Jupyterlab is using the CodeMirror editor and Codemirror allows to extend the syntax highlighting by defining custom modes. The [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1122,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"categories":[17,19],"tags":[],"class_list":["post-1121","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-3d-printing","category-openscad-kernel"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Syntax Hightlighting for OpenSCAD in Jupyterlab - Phil Schatzmann<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.pschatzmann.ch\/home\/2020\/02\/28\/syntax-hightlighting-for-openscad-in-jupyterlab\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Syntax Hightlighting for OpenSCAD in Jupyterlab - Phil Schatzmann\" \/>\n<meta property=\"og:description\" content=\"Out of the box Jupyterlab is providing a rich set of supported languages for Syntax Highlighting. Unfortunately OpenSCAD is not one of them. So I tried to research this topic: Internally Jupyterlab is using the CodeMirror editor and Codemirror allows to extend the syntax highlighting by defining custom modes. The [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.pschatzmann.ch\/home\/2020\/02\/28\/syntax-hightlighting-for-openscad-in-jupyterlab\/\" \/>\n<meta property=\"og:site_name\" content=\"Phil Schatzmann\" \/>\n<meta property=\"article:published_time\" content=\"2020-02-28T08:10:56+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-11-21T21:22:46+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2020\/02\/OpenSCAD-Syntax.png\" \/>\n\t<meta property=\"og:image:width\" content=\"967\" \/>\n\t<meta property=\"og:image:height\" content=\"665\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"pschatzmann\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"pschatzmann\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2020\\\/02\\\/28\\\/syntax-hightlighting-for-openscad-in-jupyterlab\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2020\\\/02\\\/28\\\/syntax-hightlighting-for-openscad-in-jupyterlab\\\/\"},\"author\":{\"name\":\"pschatzmann\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#\\\/schema\\\/person\\\/73a53638a4e34e8373405fd737dac9b1\"},\"headline\":\"Syntax Hightlighting for OpenSCAD in Jupyterlab\",\"datePublished\":\"2020-02-28T08:10:56+00:00\",\"dateModified\":\"2020-11-21T21:22:46+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2020\\\/02\\\/28\\\/syntax-hightlighting-for-openscad-in-jupyterlab\\\/\"},\"wordCount\":143,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#\\\/schema\\\/person\\\/73a53638a4e34e8373405fd737dac9b1\"},\"image\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2020\\\/02\\\/28\\\/syntax-hightlighting-for-openscad-in-jupyterlab\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2020\\\/02\\\/OpenSCAD-Syntax.png\",\"articleSection\":[\"3D Printing\",\"OpenSCAD Kernel\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2020\\\/02\\\/28\\\/syntax-hightlighting-for-openscad-in-jupyterlab\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2020\\\/02\\\/28\\\/syntax-hightlighting-for-openscad-in-jupyterlab\\\/\",\"url\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2020\\\/02\\\/28\\\/syntax-hightlighting-for-openscad-in-jupyterlab\\\/\",\"name\":\"Syntax Hightlighting for OpenSCAD in Jupyterlab - Phil Schatzmann\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2020\\\/02\\\/28\\\/syntax-hightlighting-for-openscad-in-jupyterlab\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2020\\\/02\\\/28\\\/syntax-hightlighting-for-openscad-in-jupyterlab\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2020\\\/02\\\/OpenSCAD-Syntax.png\",\"datePublished\":\"2020-02-28T08:10:56+00:00\",\"dateModified\":\"2020-11-21T21:22:46+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2020\\\/02\\\/28\\\/syntax-hightlighting-for-openscad-in-jupyterlab\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2020\\\/02\\\/28\\\/syntax-hightlighting-for-openscad-in-jupyterlab\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2020\\\/02\\\/28\\\/syntax-hightlighting-for-openscad-in-jupyterlab\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2020\\\/02\\\/OpenSCAD-Syntax.png\",\"contentUrl\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2020\\\/02\\\/OpenSCAD-Syntax.png\",\"width\":967,\"height\":665},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2020\\\/02\\\/28\\\/syntax-hightlighting-for-openscad-in-jupyterlab\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Syntax Hightlighting for OpenSCAD in Jupyterlab\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#website\",\"url\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/\",\"name\":\"Phil Schatzmann Consulting\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#\\\/schema\\\/person\\\/73a53638a4e34e8373405fd737dac9b1\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#\\\/schema\\\/person\\\/73a53638a4e34e8373405fd737dac9b1\",\"name\":\"pschatzmann\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/pschatzmann.png\",\"url\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/pschatzmann.png\",\"contentUrl\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/pschatzmann.png\",\"width\":305,\"height\":305,\"caption\":\"pschatzmann\"},\"logo\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/pschatzmann.png\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Syntax Hightlighting for OpenSCAD in Jupyterlab - Phil Schatzmann","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.pschatzmann.ch\/home\/2020\/02\/28\/syntax-hightlighting-for-openscad-in-jupyterlab\/","og_locale":"en_US","og_type":"article","og_title":"Syntax Hightlighting for OpenSCAD in Jupyterlab - Phil Schatzmann","og_description":"Out of the box Jupyterlab is providing a rich set of supported languages for Syntax Highlighting. Unfortunately OpenSCAD is not one of them. So I tried to research this topic: Internally Jupyterlab is using the CodeMirror editor and Codemirror allows to extend the syntax highlighting by defining custom modes. The [&hellip;]","og_url":"https:\/\/www.pschatzmann.ch\/home\/2020\/02\/28\/syntax-hightlighting-for-openscad-in-jupyterlab\/","og_site_name":"Phil Schatzmann","article_published_time":"2020-02-28T08:10:56+00:00","article_modified_time":"2020-11-21T21:22:46+00:00","og_image":[{"width":967,"height":665,"url":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2020\/02\/OpenSCAD-Syntax.png","type":"image\/png"}],"author":"pschatzmann","twitter_card":"summary_large_image","twitter_misc":{"Written by":"pschatzmann","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.pschatzmann.ch\/home\/2020\/02\/28\/syntax-hightlighting-for-openscad-in-jupyterlab\/#article","isPartOf":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2020\/02\/28\/syntax-hightlighting-for-openscad-in-jupyterlab\/"},"author":{"name":"pschatzmann","@id":"https:\/\/www.pschatzmann.ch\/home\/#\/schema\/person\/73a53638a4e34e8373405fd737dac9b1"},"headline":"Syntax Hightlighting for OpenSCAD in Jupyterlab","datePublished":"2020-02-28T08:10:56+00:00","dateModified":"2020-11-21T21:22:46+00:00","mainEntityOfPage":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2020\/02\/28\/syntax-hightlighting-for-openscad-in-jupyterlab\/"},"wordCount":143,"commentCount":0,"publisher":{"@id":"https:\/\/www.pschatzmann.ch\/home\/#\/schema\/person\/73a53638a4e34e8373405fd737dac9b1"},"image":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2020\/02\/28\/syntax-hightlighting-for-openscad-in-jupyterlab\/#primaryimage"},"thumbnailUrl":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2020\/02\/OpenSCAD-Syntax.png","articleSection":["3D Printing","OpenSCAD Kernel"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.pschatzmann.ch\/home\/2020\/02\/28\/syntax-hightlighting-for-openscad-in-jupyterlab\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.pschatzmann.ch\/home\/2020\/02\/28\/syntax-hightlighting-for-openscad-in-jupyterlab\/","url":"https:\/\/www.pschatzmann.ch\/home\/2020\/02\/28\/syntax-hightlighting-for-openscad-in-jupyterlab\/","name":"Syntax Hightlighting for OpenSCAD in Jupyterlab - Phil Schatzmann","isPartOf":{"@id":"https:\/\/www.pschatzmann.ch\/home\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2020\/02\/28\/syntax-hightlighting-for-openscad-in-jupyterlab\/#primaryimage"},"image":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2020\/02\/28\/syntax-hightlighting-for-openscad-in-jupyterlab\/#primaryimage"},"thumbnailUrl":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2020\/02\/OpenSCAD-Syntax.png","datePublished":"2020-02-28T08:10:56+00:00","dateModified":"2020-11-21T21:22:46+00:00","breadcrumb":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2020\/02\/28\/syntax-hightlighting-for-openscad-in-jupyterlab\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.pschatzmann.ch\/home\/2020\/02\/28\/syntax-hightlighting-for-openscad-in-jupyterlab\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.pschatzmann.ch\/home\/2020\/02\/28\/syntax-hightlighting-for-openscad-in-jupyterlab\/#primaryimage","url":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2020\/02\/OpenSCAD-Syntax.png","contentUrl":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2020\/02\/OpenSCAD-Syntax.png","width":967,"height":665},{"@type":"BreadcrumbList","@id":"https:\/\/www.pschatzmann.ch\/home\/2020\/02\/28\/syntax-hightlighting-for-openscad-in-jupyterlab\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.pschatzmann.ch\/home\/"},{"@type":"ListItem","position":2,"name":"Syntax Hightlighting for OpenSCAD in Jupyterlab"}]},{"@type":"WebSite","@id":"https:\/\/www.pschatzmann.ch\/home\/#website","url":"https:\/\/www.pschatzmann.ch\/home\/","name":"Phil Schatzmann Consulting","description":"","publisher":{"@id":"https:\/\/www.pschatzmann.ch\/home\/#\/schema\/person\/73a53638a4e34e8373405fd737dac9b1"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.pschatzmann.ch\/home\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.pschatzmann.ch\/home\/#\/schema\/person\/73a53638a4e34e8373405fd737dac9b1","name":"pschatzmann","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2022\/08\/pschatzmann.png","url":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2022\/08\/pschatzmann.png","contentUrl":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2022\/08\/pschatzmann.png","width":305,"height":305,"caption":"pschatzmann"},"logo":{"@id":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2022\/08\/pschatzmann.png"}}]}},"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/posts\/1121","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/comments?post=1121"}],"version-history":[{"count":9,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/posts\/1121\/revisions"}],"predecessor-version":[{"id":1131,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/posts\/1121\/revisions\/1131"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/media\/1122"}],"wp:attachment":[{"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/media?parent=1121"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/categories?post=1121"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/tags?post=1121"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}