dillo icon indicating copy to clipboard operation
dillo copied to clipboard

Code formatting need love

Open L0Lock opened this issue 4 years ago • 2 comments

It's hard to share some python code right now.

There is no syntax colorization. We can still read the code and use it as it is, but it's less practical and less efficient.
But the biggest issue is: all the indents are removed! In this condition, it will make the code nonfunctional for some languages like Python which uses indentation to interpret code.

Current dillo code formatting: image

GitHub formatting (using the exact same code as input):

import bpy


class VIEW3D_OT_MonOperator(bpy.types.Operator):
    bl_idname = "view3d.mon_operator"
    bl_label = "Simple Object Operator"

    # actions de l'operator


def register():
    bpy.utils.register_class(VIEW3D_OT_MonOperator)

    # Keymap reg
    wm = bpy.context.window_manager
    kc = wm.keyconfigs.addon
    if kc:
        km = kc.keymaps.new(
            name='Window', region_type='WINDOW', space_type='EMPTY')
        kmi = km.keymap_items.new(
            "view3d.mon_operator", type='PAGE_UP', value='PRESS')


def unregister():
    bpy.utils.unregister_class(VIEW3D_OT_MonOperator)

    # Keymap unreg
    for km, kmi in addon_keymaps:
        km.keymap_items.remove(kmi)
    addon_keymaps.clear()

# la magie
if __name__ == "__main__":
    register()

If one tries to copy paste the code from dillo to use it in Blender, it would not work.

Please at least fix this indent issue, that's the must-have. Syntax highlight too if possible, but indents must be fixed first.

Thanks ♥

L0Lock avatar May 31 '20 12:05 L0Lock

The indenting seems to be a css issue, running $("code").css("white-space","pre") in the browser console fixes it

I can't find where the styling for code snippets is set in this repo (or the pillar repo), probably is a site specific configuration, but just changing the white-space attribute from pre-line; to pre; should fix it (see https://developer.mozilla.org/en-US/docs/Web/CSS/white-space )

Recursing avatar Jun 05 '20 17:06 Recursing

Thank you for reporting this. We are working on updated version of Dillo, and we will address this report there.

fsiddi avatar Jun 06 '20 10:06 fsiddi