<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>markdown codeblock Archives | Kernix Web Design</title>
	<atom:link href="https://kernixwebdesign.com/tag/markdown-codeblock/feed/" rel="self" type="application/rss+xml" />
	<link>https://kernixwebdesign.com/tag/markdown-codeblock/</link>
	<description>Website Design and Development</description>
	<lastBuildDate>Sun, 12 May 2024 18:11:39 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.7.2</generator>

<image>
	<url>https://kernixwebdesign.com/wp-content/uploads/2020/12/cropped-fav-icon3-32x32.png</url>
	<title>markdown codeblock Archives | Kernix Web Design</title>
	<link>https://kernixwebdesign.com/tag/markdown-codeblock/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Markdown Cheat Sheet for Beginners</title>
		<link>https://kernixwebdesign.com/website/code/markdown-cheat-sheet-beginners/</link>
		
		<dc:creator><![CDATA[Jim Kernicky]]></dc:creator>
		<pubDate>Tue, 15 Feb 2022 22:52:54 +0000</pubDate>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[github markdown cheat sheet]]></category>
		<category><![CDATA[markdown codeblock]]></category>
		<category><![CDATA[markdown syntax]]></category>
		<guid isPermaLink="false">https://kernixwebdesign.com/?p=20019</guid>

					<description><![CDATA[<p>You need to learn markdown if you have or contribute to repositories on websites like GitHub, or for forums and learning sites like freeCodeCamp. Specifically, you need it for creating and editing README and other documentation files. In this Markdown cheat sheet, I will show you the basic Markdown syntax . . .</p>
<p>The post <a href="https://kernixwebdesign.com/website/code/markdown-cheat-sheet-beginners/">Markdown Cheat Sheet for Beginners</a> appeared first on <a href="https://kernixwebdesign.com">Kernix Web Design</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>You need to learn markdown if you have or contribute to repositories on websites like GitHub, or for forums and learning sites like freeCodeCamp. Specifically, you need it for creating and editing README and other documentation files.</p>
<p>In this Markdown cheat sheet, I will show you the basic Markdown syntax to create your first README.md files followed by some intermediate and advanced syntax to make your repos look professional.</p>
<h2>Basic Markdown</h2>
<p>If you found this article then you already know what markdown is and that you need to learn it. I will not cover what it is, why you need it, who invented it, etc. Let’s get into it.</p>
<p>Below are some of the most common styling that you would want in your README files. Consider cloning or forking my <a href="https://github.com/Kernix13/markdown-cheatsheet" target="_blank" rel="noopener">markdown-cheatsheet repo on GitHub</a> to see examples of what you can do.</p>
<p>By the way, you can preview markdown in VS Code without an extension, although some markdown does not display such as footnotes. Look at the red arrow in the image below &#8211; just click on that. It helps to toggle the sidebar and been reduce the markdown file.</p>
<p><img fetchpriority="high" decoding="async" class="aligncenter wp-image-20057 size-full" src="https://kernixwebdesign.com/wp-content/uploads/2022/02/markdown-preview-lg.png" alt="Markdown preview button" width="600" height="372" srcset="https://kernixwebdesign.com/wp-content/uploads/2022/02/markdown-preview-lg.png 600w, https://kernixwebdesign.com/wp-content/uploads/2022/02/markdown-preview-lg-300x186.png 300w" sizes="(max-width: 600px) 100vw, 600px" /></p>
<h3>Headings and paragraphs</h3>
<p>Paragraphs are just regular text with 2 line breaks needed between each paragraph and other elements.</p>
<p>There are 6 heading sizes in markdown like there is in HTML, though I never use h5 or h6 for my pages. You just use 1 through 6 hashtags for heading1 through heading6.</p>
<p><strong>NOTE</strong>: There is an automatic horizontal rule added when you use syntax for H1 and H2.</p>
<div class="pre-container">
<pre class="code-block dark_block"><code data-line="1"><span class="blue"># Heading1</span></code> <code data-line="2"><span class="blue">## Heading2</span></code> <code data-line="3"><span class="blue">### Heading3</span></code></pre>
</div>
<h3>Blockquotes</h3>
<p>This would be useful to quote someone you are contributing with. Use a greater than sign (&gt;) to show a blockquote. Use 2 for nested blockquote but who does that?</p>
<div class="pre-container">
<pre class="code-block dark_block"><code data-line="5"><span class="green">&gt; This is a quote</span></code> <code data-line="6"><span class="green">&gt;</span></code> <code data-line="7"><span class="green">&gt; Try an empty line like above</span></code> <code data-line="8"><span class="green">&gt;</span></code> <code data-line="9"><span class="green">&gt; &gt; Or use a nested blockquote</span></code></pre>
</div>
<h3>Bold text</h3>
<p>Use either 2 asterisks or 2 underscores before and after the text for bold styling. The preferred syntax is to use asterisks for bold: **<strong>bold text</strong>** or __<strong>bold text</strong>__.</p>
<h3>Italic text</h3>
<p>Use a single asterisk or underscore before and after text to display it as italic. The preferred syntax is to use an underscore for italic: *<em>This is italic text</em>* and _<em>So is this</em>_.</p>
<h3>Bold &amp; italic text</h3>
<p>Use either 3 asterisks before and after the word(s) or 2 asterisks and an underscore:</p>
<div class="pre-container">
<pre class="code-block dark_block"><code data-line="11">***This is bold and italic text***</code> <code data-line="12">**_This is ALSO bold and italic text_**</code></pre>
</div>
<h3>Strikethrough text</h3>
<p>Use two tildes (~~) before and after the text you want to display as <del>strikethrough</del>. I have never used strikethrough but maybe you do:</p>
<div class="pre-container">
<pre class="code-block dark_block"><code data-line="13">~~Strikethrough text~~</code></pre>
</div>
<h3>Horizontal rules</h3>
<p>The way I prefer to make a horizontal rule is with 3 dashes with a space between them, but you could use 3 dashes without a space or 3 asterisks with or without spaces:</p>
<div class="pre-container">
<pre class="code-block dark_block"><code data-line="20"><span class="blue">- - -</span></code> <code data-line="21"><span class="blue">---</span></code> <code data-line="22"><span class="blue">* * *</span></code> <code data-line="23"><span class="blue">***</span></code></pre>
</div>
<p><strong>NOTE</strong>: Make sure to hit <em>ENTER</em> twice if you intend to use 3 asterisks without spaces or it will set the text above it to an H3 tag.</p>
<hr />
<h3>Inline Code</h3>
<p>You can use code in a sentence and highlight it by using a single backtick before and after the code such as <span class="inline-code">&lt;div class=&#8221;row&#8221;&gt;</span>:</p>
<div class="pre-container">
<pre class="code-block dark_block"><code data-line="1"><span class="blue">`&lt;div class="row"&gt;`</span></code></pre>
</div>
<h3>Code blocks</h3>
<p>For multi-line code blocks use 3 backticks before and after the code block:</p>
<div class="pre-container">
<pre class="code-block dark_block">        ```
        pre span {
          display: inline-block;
        }
        ```
</pre>
</div>
<h3>External Links</h3>
<p>Links have 2 parts to them with an optional parameter. The link text goes between square brackets [ ], and the URL goes inside parentheses ( ). You can also add a title for the link that will display when a user hovers over the link. To do that you would and a space after the URL and then inside a set of double-quotes add a link title:</p>
<div class="pre-container">
<pre class="code-block dark_block"><code data-line="1">[<span class="light-blue">Kernix Web Design</span>](https://kernixwebdesign.com <span class="light-blue">'Home page'</span>)</code></pre>
</div>
<h3>Anchor links</h3>
<p>By &#8220;anchor&#8221; links, I mean links that go to a section of the page as opposed to another page or website.</p>
<p>This can be done in at least two different ways. For all the links in the table of contents in my repo (see link at top), I use the <em>easy</em> method. But for the <strong>Back to Top</strong> link, I use an actual &lt;a&gt; tag.</p>
<p>You need to use the same syntax of square brackets and parentheses for links with both methods: [Link text](URL).</p>
<p>The first method is to add an empty &lt;a&gt; tag with an id attribute that matches the hashed URL link:</p>
<div class="pre-container">
<pre class="code-block dark_block"><code data-line="1">&lt;<span class="green">a</span> <span class="blue">name</span>=<span class="light-blue">"top_anchor"</span>&gt;&lt;/<span class="green">a</span>&gt;</code> <code data-line="2">[<span class="light-blue">Back To Top</span>](#top_anchor)</code></pre>
</div>
<p>The second method is more common especially for table of contents links in README files. You put the exact text that you want to link to in the square brackets with the same case. In the parentheses you start with a hash symbol followed by the exact text all in lowercase and connected with dashes:</p>
<div class="pre-container">
<pre class="code-block dark_block"><code data-line="1">[<span class="light-blue">Exact words in target link</span>](#exact-words-in-target-link)</code></pre>
</div>
<h3>Images</h3>
<p>The syntax for an image is identical for a link with the exception of adding an exclamation mark (!) before the opening square bracket. Also, replace the link text with alt text:</p>
<div class="pre-container">
<pre class="code-block dark_block"><code data-line="1">![<span class="light-blue">alt text</span>](https://via.placeholder.com/150)</code></pre>
</div>
<h3>Lists</h3>
<p>You can use either an asterisk or a dash followed by a space to make a bulleted list. I prefer using a dash since you do not need to use the <em>SHIFT</em> key. For nested lists, use the <em>SPACEBAR</em> key to align directly beneath the first character in the parent list item to create a nested list:</p>
<div class="pre-container">
<pre class="code-block dark_block">    <span class="orange">-</span> List item one
    <span class="orange">-</span> List item two
      <span class="orange">-</span> Child item one
</pre>
</div>
<p>Use a number followed by a period (1., 2., 3. etc.) to create an ordered list. For a nested ordered list, do the same as for nested unordered lists &#8211; align the number to be below the first character of the parent item.</p>
<div class="pre-container">
<pre class="code-block dark_block">    <span class="orange">1.</span> List item one
    <span class="orange">1.</span> List item two
        <span class="orange">1.</span> Child item one
</pre>
</div>
<p><strong>NOTE</strong>: By using &#8220;1&#8221; for each list item, you can cut &amp; paste to change the order of items and the numbering will change to match the new order.</p>
<h2>More advanced Markdown</h2>
<p>Use the following markdown syntax for “fancy pants” markdown files.</p>
<h3>Code blocks with code highlighting</h3>
<p>A really nice feature for code blocks is to have basic syntax highlighting by adding the language after the first set of triple backticks. Here are the languages I have tested but check out my repo for examples: <span class="inline-code">md</span>, <span class="inline-code">html</span>, <span class="inline-code">css</span>, <span class="inline-code">js</span>, <span class="inline-code">json</span>, <span class="inline-code">php</span>, <span class="inline-code">sql</span>, <span class="inline-code">xml</span>, <span class="inline-code">svg</span>, <span class="inline-code">python</span>, <span class="inline-code">apacheconf</span>, …</p>
<div class="pre-container">
<pre class="code-block dark_block">```css
    <code data-line="1"><span class="green">pre</span> <span class="green">span</span> {</code> <code data-line="2"> <span class="blue">display</span>: inline-block;</code> <code data-line="3">}</code> ```</pre>
</div>
<p>I did not create any CSS to show you the styling for most of the fancier markdown features so check the repo to see what it looks like.</p>
<h3>Diff code blocks</h3>
<p>These are really nice for highlighting changed values and the new values. Use diff after the opening triple backticks, then a minus sign (-) and space for what was changed, and a positive sign (+) and a space for the new text/code.</p>
<div class="pre-container">
<pre class="code-block dark_block"><code>```diff</code> <code><span class="red">- this code or text is the old version</span></code> <code><span class="green">+ this is what it was changed to</span></code> <code>```</code></pre>
</div>
<h3>Comments</h3>
<p>This is a nice way to add a comment in the editor view of your markdown file. This would be good for teams members editing a documentation page for a new section. The best way is to use HTML syntax:</p>
<div class="pre-container">
<pre class="code-block dark_block"><code data-line="1"><span class="comment">&lt;!-- HTML comments work best IMO --&gt;</span></code></pre>
</div>
<h3>Tasks</h3>
<p>You can create what looks like checkboxes and display completed tasks with a checkmark. It takes the form of an unordered list with the first characters being a set of square brackets [ ] which MUST have a space in them. For a completed task, add either a lower or uppercase &#8220;X&#8221; inside the square brackets [x].</p>
<div class="pre-container">
<pre class="code-block dark_block"><code data-line="1"><span class="orange">-</span> [ ] incomplete task</code> <code data-line="2"><span class="orange">-</span> [<span class="light-blue">x</span>] completed task</code> <code data-line="3"> <span class="orange">-</span> [ ] incomplete subtask</code> <code data-line="4"> <span class="orange">-</span> [<span class="light-blue">x</span>] completed subtask</code></pre>
</div>
<h3>Tables</h3>
<p>I only used this for the Pull Requests and Issues I opened on freeCodeCamp. That table is a list of common prefixes to include in your titles (check out my <a href="https://github.com/Kernix13/beginner-git-commands" target="_blank" rel="noopener">Beginner Git Commands repo</a>). Here is a generic table.</p>
<p>Pay attention to the syntax that is creating the column divisions and alignment. The pipes create the columns and the colons determine the alignment.</p>
<div class="pre-container">
<pre class="code-block dark_block">    | Left aligned | Center aligned | Right aligned |
    | :----------- | :------------: | ------------: |
    | Content Left | Content Center | Content Right |
    | Content Left | Content Center | Content Right |
    | Content Left | Content Center | Content Right |
    | Content Left | Content Center | Content Right |
</pre>
</div>
<h3>Footnotes</h3>
<p>I assume footnotes would be useful in a very technical or long README file. Use square brackets where you want a footnote link to appear and use a caret symbol (^) followed by the number of the footnote. Then below that area add the same syntax followed by a colon and the note itself. That will make the footnote text appear at the bottom of your file.</p>
<p>Here is what your text with the footnote syntax will look like:</p>
<div class="pre-container">
<pre class="code-block dark_block"><code data-line="1">Footnote.[<span class="light-blue">^1</span>]</code> <code data-line="2">Another footnote.[<span class="light-blue">^2</span>]</code></pre>
</div>
<p>Here is the syntax for the actual footnote:</p>
<div class="pre-container">
<pre class="code-block dark_block"><code data-line="4">[<span class="light-blue">^1</span>]: This is footnote number one.</code> <code data-line="5">[<span class="light-blue">^2</span>]: Here is the second footnote.</code></pre>
</div>
<h2>Final Thoughts</h2>
<p>There is a lot more you can do with your markdown files like actually using HTML tags. I have seen &lt;a&gt;, &lt;p&gt; and &lt;span&gt; tags in profile MD files, but I have not done much research into what you can and cannot use. I have also seen videos in markdown files so that would be something to look into for your GitHub profile.</p>
<p>Also note that all the syntax can be used in Discord and Slack, though slack has editor buttons for them, whereas Discord does not. I also see markdown used in forums and support tickets for some websites and hosting companies.</p>
<p>Here are some additional links that you can use to build your own Markdown cheat sheet:</p>
<ol>
<li><a href="https://daringfireball.net/projects/markdown/">Daring Fireball</a>: Check out the Markdown Basics and Syntax tabs.</li>
<li><a href="https://dev.to/nikolab/complete-list-of-github-markdown-emoji-markup-5aia">Complete list of github markdown emojis</a></li>
<li><a href="https://gist.github.com/rxaviers/7360908">GitHub emoji list</a></li>
</ol>
<p>Here is a markdown cheat sheet in table version (basic code only):</p>
<table>
<thead>
<tr>
<th>Format</th>
<th>Syntax</th>
</tr>
</thead>
<tbody>
<tr>
<td>H1</td>
<td>#</td>
</tr>
<tr>
<td>H2</td>
<td>##</td>
</tr>
<tr>
<td>H3</td>
<td>###</td>
</tr>
<tr>
<td>H4</td>
<td>####</td>
</tr>
<tr>
<td>Italics</td>
<td>*italics*</td>
</tr>
<tr>
<td>Bold</td>
<td>**Bold**</td>
</tr>
<tr>
<td>Strike thru</td>
<td>~~strikethrough~~</td>
</tr>
<tr>
<td>Horiz. Rule</td>
<td>&#8211; &#8211; &#8211;</td>
</tr>
<tr>
<td>Block quote</td>
<td>&gt; text here</td>
</tr>
<tr>
<td>Links</td>
<td>[link text](domain.com)</td>
</tr>
<tr>
<td>Anchor link</td>
<td>[Exact text](#exact-text)</td>
</tr>
<tr>
<td>Footnote link</td>
<td>[^1]</td>
</tr>
<tr>
<td>Footnote text</td>
<td>[^1]: text here</td>
</tr>
<tr>
<td>Image</td>
<td>![alt text](domain.com)</td>
</tr>
<tr>
<td>Comment</td>
<td>&lt;!&#8211; comment &#8211;&gt;</td>
</tr>
<tr>
<td>Unordered list</td>
<td>&#8211; List item * List item</td>
</tr>
<tr>
<td>Inline Code</td>
<td>`insert code here`</td>
</tr>
<tr>
<td>Code block</td>
<td>3 backticks</td>
</tr>
</tbody>
</table>
<p>The post <a href="https://kernixwebdesign.com/website/code/markdown-cheat-sheet-beginners/">Markdown Cheat Sheet for Beginners</a> appeared first on <a href="https://kernixwebdesign.com">Kernix Web Design</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
