how to draw shapes

Introduction

In this post, we will learn how to draw various shapes using basic markup language called Markdown. Markdown is a lightweight markup language that allows you to easily format plain text. We will explore different techniques to draw shapes such as squares, circles, and triangles using Markdown syntax.

Drawing a Square

To draw a square using Markdown, follow these steps:

  1. Start by creating a table with 4 rows and 4 columns using ‘|’ and ‘-‘ characters to represent borders.
  2. Place a ‘|’ character at the beginning and end of each row.
  3. Use ‘-‘ characters to create horizontal lines for the top and bottom borders.
  4. Fill the remaining rows with ‘|’ characters to complete the square.

Here’s an example of a Markdown code to draw a square:

|---|
| |
|---|

The above code will result in a simple square shape:

|—|
| |
|—|

Drawing a Circle

Drawing a perfect circle using plain Markdown is not possible because Markdown doesn’t have an in-built shape drawing feature. However, we can approximate a circle using Unicode characters like “●” or “○”. Here’s how you can create a circle:

  1. Use a set of Unicode characters to represent the outer boundary of the circle (e.g., “●” or “○”).
  2. Increase the font size to create a more circular appearance.
  3. Adjust the spacing between the characters to make the circle look more symmetrical.

Here’s an example of a Markdown code to draw an approximate circle:

● ●
● ●
● ●

The above code will produce an approximation of a circle:

● ●
● ●
● ●

Drawing a Triangle

To draw a triangle using Markdown, follow these steps:

  1. Use blank spaces and hyphens to create a right-angled triangle shape.
  2. Increase or decrease the number of spaces and hyphens to adjust the size of the triangle.

Here’s an example of a Markdown code to draw a triangle:

“`




“`

The above code will result in a right-angled triangle shape:

“`




“`

Conclusion

In this post, we explored different techniques to draw shapes using Markdown. Markdown’s simplicity allows us to create basic shapes like squares, approximate circles, and right-angled triangles. Although Markdown is not specifically designed for shape drawing, it can be a fun way to experiment with simple graphical representations.