pycco-docs / pycco

Literate-style documentation generator.
https://pycco-docs.github.io/pycco/
Other
842 stars 144 forks source link

Formatting of HTML files seems to be wrong #105

Open sripirakas opened 5 years ago

sripirakas commented 5 years ago

Hi,

I have noticed some formatting issues with pycco and then used the file at https://github.com/pycco-docs/pycco/blob/master/pycco/main.py to reproduce the output rendering as at https://pycco-docs.github.io/pycco/ (Please see the screenshot below). As you can see the comments within """ and """ are not properly formatted.

image

fitzroy-2011-02 commented 4 years ago

Hello, I'm obsering the same behavior.

I run pycco against it's own source file and it does not look like the way it should. It looks like the way in the picture above.

I guess I'm doing something fundamentaly wrong. Anyone else has this issue? Sorry for bothering.

Best regards, Alex


Okay this is my first debugging attempt ever, so please bear with me. Removing the leading spaces (indents) seemed to be erroneous.

I changed

line: 164
from: indent_level = re.match(r"\s*", line).group(0) to:
indent_level = len(re.match(r"\s*", line).group(0)) - 1

line: 173-174 from:

if re.match(r' {{{:d}}}'.format(len(indent_level)), line):
    docs_text += line[len(indent_level):] + '\n'

to:

if re.match(r' {{{:d}}}'.format(indent_level), line):
    docs_text += line[indent_level:] + '\n'

I hope this does not break anything else.

Best, Alex