rouge-ruby / rouge

A pure Ruby code highlighter that is compatible with Pygments
https://rouge.jneen.net/
Other
3.32k stars 733 forks source link

Python Syntax highlight breaks in diffs . #1750

Open Sakshi1305 opened 2 years ago

Sakshi1305 commented 2 years ago

Rouge Python Language

Rouge Gem Version 3.26.0

Code sample A sample of the code that produces the bug.

def get_realtime_status_safety_input_data(self, cpuc_cpu_id):
    """
    Get data from realtime status safety input field.

    Arguments:
    | Name         | Description    | M/O |
    | cpuc_cpu_id  | Subdevice ID for CPU | M |

    Returns:
    | Description |
    | Dict        |

    Example of returned dictionary:
    {
        "C1": "122222222", ...
        "H2": "0", ...
        "S1": "-1"
    }
    """
    return self.iot_portal_handler.get_realtime_status_safety_input_data(cpuc_cpu_id)

def get_realtime_status_safety_input_data(self, cpuc_cpu_id):
    """
    Get data from realtime status safety input field.

    Arguments:
    | Name         | Description    | M/O |
    | cpuc_cpu_id  | Subdevice ID for CPU | M |

    Returns:
    | Description |
    | Dict        |

    Example of returned dictionary:
    {
        "C1": "122222222", ...
        "H2": "0", ...
        "S1": "-1"
    }
    """
    return self.iot_portal_handler.get_realtime_status_safety_input_data(cpuc_cpu_id)

def get_realtime_status_safety_input_data(self, cpuc_cpu_id):
    """
    Get data from realtime status safety input field.

    Arguments:
    | Name         | Description    | M/O |
    | cpuc_cpu_id  | Subdevice ID for CPU | M |

    Returns:
    | Description |
    | Dict        |

    Example of returned dictionary:
    {
        "C1": "122222222", ...
        "H2": "0", ...
        "S1": "-1"
    }
    """
    return self.iot_portal_handler.get_realtime_status_safety_input_data(cpuc_cpu_id)

Additional context Syntax highlight work incorrectly in code review diffs if diff snippet in itself is not syntactically correct. Examples attached.

Screenshot 2021-10-07 at 3 28 52 PM

Code Browser Screenshot attached:

Screenshot 2021-10-07 at 3 39 55 PM

Check differences in both the screenshots, the highlighting does not quite match in the diff, see e.g. the method name and the comment content

jneen commented 1 year ago

Is this Gitlab? They do some manual magic to get diff highlighting that we don't do in this project IIRC.