From: Günter M. <mi...@us...> - 2023-12-12 20:16:57
|
--- **[feature-requests:#101] New "doctree" element for hard line breaks.** **Status:** open **Group:** Default **Created:** Tue Dec 12, 2023 08:16 PM UTC by Günter Milde **Last Updated:** Tue Dec 12, 2023 08:16 PM UTC **Owner:** nobody Not providing for "hard line break elements" in the Docutils document model and reStructuredText syntax was a deliberate decision at the time these two were devised. However, times have changed and there are new arguments and use-cases for hard line breaks. (cf. the [comments in #85](https://sourceforge.net/p/docutils/feature-requests/85/#d02b)). Something like a `<br>` inline node or special handling of `<inline class=line-break>` inline nodes may be considered. The latter would not change the document model and could be implemented at the writer level or via stylesheet rules. Whether to add a reStructuredText syntax for hard line breaks can be decided independently. The current rules require a non-white character in a role defined with `.. role:: line-break`. --- Sent from sourceforge.net because doc...@li... is subscribed to https://sourceforge.net/p/docutils/feature-requests/ To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/docutils/admin/feature-requests/options. Or, if this is a mailing list, you can unsubscribe from the mailing list. |
From: Günter M. <mi...@us...> - 2025-04-28 19:25:51
|
- **status**: open --> pending-moreinfo - **Comment**: Instead of relying on a "magic" class value, we may also allow the "xml:space" attribute for `<inline>` elements and represent a hard line break in the Document Tree as space-preserving inline element containing a newline character. Markup parsers (like MyST and pycmark) could translate an end-of-line backslash to ~~~ xml <inline xml:space=preserve>\n</inline> ~~~ Writers would need to check inline elements for xml:space and translate it accordingly (e.g. HTML may use `<span style="white-space:pre-wrap;">...<\span>` in the general case and `<br>` if the content is just one newline character.) The advantage it that there is a precedence: the "xml:space" attribute is defined by the XML standard "to signal an intention that in that element, white space should be preserved by applications." https://www.w3.org/TR/REC-xml/#sec-white-space The Doctree uses the "xml:space" attribute already for the `<address>, <comment>, <doctest_block>, <literal_block>, <math_block>`, and `<raw>` elements. https://docutils.sourceforge.io/docs/ref/doctree.html#xml-space --- **[feature-requests:#101] New "doctree" element for hard line breaks.** **Status:** pending-moreinfo **Group:** Default **Created:** Tue Dec 12, 2023 08:16 PM UTC by Günter Milde **Last Updated:** Tue Dec 12, 2023 08:16 PM UTC **Owner:** nobody Not providing for "hard line break elements" in the Docutils document model and reStructuredText syntax was a deliberate decision at the time these two were devised. However, times have changed and there are new arguments and use-cases for hard line breaks. (cf. the [comments in #85](https://sourceforge.net/p/docutils/feature-requests/85/#d02b)). Something like a `<br>` inline node or special handling of `<inline class=line-break>` inline nodes may be considered. The latter would not change the document model and could be implemented at the writer level or via stylesheet rules. Whether to add a reStructuredText syntax for hard line breaks can be decided independently. The current rules require a non-white character in a role defined with `.. role:: line-break`. --- Sent from sourceforge.net because doc...@li... is subscribed to https://sourceforge.net/p/docutils/feature-requests/ To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/docutils/admin/feature-requests/options. Or, if this is a mailing list, you can unsubscribe from the mailing list. |
From: Günter M. <mi...@us...> - 2025-04-28 20:21:36
|
-1 for backslash at line-end as "hard line break" in reStructuredText. This would not fit nice with > Escaped whitespace characters are removed from the output document together with the escaping backslash. This allows for character-level inline markup. — https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#escaping-mechanism Rather, I suggest "backslash + newline" as a line continuation syntax for, e.g. wrapping long section titles. +1 for a representation of hard line breaks in the Docutils Document Model ("doctree") for use in generated content or markup parsers. Open question: should we introduce * a new `<br>` element, * a "magic" class value like "pre-wrap" (or "line-break"), or * an "xml:space" attribute for `<inline>` elements. --- **[feature-requests:#101] New "doctree" element for hard line breaks.** **Status:** pending-moreinfo **Group:** Default **Created:** Tue Dec 12, 2023 08:16 PM UTC by Günter Milde **Last Updated:** Mon Apr 28, 2025 07:25 PM UTC **Owner:** nobody Not providing for "hard line break elements" in the Docutils document model and reStructuredText syntax was a deliberate decision at the time these two were devised. However, times have changed and there are new arguments and use-cases for hard line breaks. (cf. the [comments in #85](https://sourceforge.net/p/docutils/feature-requests/85/#d02b)). Something like a `<br>` inline node or special handling of `<inline class=line-break>` inline nodes may be considered. The latter would not change the document model and could be implemented at the writer level or via stylesheet rules. Whether to add a reStructuredText syntax for hard line breaks can be decided independently. The current rules require a non-white character in a role defined with `.. role:: line-break`. --- Sent from sourceforge.net because doc...@li... is subscribed to https://sourceforge.net/p/docutils/feature-requests/ To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/docutils/admin/feature-requests/options. Or, if this is a mailing list, you can unsubscribe from the mailing list. |