Skip to content

PHP

MD(markdown) file

Author
siwon
Date
2023-09-12 17:37
Views
1240

What is Markdown?

Markdown is a lightweight markup language that describes how text should look on a page. HTML is another example of a markup language. Markdown is a style of writing documents that makes it easy to define what the content should look like. It describes headers, text styles, links, lists and so much more. 

Markdown is used in documentation, articles, and notes and can even be used to build a webpage. If you use GitHub, you'll be familiar with the “readme.md” files that show up in the root of a repository. That “md” stands for markdown. You can even create a readme on your GitHub profile to customize your GitHub profile page. Example of GitHub readme.md file: 

image?url=https%3A%2F%2Fd2o2utebsixu4k.cloudfront.net%2Fmedia%2Fimages%2F1669549083610-what-is-markdown.png&w=3840&q=75

  • It's a very readable syntax and it can be converted into HTML, XHTML as well as in other formats. Its main purpose is readability and ease of use. 
  • Markdown Editors: You can write markdown in any text editor, Markpad, HarooPad, MarkdownPad2 and Typora, but it's really nice to have something that gives you a preview of what it is going to look like. So what we are going to use is Visual Studio Code(VS Code) with an extension called “Auto Open Markdown Previewer''. Given below is the image of the extension that we are going to use:

image?url=https%3A%2F%2Fd2o2utebsixu4k.cloudfront.net%2Fmedia%2Fimages%2F1669549112057-what-is-markdown-1.png&w=3840&q=75

Why Should You Use Markdown?

  • Simple Learning Curve: Markdown is very simple to learn. The official syntax can be found on the website: daringfireball. However, you need to know that typing *word* will make it bold, typing _word_ will change that word to italics, and adding a - sign before the word will create lists. Also, it is much easier to read raw Markdown than raw HTML. 
  • Easy HTML Conversion: Markdown has built-in software to convert a plain text to HTML. Hence it can also be considered as a text-to-HTML conversion software in addition to being a markup language. 
  • Create Static Sites Easily: Markdown empowers you to make free, simple, and static sites utilizing open-source tools like Mkdocs, Jekyll, or Read the Docs.  
  • Easy Sharing and Syncing: You can easily sync and share files created in the Markdown editor to Dropbox, Google Drive, and WordPress.  
  • Diversification: Since Markdown is just plain text, it can be converted into a bunch of formats like PDF, epub, Docx, HTML, etc. To acquire in-depth skills in web development, visit KnowledgeHut’s online Web Development Course and learn development from scratch. 

How Does Markdown Work?

Working of Markdown can be explained in the following four steps: 

  1. Create Markdown file: The first step is to create a Markdown file with “.md” or “.markdown” extension. 
  2. Open File in Markdown Application: You need a Markdown application capable of processing the Markdown file. There are lots of applications available such as Typora, Ghostwriter, etc. 
  3. Working of Markdown Application: Markdown applications use Markdown processors to take the Markdown-formatted text and output it to HTML format.  
  4. View the file in a web browser: The final rendered output of your document can now be viewed in a web browser. Following is the visual representation of the process:

How Does Markdown Works

Markdown Syntax- A Quick Primer (with Example)

Following are some basic syntax for markdown. This is a quick markdown guide: 

1. Headings

For adding headings in Markdown, we use the hashtag sign. For the h1 heading, we add one hashtag. For the h2 heading, we add two hashtags, and so on. Given below is an example program to add headings in Markdown: 

# This is h1 heading
## This is h2 heading
### This is h3 heading

Output:

image?url=https%3A%2F%2Fd2o2utebsixu4k.cloudfront.net%2Fmedia%2Fimages%2F1669549225970-what-is-markdown-3.png&w=3840&q=75

2. Italics

To make text italics, we would use either single asterisks or use single underscores. Given below is an example program to italicize text in Markdown: 

*This is first way to make text in italics* 
_This is second way to make text in italics_

Output:

image?url=https%3A%2F%2Fd2o2utebsixu4k.cloudfront.net%2Fmedia%2Fimages%2F1669552938421-what-is-markdown-4.png&w=3840&q=75

3. Bold

If we want some strong text (or bold text), we can use double asterisks or we can also use double underscores which will make it bold as well. Given below is an example program to make bold text in Markdown:

**This is first way to make text in bold**
__This is second way to make text in bold__

Output:

image?url=https%3A%2F%2Fd2o2utebsixu4k.cloudfront.net%2Fmedia%2Fimages%2F1669552960052-what-is-markdown-5.png&w=3840&q=75

4. Strikethrough

For strikethrough we can use the double tilde sign. Given below is an example program for strikethrough text in Markdown:

~~Strikethrough text example~~

Output:

image?url=https%3A%2F%2Fd2o2utebsixu4k.cloudfront.net%2Fmedia%2Fimages%2F1669552979985-what-is-markdown-6.png&w=3840&q=75

5. Horizontal Line

A horizontal line acts like a separator, and for that, we use triple hyphens or triple underscores. You can use this to separate your content. Given below is an example program for adding a horizontal line in Markdown:

<!-- First Method to add Horizontal Line -->

This is text before Horizontal Line
___

This is text after horizontal line
<!-- Second Method to add Horizontal Line -->
This is text before Horizontal Line

---
This is text after horizontal line

Output:

image?url=https%3A%2F%2Fd2o2utebsixu4k.cloudfront.net%2Fmedia%2Fimages%2F1669553054381-what-is-markdown-7.png&w=3840&q=75

6. Blockquote

For inserting a block quote, we use the greater symbol. It gives us a light background and blue line on the left side. Given below is an example program for adding blockquote in Markdown:

<!-- Adding Blockquote --> 
>This is a blockquote

image?url=https%3A%2F%2Fd2o2utebsixu4k.cloudfront.net%2Fmedia%2Fimages%2F1669553148217-what-is-markdown-8.png&w=3840&q=75

7. Markdown Hyperlink

Text which we want to use for the hyperlink goes in square brackets, and the link will go in round brackets. Given below is an example program for adding links in Markdown:

<!-- Adding Link with sample text -->
[Upgrad](https://www.upgrad.com/)

8. Unordered List

Adding an unordered list in Markdown is very easy. Just add one asterisk mark symbol for each item. Given below is an example program for adding an unordered list in Markdown:

<!-- Unordered List -->
* First Item
* Second Item
* Third Item

image?url=https%3A%2F%2Fd2o2utebsixu4k.cloudfront.net%2Fmedia%2Fimages%2F1669553324005-what-is-markdown-10.png&w=3840&q=75

9. Ordered List

Adding an ordered list in Markdown is similar to adding an unordered List. We need to write 1 before each item. Given below is an example program for adding an ordered list in Markdown:

<!-- Ordered List --> 
1. First Item 
1. Second Item 
1. Third Item 

Output:

image?url=https%3A%2F%2Fd2o2utebsixu4k.cloudfront.net%2Fmedia%2Fimages%2F1669553422930-what-is-markdown-11.png&w=3840&q=75

10. Markdown Image

The process of adding links is very similar to adding links, except we need to put an exclamation in front of our brackets. Given below is an example program for adding the image in Markdown:

<!-- Ordered List --
1. First Item
1. Second Item
1. Third Item

Output:

image?url=https%3A%2F%2Fd2o2utebsixu4k.cloudfront.net%2Fmedia%2Fimages%2F1669553496541-what-is-markdown-12.png&w=3840&q=75

11. Markdown Code Blocks

For adding code blocks, we can use triple backticks. You can also specify syntax-specific code blocks. Given below is an example program for adding Code Blocks in Markdown:

<!-- Adding Code --> 
``` 
print("This is syntax specific code block") 
``` 
<!-- Adding Syntax Specific Code --> 
```Python 
print("This is syntax specific code block") 
```

Output:

image?url=https%3A%2F%2Fd2o2utebsixu4k.cloudfront.net%2Fmedia%2Fimages%2F1669553583287-what-is-markdown-13.png&w=3840&q=75

12. Markdown Tables

Tables in Markdown can get pretty complex, so we are just going to create a simple table because this is generally what we will need. To create a table we need a pipe symbol and a bunch of dashes to create a divider. Given below is an example program for adding Tables in Markdown:

<!-- Tables --> 
| Product | Company | Price | 
|---------- |:-------------: |------: | 
| Product 1 | Company 1 | $1600 | 
| Product 2 | Company 2 | $1700 | 
| Product 3 | Company 3 | $1800 |

Output:

image?url=https%3A%2F%2Fd2o2utebsixu4k.cloudfront.net%2Fmedia%2Fimages%2F1669553658631-what-is-markdown-14.png&w=3840&q=75

ElementMarkdown Syntax
Heading# H1  
## H2  
### H3
Bold**bold text**
Italic*italicized text*
Blockquote> blockquote
Ordered List
  • First item
  • Second item
  • Third item
Unordered List
  • First item
  • Second item
  • Third item
CodeCode
Horizontal Rule---
Link[title](https://www.example.com)
Image![alt text](image.jpg)

How to Use Markdown Practically [Step-by-Step]

For a deeper understanding of Markdown, we are going to create a small Markdown project, which is a portfolio. If you're a developer, it's time to create your own GitHub portfolio readme which is something new to GitHub, allowing you to have an account with a portfolio that looks a little bit more interesting than just the generic one available through GitHub. 

Step 1: Introduction

Firstly we are going to write a small introduction about ourselves:

<!-- Introduction --> 
## Hi there 
<p> Hello Everyone I Am Abhinav Kumar A B-Tech (Information Technology) Student At Netaji Subhas University Of Technology. Fields Related To Computers And IT, Like Web And App Development, Cyber Security Has Always Fascinated Me A Lot. </p> 

Output:

image?url=https%3A%2F%2Fd2o2utebsixu4k.cloudfront.net%2Fmedia%2Fimages%2F1669553894984-what-is-markdown-15.png&w=3840&q=75

Step 2: Adding GitHub Stats

Now that we have a little bit of content, we will add some statistics to our portfolio. We can do this using the repository “GitHub readme stats”. What we will need to do is copy over this example in the repository and simply swap out the username here with our own username.

image?url=https%3A%2F%2Fd2o2utebsixu4k.cloudfront.net%2Fmedia%2Fimages%2F1669553929668-what-is-markdown-16.png&w=3840&q=75

<!-- GitHub Stats --> 
[![Anurag's GitHub stats](https://GitHub-readme-stats.vercel.app/api?username=abhinav2108)](https://GitHub.com/anuraghazra/GitHub-readme-stats) 

Output:

image?url=https%3A%2F%2Fd2o2utebsixu4k.cloudfront.net%2Fmedia%2Fimages%2F1669553970765-what-is-markdown-17.png&w=3840&q=75

Step 3: Adding Skills with Emojis

We will add some skills here with icons that will look something a little bit more interesting. We will need an extension called “Emojisense” in VS code for adding emojis. Put the desired emoji's name between two colons after installing the emojisense extension in VS Code.

image?url=https%3A%2F%2Fd2o2utebsixu4k.cloudfront.net%2Fmedia%2Fimages%2F1669554002197-what-is-markdown-18.png&w=3840&q=75

<!-- Skills -->
# **My Skills**
:mobile_phone_off: Android Development<br>
:desktop_computer: Front-end Web Development<br>
:pencil: Technical Content Writing

Output:

image?url=https%3A%2F%2Fd2o2utebsixu4k.cloudfront.net%2Fmedia%2Fimages%2F1669554050079-what-is-markdown-19.png&w=3840&q=75

Step 4: Adding Known Languages

We will add some known Programming Languages here in an unordered list.

### Programming Languages 
* Java
* Kotlin
* HTML / CSS
* JavaScript

Output:

image?url=https%3A%2F%2Fd2o2utebsixu4k.cloudfront.net%2Fmedia%2Fimages%2F1669554102203-what-is-markdown-20.png&w=3840&q=75

Step 5: Adding Socials with Links

Finally, we'll include our social media links with their associated images. Create an assets folder, download all the social media icon images, and save them in the folder.

<!-- Social media --> 
# **Connect With Me** 
<a rel="nofollow" href="https://hashnode.com/@abhinav2108"><img src="assets/hashnode.svg" alt="@abhinav2108" height="30" width="40" /></a> 
<!-- Twitter --> 
<a rel="nofollow" href="https://twitter.com/abhinavkr_2108"><img src= "assets/twitter.svg" alt="abhinavkr_2108" height="30" width="40" /></a> 
<!-- LinkedIn --> 
<a rel="nofollow" href="https://linkedin.com/in/abhinav-kumar-3451281a0" ><img src= "assets/linkedin.svg" " alt="abhinav-kumar-3451281a0" height="30" width="40" /></a> 
<!-- Instagram --> 
<a rel="nofollow" href="https://instagram.com/abhinav.2108"><img src= "assets/instagram.svg" alt="abhinav.2108" height="30" width="40" /></a> 

image?url=https%3A%2F%2Fd2o2utebsixu4k.cloudfront.net%2Fmedia%2Fimages%2F1669554150996-what-is-markdown-21%20(1).png&w=3840&q=75

Source: GitHub 

Markdown Best Practices

Following are some best practices that need to be followed while writing Markdown codes. 

  • Headings: In Markdown, a blank line should always come before and after a heading
  • Line breaks: In Markdown, there are two ways to begin a new line: by adding the <br> tag or by adding a backslash. Since not all Markdown applications support backslash, it is better to use the <br> tag.  
  • Bold Text: There are two ways to bold text in Markdown, by using double asterisk(*) marks or by using double underscores. Since applications for Markdown conflict on how to treat underscores in the middle of words, it is suggested to use asterisk sign.
  • Italic Text: It is recommended to use the asterisk sign for italic text similarly to bold text.
  • Blockquotes: Blockquotes should have blank lines before and after them for better readability.
  • Ordered Lists: Adding round parentheses after the number allows you to create ordered lists in some markup applications, but not all of them support this. Therefore, it is advisable to add a dot after the number.
  •  Unordered Lists: Markdown supports several symbols, including plus(+), asterisk(*), and hyphens(-), that can be used to create unordered lists. However, it is advised to pick just one symbol and use it entirely.

You can join a Full Stack Developer Training to begin your journey appropriately. In this course, you will learn about the domain and get hands-on knowledge of different concepts. 

Unlock Your Potential with the Best Python Certification. Master the Language of the Future and Open Doors to Endless Opportunities. Start Your Journey Today!

Following are some advice and tips related to markdown which may be helpful when using markdown: 

1. Markdown Table Generator: As discussed earlier that tables in Markdown can get pretty complex. This is where Markdown Table Generators come into play. They don't require us to write a single line of code in order to generate tables. Steps that need to be followed while using Markdown Table Generators:  

a. Visit the following website: Markdown Table Editor and Generator - Table Convert Online 

b. Select the number of rows and columns from the Table Editor Dropdown.

image?url=https%3A%2F%2Fd2o2utebsixu4k.cloudfront.net%2Fmedia%2Fimages%2F1669554314612-what-is-markdown-22.png&w=3840&q=75

Source: tableconvert.com 

c. It will now generate the required code for the table. Select “Copy to Clipboard” option as shown and paste the code in any code editor you use

image?url=https%3A%2F%2Fd2o2utebsixu4k.cloudfront.net%2Fmedia%2Fimages%2F1669554347122-what-is-markdown-24.png&w=3840&q=75

Source: tableconvert.com

  


2. Python Markdown: Python Markdown is a Python implementation of John Gruber’s Markdown. It was developed for the following goals: 

a. To maintain a Python library suitable for usage in web server deployments as a markdown implementation. 

b. Provide an Extension API that makes it possible to change and/or extend the behavior of the parser. 

There are two ways of installing python markdown: 

c. Via Terminal: Just type the following command in terminal or command line: 

pip install markdown 

d. Via Repository: Clone the following repository by typing the following command in the terminal or command line:

pip install git+https://GitHub.com/Python-Markdown/markdown.git

3. Confluence Markdown: Confluence is a tool (by Atlassian)l for collaboration that allows users to create, read, and share material, which can consist of photographs, text documents, PDFs, charts, tables, and other things, and it is all stored inside spaces. By following the mentioned steps, you can use Markdown in Confluence as well:  

a. Visit the following website: Atlassian Markdown and create your site on confluence (It is free for up to 10 users) 

b. Visit Atlassian Marketplace and search for markdown 

c. Install the following extension:

image?url=https%3A%2F%2Fd2o2utebsixu4k.cloudfront.net%2Fmedia%2Fimages%2F1669554422939-what-is-markdown-25.png&w=3840&q=75
Source: marketplace.atlassian.com 

Conclusion

In this post, we looked at the concept of markdown, several reasons to use it, and how markdown functioning takes place. Then we had a discussion about the Markdown syntax and created a mini-project in order to better understand markdown syntax. Finally, we talked about certain recommended practices that must be followed when working on a markdown project. 

Frequently Asked Questions (FAQs)

1. What does Markdown mean in HTML? 

Markdown is a lightweight markup language used to create formatted text, typically for publishing on the internet using a plain text editor.

2. What is Markdown used for?

Markdown is used for creating static websites, documents, notes, email messages, technical documentation, etc.

3. What is the difference between markup and Markdown?

MarkupMarkdown
Markup is a notation that is used to annotate text in a document to provide details on the text's structure or instructions for how it should be displayed.Markdown is a plain text formatting syntax that converts the plain text formatting to HTML."

4. How do you write text in Markdown?

There are two ways to write text in markdown:

  1. One way is to just type the desired content as one would on another text editor, such as MS Word.
  2. Another way is that one can add and close a paragraph tag and write the text within these paragraph tag Example: <p> This is text </p>

5. What is another term for Markdown?

Lightweight Markup Language is the other term for Markdown.

Total 0

Total 45
Number Title Author Date Votes Views
40
php formatter
siwon | 2024.11.26 | Votes -1 | Views 1319
siwon 2024.11.26 -1 1319
39
html center 중앙정렬 tailwind
siwon | 2024.07.27 | Votes 0 | Views 1639
siwon 2024.07.27 0 1639
38
dropdown menu alpinejs 사용 버전
siwon | 2024.04.30 | Votes 0 | Views 1564
siwon 2024.04.30 0 1564
37
dropdown menu 간단 버전
siwon | 2024.04.30 | Votes 0 | Views 1523
siwon 2024.04.30 0 1523
36
The Standard PHP Library (SPL) is a collection of classes and interfaces that provide core functionality to PHP developers.
siwon | 2023.10.24 | Votes 0 | Views 2201
siwon 2023.10.24 0 2201
35
session 과 쿠키
siwon | 2023.10.24 | Votes 0 | Views 1461
siwon 2023.10.24 0 1461
34
Late Static Binding (LSB):메서드 내부에서 현재 클래스의 정적 메서드 또는 프로퍼티를 호출할 때 사용
siwon | 2023.10.24 | Votes 0 | Views 1285
siwon 2023.10.24 0 1285
33
PHP 예외 처리(Exception Handling)
siwon | 2023.10.10 | Votes 0 | Views 1606
siwon 2023.10.10 0 1606
32
php exception
siwon | 2023.10.10 | Votes 0 | Views 1802
siwon 2023.10.10 0 1802
31
예외(Exception)를 처리하기 위해 try...catch 블록을 사용하는 방법
siwon | 2023.10.10 | Votes 0 | Views 1340
siwon 2023.10.10 0 1340
30
Preserving Parent Class Functionality in overriding
siwon | 2023.09.26 | Votes 0 | Views 1173
siwon 2023.09.26 0 1173
29
oop 세부항목
siwon | 2023.09.26 | Votes 0 | Views 1190
siwon 2023.09.26 0 1190
28
method chaining
siwon | 2023.09.25 | Votes 0 | Views 1419
siwon 2023.09.25 0 1419
27
interface implements
siwon | 2023.09.19 | Votes 0 | Views 1242
siwon 2023.09.19 0 1242
Re:interface implements
siwon | 2023.10.24 | Votes 0 | Views 1050
siwon 2023.10.24 0 1050
26
abstract class : 부모 class로 사용되며 자식(extends 한)에게 abstract method를 강제함(그들만의 방식으로)
siwon | 2023.09.19 | Votes 0 | Views 1136
siwon 2023.09.19 0 1136
25
isset() / unset()
siwon | 2023.09.18 | Votes 0 | Views 1314
siwon 2023.09.18 0 1314
24
magic methods-어떤 상황이 되면 call 하지 않아도 자동으로 실행되는 메소드
siwon | 2023.09.18 | Votes 0 | Views 1321
siwon 2023.09.18 0 1321
23
MD(markdown) file
siwon | 2023.09.12 | Votes 0 | Views 1240
siwon 2023.09.12 0 1240
22
usort
siwon | 2023.08.30 | Votes 0 | Views 1277
siwon 2023.08.30 0 1277
21
closure=unanimous function
siwon | 2023.08.30 | Votes 0 | Views 1305
siwon 2023.08.30 0 1305
php 7.4에서 추가 화살표 함수 fn()=>
siwon | 2023.10.24 | Votes 0 | Views 3970
siwon 2023.10.24 0 3970
20
reference variable &
siwon | 2023.08.29 | Votes 0 | Views 1296
siwon 2023.08.29 0 1296
참조(reference)한 original variable의 값을 바꿔버리기 때문에 조심해서 써야함
siwon | 2023.08.30 | Votes 0 | Views 1227
siwon 2023.08.30 0 1227
19
PHP 변수 : 스칼라(Scalar), 복합(Composite), 그리고 리소스(Resource)
siwon | 2023.08.22 | Votes 0 | Views 1376
siwon 2023.08.22 0 1376
18
if : vs {}
siwon | 2023.08.22 | Votes 0 | Views 1120
siwon 2023.08.22 0 1120
17
null coalescing operator
siwon | 2023.08.18 | Votes 0 | Views 1468
siwon 2023.08.18 0 1468
16
arrary functions
siwon | 2023.08.18 | Votes 0 | Views 1281
siwon 2023.08.18 0 1281