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

All newlines were stripped in run only mode #29

Closed
tonidy opened this issue May 14, 2024 · 11 comments
Closed

All newlines were stripped in run only mode #29

tonidy opened this issue May 14, 2024 · 11 comments

Comments

@tonidy
Copy link

tonidy commented May 14, 2024

I've this problem when running python code in Docusaurus 3.3.2:

def greet(name):
  print(f"Hello, {name}!")

greet("World")
<codapi-snippet sandbox="python" init-delay="500">
</codapi-snippet>

And get this error:
image

I've also seen this issue #22, @srenatus mentioned that all newlines are stripped in running only mode (without edit mode)

image

It should be great if this issue can be fixed. Thank you

@srenatus
Copy link
Contributor

Can you put together an example on codesandbox, or share the concrete HTML you get for that snippet? I think we'll need that to assess what's happening here.

@tonidy
Copy link
Author

tonidy commented May 14, 2024

@srenatus sure, here is the codesandbox URL https://codesandbox.io/p/devbox/peaceful-firefly-3sf4zz?workspaceId=273fe185-9274-4f80-b5dd-33b5233a4574. Then go to docs/intro or intro.md file.

I just pasted the snippet code to reproduce the issue:

```python
def greet(name):
  print(f"Hello, {name}!")

greet("World")
```

<!-- Not working -->
<codapi-snippet sandbox="python" init-delay="500">
</codapi-snippet>

<!-- Working well -->
<!-- <codapi-snippet sandbox="python" editor="basic" init-delay="500">
</codapi-snippet> -->

@nalgeon
Copy link
Owner

nalgeon commented May 14, 2024

#22 was fixed. What is your Codapi widget version?

@tonidy
Copy link
Author

tonidy commented May 14, 2024

@nalgeon I'm using codapi widget 0.19.6. #22 only fixed when widget using edit mode, if widget disabled edit mode then it's not working

@srenatus
Copy link
Contributor

FWIW this is the HTML I had been wondering about -- taken a screenshot from your code sandbox:
image

@nalgeon
Copy link
Owner

nalgeon commented May 15, 2024

Yes, I understand, thank you. Will take a look at it when I have time.

@tonidy
Copy link
Author

tonidy commented May 15, 2024

Great, thanks @nalgeon

@srenatus do you mean whitespace inside HTML ?

@srenatus
Copy link
Contributor

@tonidy I suspect I'm just muddying the water here. I had thought that knowing the HTML that docusaurus gives you for your code snippet would help @nalgeon with debugging what's going on here. Let's see! 🤞

@tonidy
Copy link
Author

tonidy commented May 15, 2024

No worries, @srenatus. Even if it feels like you're muddying the water, your suggestion about checking the HTML output from Docusaurus might be valuable to @nalgeon 💪 .

@nalgeon
Copy link
Owner

nalgeon commented May 16, 2024

Fixed in 0.19.7.

@nalgeon nalgeon closed this as completed May 16, 2024
@tonidy
Copy link
Author

tonidy commented May 16, 2024

@nalgeon awesome, it's working now. Thanks for fixing 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

3 participants