Gilmeh Serda
2024-05-26 06:28:51 UTC
The web claims (I think on all pages I've read about Markdown and Python)
that this code should work, with some very minor variants on the topic:
```python
import os
with open(os.path.join('/home/user/apath', 'somefile')) as f:
print(f.read())
```
However, that is not the case. At least not for me (using Python 3.12.3).
If instead I type it:
#!python
import os
with open(os.path.join('/home/user/apath', 'somefile')) as f:
print(f.read())
As an indented block (four spaces) and a shebang, THEN it works. You even
get line numbers by default.
N.b. if you don't know, you also need to generate a css file using
pygments to make this work.
Not until I started to read the markdown source code and its docs pages,
the coin dropped.
I'm posting this for other Markdown newbies that otherwise probably would
spend hours trying to make it work.
Speaking of Markdown. Does anybody out there have any idea how to turn on
table borders, adjust them (color/width/etc.) and such things? Currently I
have to add HTML to do so, which works, but isn't very nice. I'd hate to
spend an additional day or two, hunting for this info.
References:
https://pypi.org/project/Markdown/
https://python-markdown.github.io/
that this code should work, with some very minor variants on the topic:
```python
import os
with open(os.path.join('/home/user/apath', 'somefile')) as f:
print(f.read())
```
However, that is not the case. At least not for me (using Python 3.12.3).
If instead I type it:
#!python
import os
with open(os.path.join('/home/user/apath', 'somefile')) as f:
print(f.read())
As an indented block (four spaces) and a shebang, THEN it works. You even
get line numbers by default.
N.b. if you don't know, you also need to generate a css file using
pygments to make this work.
Not until I started to read the markdown source code and its docs pages,
the coin dropped.
I'm posting this for other Markdown newbies that otherwise probably would
spend hours trying to make it work.
Speaking of Markdown. Does anybody out there have any idea how to turn on
table borders, adjust them (color/width/etc.) and such things? Currently I
have to add HTML to do so, which works, but isn't very nice. I'd hate to
spend an additional day or two, hunting for this info.
References:
https://pypi.org/project/Markdown/
https://python-markdown.github.io/
--
Gilmeh
"Reality is that which, when you stop believing in it, doesn't go away".
-- Philip K. Dick
Gilmeh
"Reality is that which, when you stop believing in it, doesn't go away".
-- Philip K. Dick