{"id":118,"date":"2018-02-28T15:35:46","date_gmt":"2018-02-28T19:35:46","guid":{"rendered":"https:\/\/benjaminray.com\/codebase\/?p=118"},"modified":"2024-04-08T02:36:28","modified_gmt":"2024-04-08T05:36:28","slug":"post-guidelines-outdated","status":"publish","type":"post","link":"https:\/\/benjaminray.com\/codebase\/post-guidelines-outdated\/","title":{"rendered":"Post Guidelines &#8211; Outdated (Google Prettify)"},"content":{"rendered":"<h2>Background<\/h2>\n<p>This site uses <a href=\"https:\/\/daringfireball.net\/projects\/markdown\/\" target=\"_blank\" rel=\"noopener noreferrer\">Markdown<\/a> for simplified input and <a href=\"https:\/\/github.com\/google\/code-prettify\" target=\"_blank\" rel=\"noopener noreferrer\">Google Prettify<\/a> for syntax highlighting.<\/p>\n<h2>Adding Code to a Post<\/h2>\n<p>There are two ways to add code to a post using Markdown.  Either indent the code with 4 spaces or a tab, or wrap the code block with three back-ticks (&#96;&#96;&#96;).<\/p>\n<h3>Example of the indented option:<\/h3>\n<div class=\"br-row\">\n<div class=\"br-half-sm\">\nInput:<\/p>\n<pre class=\"noprettyprint\">\n    var s = 'some test';\n    console.log(s);<\/pre>\n<\/p><\/div>\n<div class=\"br-half-sm\">\nOutput:<br \/>\n<!-- Had to use pre\/code tags to simulate this output as the indenting method doesn't work when it is inside a div --><\/p>\n<pre><code>var s = 'some test';\nconsole.log(s);<\/code><\/pre>\n<\/p><\/div>\n<\/div>\n<h3>Example of using back-ticks:<\/h3>\n<div class=\"br-row\">\n<div class=\"br-half-sm\">\nInput:<\/p>\n<pre class=\"noprettyprint\">\n&#96;&#96;&#96;\nvar s = 'some test';\nconsole.log(s);\n&#96;&#96;&#96;\n<\/pre>\n<\/p><\/div>\n<div class=\"br-half-sm\">\nOutput:<\/p>\n<p><!-- Had to use pre\/code tags to simulate this output as the three backticks don't work when they are inside a div --><\/p>\n<pre><code>var s = 'new test';\nalert('test');\n<\/code><\/pre>\n<\/p><\/div>\n<\/div>\n<p>One advantage to using the back-ticks method is that you can add a language hint, which may be require if PrettyPrint is incorrectly guessing the language, or the language is VB:<\/p>\n<pre class=\"noprettyprint\">\n```vb\nDim str as String\n&#039; Some comment\nstr = New String(&quot;test&quot;)\n```\n<\/pre>\n<h2>Inline Code<\/h2>\n<p>To add inline code, wrap it in single backticks &#96;like this&#96; and it will be wrapped in a code tag and look <code>like this<\/code>. (Note: I have not enabled highlighting for code tags, and if I do enable it, there's no way to specify the language, so it wouldn't properly highlight VB.)<\/p>\n<p>To include a backtick in regular text (not in inline code), escape it with a backslash: &#92;`<\/p>\n<p>To include a backtick inside a piece of inline code <code>like ` this<\/code>, open and close the code tag with a different number of backticks than appear in the inline code. E.g. If you want to display 1 backtick in the inline code, open\/close with two or more. To include two in a row in the code tag, open\/close with 1 or 3 or more. &#96;&#96;this&#96;works&#96;&#96; becomes <code>this`works<\/code>, &#96;this&#96;&#96;works&#96; becomes <code>this``works<\/code>, etc.<br \/>\nMore info here: <a href=\"https:\/\/meta.stackexchange.com\/a\/70679\/286764\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/meta.stackexchange.com\/a\/70679\/286764<\/a><\/p>\n<h2>&lt;PRE&gt; Tag Without Syntax Highlighting<\/h2>\n<p>To include a &#x3C;pre&#x3E; tag without syntax highlighting, simply add the class <code>noprettyprint<\/code> to it. E.g.:<\/p>\n<div class=\"br-row\">\n<div class=\"br-half-sm\">\n    Input:<\/p>\n<pre class=\"noprettyprint\">\n&lt;pre class=&quot;noprettyprint&quot;&gt;\n    Some stuff inside a PRE tag\n&lt;\/pre&gt;\n<\/pre>\n<\/p><\/div>\n<div class=\"br-half-sm\">\nOutput:<\/p>\n<pre class=\"noprettyprint\">\nSome stuff inside a PRE tag\n<\/pre>\n<\/p><\/div>\n<\/div>\n<h2>VB.Net<\/h2>\n<p>VB is not automatically detected by PrettyPrint, and it requires a language hint. Otherwise, single quote would be interpreted as the start of a string, not a comment. To add a language hint in Markdown, you must open and close the code block with &#96;&#96;&#96;, with the language hint on the opening quotes: &#96;&#96;&#96;vb.  (No indenting required when opening and closing a code block this way.)<\/p>\n<p>Input:<\/p>\n<pre class=\"noprettyprint\">\n&#96;&#96;&#96;vb\nProtected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load\n    If Not Page.IsPostBack Then\n        ' Populate email modal with some defaults\n        ucModalEmail.DefaultSubject = \"Daily Work Schedule | 2017-11-23 (Tue)\"\n        ucModalEmail.Subject = ucModalEmail.DefaultSubject\n    End If\nEnd Sub\n&#96;&#96;&#96;\n<\/pre>\n<p>Output:<\/p>\n<pre><code class=\"language-vb\">Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load\n    If Not Page.IsPostBack Then\n        ' Populate email modal with some defaults\n        ucModalEmail.DefaultSubject = \"Daily Work Schedule | 2017-11-23 (Tue)\"\n        ucModalEmail.Subject = ucModalEmail.DefaultSubject\n    End If\nEnd Sub\n<\/code><\/pre>\n<p>Note: You can always manually create the &#x3C;pre&#x3E;&#x3C;code&#x3E;...&#x3C;\/code&#x3E;&#x3C;\/pre&#x3E; tags with the language specified.<\/p>\n<p>Input:<\/p>\n<pre class=\"noprettyprint\">\n&#x3C;pre&#x3E;\n&#x3C;code class=&#x22;language-vb&#x22;&#x3E;\nProtected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load\n    If Not Page.IsPostBack Then\n        &#x27; Populate email modal with some defaults\n        ucModalEmail.DefaultSubject = &#x22;Daily Work Schedule | 2017-11-23 (Tue)&#x22;\n        ucModalEmail.Subject = ucModalEmail.DefaultSubject\n    End If\nEnd Sub\n&#x3C;\/code&#x3E;\n&#x3C;\/pre&#x3E;\n<\/pre>\n<p>Output:<\/p>\n<pre>\n<code class=\"language-vb\">Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load\n    If Not Page.IsPostBack Then\n        ' Populate email modal with some defaults\n        ucModalEmail.DefaultSubject = \"Daily Work Schedule | 2017-11-23 (Tue)\"\n        ucModalEmail.Subject = ucModalEmail.DefaultSubject\n    End If\nEnd Sub<\/code>\n<\/pre>\n<h2>ASP.Net<\/h2>\n<p>No need to include a language hint, and there is no language hint for ASP or ASP.Net anyway.<\/p>\n<p>Input:<\/p>\n<pre class=\"noprettyprint\">\n&#96;&#96;&#96;\n&lt;asp:Label ID=\"lblTestLabel\" runat=\"server\"&gt;This is a label&lt;\/asp:Label&gt;\n&lt;asp:PlaceHolder ID=\"pnlTitle_NewPermit\" runat=\"server\"&gt;  \n&nbsp;&nbsp;&nbsp;&nbsp;&lt;asp:Literal ID=\"liNewType\" runat=\"server\"&gt;&lt;\/asp:Literal&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;Some Content Here\n&lt;\/asp:PlaceHolder&gt;\n&#96;&#96;&#96;\n<\/pre>\n<p>Output:<\/p>\n<pre><code>&lt;asp:Label ID=\"lblTestLabel\" runat=\"server\"&gt;This is a label&lt;\/asp:Label&gt;\n&lt;asp:PlaceHolder ID=\"pnlTitle_NewPermit\" runat=\"server\"&gt;\n    &lt;asp:Literal ID=\"liNewType\" runat=\"server\"&gt;&lt;\/asp:Literal&gt;\n    Some Content Here\n&lt;\/asp:PlaceHolder&gt;\n<\/code><\/pre>\n<p>Notes: When using ASP.Net markup with ASP tags inside a property, the tag will not be properly highlighted, as seen here:<\/p>\n<pre><code>&lt;asp:UpdatePanel ID=\"UpdatePanel1\" runat=\"server\"&gt;\n  &lt;ContentTemplate&gt;\n    &lt;asp:Literal ID=\"liNewType\" runat=\"server\"&gt;&lt;\/asp:Literal&gt;\n    &lt;asp:Button ID=\"SubmitButton\" \n        runat=\"server\" \n        Text=\"partial postback\"\n        CommandArgument=\"&lt;%#Eval('id')%&gt;\" \/&gt;\n  &lt;\/ContentTemplate&gt;\n&lt;\/asp:UpdatePanel&gt;\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Background This site uses Markdown for simplified input and Google Prettify for syntax highlighting. Adding Code to a Post There are two ways to add code to a post using  [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[1],"tags":[],"class_list":["post-118","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"acf":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9GNjN-1U","jetpack_likes_enabled":false,"_links":{"self":[{"href":"https:\/\/benjaminray.com\/codebase\/wp-json\/wp\/v2\/posts\/118","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/benjaminray.com\/codebase\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/benjaminray.com\/codebase\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/benjaminray.com\/codebase\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/benjaminray.com\/codebase\/wp-json\/wp\/v2\/comments?post=118"}],"version-history":[{"count":150,"href":"https:\/\/benjaminray.com\/codebase\/wp-json\/wp\/v2\/posts\/118\/revisions"}],"predecessor-version":[{"id":1521,"href":"https:\/\/benjaminray.com\/codebase\/wp-json\/wp\/v2\/posts\/118\/revisions\/1521"}],"wp:attachment":[{"href":"https:\/\/benjaminray.com\/codebase\/wp-json\/wp\/v2\/media?parent=118"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/benjaminray.com\/codebase\/wp-json\/wp\/v2\/categories?post=118"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/benjaminray.com\/codebase\/wp-json\/wp\/v2\/tags?post=118"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}