2

I uploaded a jupyter notebook to github. There was a line of text in a cell that I had centered in the jupyter notebook. But on uploading to github, the line appeared with html tags. Here is the code:

<p style='text-align:center';> <b> text </b> </p>

the line showed up as it is with "<p style='text-align:center';>" on uploading to github and nbviewer.

I tried

<center> <b> text </b> </center>

which works in jpnb markdown but the line doesn't even show up on uploading the file to github.

The following works in github .md file but not in local jupyter notebook. And since I haven't uploaded to github, I can't say if it centers there or not.

<p align="center"><b>text</b></p>

Is there a way to center text on both local jupyter notebook that works on uploading to jupyter notebook as well?

rahul-ahuja
  • 1,166
  • 1
  • 12
  • 24
  • 1
    No, it is not possible. See the answer to [Is it possible to have a table in the center in Github gist markdown?](https://stackoverflow.com/q/44172954/866026) for a detailed explanation. It is debatable whether this is a duplicate of that (as this refers specifically to Jupiter Notebook), but the explanation of why its not possible for a simple Markdown table would apply here as well. – Waylan Mar 09 '21 at 19:47

1 Answers1

3

Try this in a markdown cell :

<div align="center"><b> Centered Text </b></div>