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

reStructuredText: improve handling of field lists #1279

Merged
merged 1 commit into from
Nov 27, 2019

Conversation

EricFromCanada
Copy link
Contributor

The current field list rules only find a field body if it starts on the same line as the field marker, as shown by this code sample in the Sphinx docs. This replacement rule covers any field marker (including colons if escaped) and an optional field body consisting of one or more paragraphs, starting on either the same line or a following line, as long as it's indented more than the marker.

@birkenfeld
Copy link
Member

Hmm, IIUC now the field body is uniformly highlighted, but it can (especially if multiline) contain markup to highlight itself.

I'd rather just ensure that field names on their own (with the body following on the next line) are highlighted properly, and maybe remove the special highlight of in-line field bodies.

@EricFromCanada
Copy link
Contributor Author

Just so we're clear, by "can contain markup to highlight itself", you mean that because the field body may contain its own inline markup like roles or emphasis, you'd rather have it skip highlighting the field body entirely? I can do that.

@birkenfeld
Copy link
Member

Yes, the field body should not be consumed in the field rule.

At least for multiline fields; I don't know if the lexer likes starting in the middle of a line, I remember that it was pretty line-by-line-oriented.

@EricFromCanada
Copy link
Contributor Author

Done; it now only highlights field list markers.

@birkenfeld birkenfeld merged commit 1d5f36e into pygments:master Nov 27, 2019
@EricFromCanada EricFromCanada deleted the rst-field-list branch November 28, 2019 17:04
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.

None yet

2 participants