Skip to content
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

Support building line blocks with markdown-it hardbreaks #948

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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

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 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant