Skip to content

Handling of line breaks within RST inlines #4618

@danse

Description

@danse

Inlines containing line breaks are converted to RST markup which seems to have different semantics depending on the position of the line breaks.

I assume that we can simply replace all newlines within inlines in the RST writer, but i could not find any mention to this case (newlines within inline markup) in the RST specification.

I tested using the docutils parser (via rst2html) and i found out that inlines containing:

  1. \n trigger a syntax error
  2. text\n get parsed as a paragraph without style
  3. \ntext trigger a syntax error
  4. text\ntext get parsed as a styled inline

i'm not sure about the correct methodology to follow here. should we use the code of the docutils parser as reference for the standard?

in my opinion it is sensible to replace all line breaks contained in inlines with spaces before writing RST. this way we will get rid of the syntax errors and handle the three strings consistently. this can easily be added to our inline transformation function that is already walking the inlines structure

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions