{"id":3734,"date":"2022-08-25T10:31:56","date_gmt":"2022-08-25T14:31:56","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/16-223\/f2022\/work\/?p=3734"},"modified":"2022-08-25T10:32:23","modified_gmt":"2022-08-25T14:32:23","slug":"code-posting-examples","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/16-223\/f2022\/work\/2022\/08\/25\/code-posting-examples\/","title":{"rendered":"Code Posting Examples"},"content":{"rendered":"\n<p>The preferred mode for posting CircuitPython code is to use a SyntaxHighlighter Code block type, setting the &#8220;Code Language&#8221; to &#8220;Python&#8221; in the properties (on the right).  That way the code can be cut and pasted, has line numbers, and colored keywords for legibility.<\/p>\n\n\n\n<h2>SyntaxHighlighter Code Block<\/h2>\n\n\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\nwhile True:\n    led.value = True\n    print(&quot;On&quot;)\n    time.sleep(1.0)\n\n    led.value = False\n    print(&quot;Off&quot;)\n    time.sleep(1.0)\n<\/pre>\n\n\n<h2>Plain &#8220;Code&#8221; Block Sample<\/h2>\n\n\n\n<p>The default &#8220;Code&#8221; block style isn&#8217;t very readable with this site template, see below.  Please avoid this style.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>while True:\n    led.value = True\n    print(\"On\")\n    time.sleep(1.0)\n\n    led.value = False\n    print(\"Off\")\n    time.sleep(1.0)\n<\/code><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The preferred mode for posting CircuitPython code is to use a SyntaxHighlighter Code block type, setting the &#8220;Code Language&#8221; to &#8220;Python&#8221; in the properties (on the right). That&#8230;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/courses.ideate.cmu.edu\/16-223\/f2022\/work\/wp-json\/wp\/v2\/posts\/3734"}],"collection":[{"href":"https:\/\/courses.ideate.cmu.edu\/16-223\/f2022\/work\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/courses.ideate.cmu.edu\/16-223\/f2022\/work\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/16-223\/f2022\/work\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/16-223\/f2022\/work\/wp-json\/wp\/v2\/comments?post=3734"}],"version-history":[{"count":5,"href":"https:\/\/courses.ideate.cmu.edu\/16-223\/f2022\/work\/wp-json\/wp\/v2\/posts\/3734\/revisions"}],"predecessor-version":[{"id":5228,"href":"https:\/\/courses.ideate.cmu.edu\/16-223\/f2022\/work\/wp-json\/wp\/v2\/posts\/3734\/revisions\/5228"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/16-223\/f2022\/work\/wp-json\/wp\/v2\/media?parent=3734"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/16-223\/f2022\/work\/wp-json\/wp\/v2\/categories?post=3734"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/16-223\/f2022\/work\/wp-json\/wp\/v2\/tags?post=3734"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}