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

code-blocks not being formatted #19

Open
roguefalcon opened this issue Apr 26, 2024 · 0 comments
Open

code-blocks not being formatted #19

roguefalcon opened this issue Apr 26, 2024 · 0 comments

Comments

@roguefalcon
Copy link

Thanks so much for your library. I recently used it in a project and it's pretty nice. Good job!

The only issue I'm seeing is that it doesn't wrap the code blocks in the <pre> tags or apply the ql-syntax class to them. I edited html.py to add the cls=BlockFormat to the following function:

@format("code-block", cls=BlockFormat)
def code_block(root, op):
    root.tag = "pre"
    root.attrib.update({"class": CODE_BLOCK_CLASS, "spellcheck": "false"})
    return root

That seemed to catch it and correctly start adding the appropriate tags. The only issue is that it adds them to every single line. You end up with blank space between each line of code which isn't ideal. I cheated to make it visually work by adding a negative margin via CSS to the ql-syntax class but I consider that a hack. It's working, and I'm totally going to ship it, but if there was a fix via this module that'd be my preferred option.

I poked around in the rest of your code trying to see if there was an easy fix and I didn't see an obvious way to group the code-block lines together. I probably just missed it.

Either way, great job on converting Delta to HTML! Super helpful and I really appreciate it.

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

No branches or pull requests

1 participant