Priyanshul Govil
Priyanshul Govil

Reputation: 589

How to indent sub-heading along with content in GitHub Markdown?

I am trying to create my README file, and I wish that my sub-heading gets indented.

In particular, I have an h2 heading and an h4 sub-heading. I require that the h4 sub-heading and all its content are indented.

Is there some way I can achieve this? Maybe some sort of a container in markdown?

Upvotes: 3

Views: 2654

Answers (1)

Priyanshul Govil
Priyanshul Govil

Reputation: 589

After a lot of experiments and blog-reading, I finally came up with something. I am answering my own question, as this seems to be quite an issue.

Markdown supports HTML. So, to indent some content, using the <ul> tag was what helped me.

Anything inside <ul> will automatically be indented by the browser.

I did face another problem, however. Now, I needed my HTML content to include Markdown as well. Luckily enough, Github Flavored Markdown provides a very simple way to achieve this. Simply leave a newline before and after your HTML text, and GitHub will have it support Markdown.

All in all, my code looked somewhat like this:

<ul>

<li>

I want this `HTML` text to be **bold**.

</ul>

which resulted in the output:

    I want this HTML text to be bold.

Upvotes: 4

Related Questions