Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add emphasis github flavored markdown within code block

Is it possible to bold a portion of text within a code block in a github readme?

like image 635
JLoppert Avatar asked Jul 09 '14 20:07

JLoppert


People also ask

How do you highlight code in Markdown?

To highlight code, write the name of the language the code is written in after the initial triple backticks. In the above example, the code is written in JavaScript, and hence javascript is added after triple backticks.

How do I highlight code in GitHub?

To link to multiple lines of highlighted code, select your first line of code and then CTRL+SHIFT click on the last line of code you want to highlight. Notice the URL is now appended with a range of line numbers (e.g. https://github.com/…/functions.php#L117-L148).

How do you write the word python in Markdown to emphasize it in bold?

To bold text, add two asterisks or underscores before and after a word or phrase. To bold the middle of a word for emphasis, add two asterisks without spaces around the letters. I just love **bold text**.

How do you add a code block in Markdown?

The basic Markdown syntax allows you to create code blocks by indenting lines by four spaces or one tab. If you find that inconvenient, try using fenced code blocks. Depending on your Markdown processor or editor, you'll use three backticks ( ``` ) or three tildes ( ~~~ ) on the lines before and after the code block.


2 Answers

This answer on StackExchange Meta works on Github too:

Use a <pre> tag (or <pre><code>) instead of ```, and use <b> tags around the part you want bold.

like image 55
linesarefuzzy Avatar answered Sep 21 '22 06:09

linesarefuzzy


No you cannot style your code snippet with bold/emphasis/italics.

You can always make comments explaining parts of the code, if that's what you want to achieve by emphasizing bits of your code.

like image 45
Adi Avatar answered Sep 21 '22 06:09

Adi