GitHub/GitHub Flavored Markdown

From Omnia
Revision as of 15:07, 29 April 2023 by Kenneth (talk | contribs) (→‎List Items)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

GitHub Flavored Markdown

GitHub Flavored Markdown · GitHub Help - https://help.github.com/articles/github-flavored-markdown

Daring Fireball: Markdown Syntax Documentation - http://daringfireball.net/projects/markdown/syntax

Markdown Cheatsheet · adam-p/markdown-here Wiki - https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet

Getting Started - https://githubtraining.github.io/training-manual/#/02_getting_started

Markdown Tutorial

https://commonmark.org/help/tutorial/
https://spec.commonmark.org/dingus/
https://commonmark.org/help/

Code

new lines

These will
be on the same line

These will[space][space]
be on a different line

header levels

# h1
## h2
#### h4
level 1
=======
level 2
-------

Text Styles

*This text will be italic*

_This will also be italic_

**This text will be bold**

__This will also be bold__

___This will be combined bold and italic___

***This will also be combined bold and italic***

code blocks

    four spaces will
    make this a 'pre' block

Fenced code blocks: (similar to 'pre' block)

```
code
```

In line word fencing:

some `fenced words` fenced

Highlighted code block:

```javascript
...
```

List Items

A single * or - followed by a space will create a bulleted list.

* Item 1
* Item 2
- Item 1
- Item 2

Ordered lists: (any number and dot)

1. item 1
1. item 2
1. item 3

Sub Lists:

* parent
   * child

1. parent
   1. child
1. another
   * child

Checklist

A - followed by a space and [ ] will create a handy checklist in your issue or pull request.

- [ ] item 1
- [ ] item 2

Mentions

When you @mention someone in an issue, they will receive a notification - even if they are not currently subscribed to the issue or watching the repository.

@mention

Issue

A # followed by the number of an issue or pull request (without a space) in the same repository will create a cross-link.

#975

Emoji

GitHub allows you to drop emoji into your comments. Simply surround the emoji ID with :.

:smiley:

GitHub Pages

For a project site, GitHub will only serve content from a specified branch. You can also choose to publish your site from a /docs folder on the specified branch.

/doc

The rendered sites for our projects will appear at githubschool.github.io/repo-name.

http://githubschool.github.io/repo-name

Sample Content

