Skip to content

Conversation

@jdknight
Copy link

Provides the ability to build docutils' line-block nodes if an inline element contains hardbreaks. When a hardbreak is detected as a child of an inline token, a line-block will be created and child tokens will be rendered into a prepared line node. Child nodes are placed into a line node until the next hardbreak is detected, where a new line node is created to hold the next child set. The process repeats until all children are processed.


This change is in relation to #877. The change should allow any translator type to handle these line breaks, without requiring the raw directive.

With a document:

# Test

PATH        to be explained \
PYTHONPATH  to be explained \
GRUB        to be explained

Example renderings:

(HTML)
image

(PDF)
image

(Confluence)
image

@codecov
Copy link

codecov bot commented Jul 20, 2024

Codecov Report

Attention: Patch coverage is 96.29630% with 1 line in your changes missing coverage. Please review.

Project coverage is 90.14%. Comparing base (d3d7fbb) to head (08f1afa).

Files Patch % Lines
myst_parser/mdit_to_docutils/base.py 96.29% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master     #948   +/-   ##
=======================================
  Coverage   90.14%   90.14%           
=======================================
  Files          24       24           
  Lines        3418     3441   +23     
=======================================
+ Hits         3081     3102   +21     
- Misses        337      339    +2     
Flag Coverage Δ
pytests 90.14% <96.29%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Provides the ability to build docutils' line-block nodes if an inline
element contains hardbreaks. When a hardbreak is detected as a child of
an inline token, a line-block will be created and child tokens will be
rendered into a prepared line node. Child nodes are placed into a line
node until the next hardbreak is detected, where a new line node is
created to hold the next child set. The process repeats until all
children are processed.

Signed-off-by: James Knight <git@jdknight.me>
@jdknight jdknight force-pushed the hardbreaks-into-lineblocks branch from d1990c5 to 1873066 Compare February 1, 2025 17:42
@PhorstenkampFuzzy
Copy link

This PR would be super helpfull!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants