-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Don't strip new lines in dhautofunction #805
Conversation
That's not automatically going to fix it. HTML will ignore those new lines unless we preserve spaces. You are already inserting it into the doc, which WILL preserve new lines as markdown. I would just pull the description and returns parts from inside the and insert them directly above. <insert description if exists> This will be treated as markdown here, so even links and stuff would work.
**Returns: ** <insert returns if exists>
<Paramtable withoth those two things/> |
would that give you less control though if we wanted to change things? |
It's still under "our" control, so it would be fine. Are new lines in the parameters valid docstrings? |
I wasn't precise - it doesn't give less control overall, it splits a task into two parts, giving less control in the next step after this script. New lines in the docstring parameters are valid |
That's the easiest way to get full md support in descriptions. You are inserting into the presentation layer. inserting {result.description} *Returns:( {result.returns} <ParamTable restults={results dict} /> doesn't seem that different to me. and um. actually description and returns aren't params anyways. |
My point is, currently, My concern about newlines in params still remains. |
Embed it please. I acknowledge it's less ideal on your side. However it will be more performant on the front end as it avoids having the user waiting for it to be parsed. |
return_description = result["return_description"] | ||
return_type = result["return_type"] | ||
|
||
autofunction_markdown = ( | ||
f"{AUTOFUNCTION_COMMENT_PREFIX}" | ||
rf"{return_description}<br /><br />" | ||
rf"**Returns:** {return_type}<br /><br />" | ||
rf"<ParamTable param={{{dat}}} />" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these
actually inserted in output?"
If so, it's markdown, new lines are respected.
Also should this output be conditional? If no return type or no description?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you mean \n
are respected they are not at least in this case. This is inserting a raw string (which is has to do because otherwise sphinx tries to escape characters it shouldn't) so it writes a raw \n
, it doesn't create a new line.
Currently return_type
and return_description
are required. This can change but will require a bit more rework than just here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll see if I can replace those <br />
with a different sort of new line in the post processing, but ideally I don't want actual markdown new lines until then because it makes the processing harder than it needs to be
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done, that seems to have the needed output
) Goes back to stripping newlines for type descriptions specifically (changed in #805) as those don't parse properly now
No longer removes newlines, residual from before we were using a table and they were messing with the formatting I believe