Sample content: [1] (even this doesn't work as described!)



GitHub Flavored Markdown
================================

*View the [source of this content](http://github.github.com/github-flavored-markdown/sample_content.html).*

Let's get the whole "linebreak" thing out of the way. The next paragraph contains two phrases separated by a single newline character:

Roses are red
Violets are blue

The next paragraph has the same phrases, but now they are separated by two spaces and a newline character:

Roses are red  
Violets are blue

Oh, and one thing I cannot stand is the mangling of words with multiple underscores in them like perform_complicated_task or do_this_and_do_that_and_another_thing.

A bit of the GitHub spice
-------------------------

In addition to the changes in the previous section, certain references are auto-linked:

* SHA: be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2
* User@SHA ref: mojombo@be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2
* User/Project@SHA: mojombo/god@be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2
* \#Num: #1
* User/#Num: mojombo#1
* User/Project#Num: mojombo/god#1

These are dangerous goodies though, and we need to make sure email addresses don't get mangled:

My email addy is tom@github.com.

Math is hard, let's go shopping
-------------------------------

In first grade I learned that 5 > 3 and 2 < 7. Maybe some arrows. 1 -> 2 -> 3. 9 <- 8 <- 7.

Triangles man! a^2 + b^2 = c^2

We all like making lists
------------------------

The above header should be an H2 tag. Now, for a list of fruits:

* Red Apples
* Purple Grapes
* Green Kiwifruits

Let's get crazy:

1.  This is a list item with two paragraphs. Lorem ipsum dolor
    sit amet, consectetuer adipiscing elit. Aliquam hendrerit
    mi posuere lectus.

    Vestibulum enim wisi, viverra nec, fringilla in, laoreet
    vitae, risus. Donec sit amet nisl. Aliquam semper ipsum
    sit amet velit.

2.  Suspendisse id sem consectetuer libero luctus adipiscing.

What about some code **in** a list? That's insane, right?

1. In Ruby you can map like this:

        ['a', 'b'].map { |x| x.uppercase }

2. In Rails, you can do a shortcut:

        ['a', 'b'].map(&:uppercase)

Some people seem to like definition lists

<dl>
  <dt>Lower cost</dt>
  <dd>The new version of this product costs significantly less than the previous one!</dd>
  <dt>Easier to use</dt>
  <dd>We've changed the product so that it's much easier to use!</dd>
</dl>

I am a robot
------------

Maybe you want to print `robot` to the console 1000 times. Why not?

    def robot_invasion
      puts("robot " * 1000)
    end

You see, that was formatted as code because it's been indented by four spaces.

How about we throw some angle braces and ampersands in there?

    <div class="footer">
        © 2004 Foo Corporation
    </div>

Set in stone
------------

Preformatted blocks are useful for ASCII art:

<pre>
             ,-. 
    ,     ,-.   ,-. 
   / \   (   )-(   ) 
   \ |  ,.>-(   )-< 
    \|,' (   )-(   ) 
     Y ___`-'   `-' 
     |/__/   `-' 
     | 
     | 
     |    -hrr- 
  ___|_____________ 
</pre>

Playing the blame game
----------------------

If you need to blame someone, the best way to do so is by quoting them:

> I, at any rate, am convinced that He does not throw dice.

Or perhaps someone a little less eloquent:

> I wish you'd have given me this written question ahead of time so I
> could plan for it... I'm sure something will pop into my head here in
> the midst of this press conference, with all the pressure of trying to
> come up with answer, but it hadn't yet...
>
> I don't want to sound like
> I have made no mistakes. I'm confident I have. I just haven't - you
> just put me under the spot here, and maybe I'm not as quick on my feet
> as I should be in coming up with one.

Table for two
-------------

<table>
  <tr>
    <th>ID</th><th>Name</th><th>Rank</th>
  </tr>
  <tr>
    <td>1</td><td>Tom Preston-Werner</td><td>Awesome</td>
  </tr>
  <tr>
    <td>2</td><td>Albert Einstein</td><td>Nearly as awesome</td>
  </tr>
</table>

Crazy linking action
--------------------

I get 10 times more traffic from [Google] [1] than from
[Yahoo] [2] or [MSN] [3].

  [1]: http://google.com/        "Google"
  [2]: http://search.yahoo.com/  "Yahoo Search"
  [3]: http://search.msn.com/    "MSN Search"

My Sample

Source: https://github.com/kiloforce/markdowntest

<!-- Source: https://github.com/kiloforce/markdowntest -->

# This is an h1 level tag
## This is an h2 level tag
###### This is an h6 level tag


<!-- This is a
comment, has to be on a new line! -->


<!-- line breaks are merged -->
Roses are Red
Violets are Blue


Text Styles:

*This text will be italic*

_This will also be italic_

**This text will be bold**

__This will also be bold__

___This will be combined bold and italic___

***This will also be combined bold and italic***


Unordered Lists:

* Item 1
* Item 2
  * Item 2a
  * Item 2b


Ordered Lists:
<!-- make sure to have a line seperation -->

1. Item 1
2. Item 2
3. Item 3
   * Item 3a
   * Item 3b

Images:
![GitHub Logo](http://icons.iconarchive.com/icons/icons-land/vista-hardware-devices/256/Hardware-Chip-icon.png)
Format: ![Alt Text](http://icons.iconarchive.com/icons/icons-land/vista-hardware-devices/256/Hardware-Chip-icon.png)


Links:
http://github.com - automatic!
[GitHub](http://github.com)


Blockquotes:
As Kanye West said:

> We're living the future so
> the present is our past.



Syntax highlighting:
```javascript
function fancyAlert(arg) {
  if(arg) {
    $.facebox({div:'#foo'})
  }
}
```

```
This is how you do
preformatted text
   XX
 XX  XX
```



Here is a Python code example
without syntax highlighting:

<!-- Make sure to have 4 spaces in front -->
    def foo:
      if not bar:
        return true


`
I am in a box, but I am not preformatted
  XX
XX  XX
`

Task Lists:
- [ ] a task list item
- [ ] list syntax required
- [ ] normal **formatting**,
      @mentions, #1234 refs
- [ ] incomplete
- [x] completed


I think you should use an
`<addr>` element here instead.