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

feat(docs): automatic links to Web IDE from code blocks in Cookbook #994

Merged
merged 6 commits into from
Oct 29, 2024

Conversation

novusnota
Copy link
Member

@novusnota novusnota commented Oct 28, 2024

Issue

Closes #913.

Checklist

  • I have updated CHANGELOG.md
  • I have run the linter, formatter and spellchecker
  • I did not do unrelated and/or undiscussed refactorings

Preview

See the small "Open in Web IDE" buttons on bottom right side of each (!) code block:

image_2024-10-28_23-02-25

@novusnota novusnota added this to the v1.6.0 milestone Oct 28, 2024
@novusnota novusnota requested a review from a team as a code owner October 28, 2024 22:15
@anton-trunov
Copy link
Member

Is is possible to move the links somewhere to the top of the code snippets?

@novusnota
Copy link
Member Author

novusnota commented Oct 29, 2024

Is is possible to move the links somewhere to the top of the code snippets?

Yes, but I believe it's a bit worse since it kinda breaks the flow of the text. I can change the z-index or make it float, but that would overlap with text sometimes.

image

I've also tried extending the code blocks themselves and introducing another button adjacent to the copy button, but because the button's HTML/CSS were so rigid that attempt failed. They (expressive code plugin) have great extensibility and API for various cool transformations on code blocks, but have no robust way to add another button :)

@novusnota
Copy link
Member Author

Right now I'm removing such buttons from code blocks with signatures in the Reference section mainly

@anton-trunov
Copy link
Member

I would also say that opening links in Web IDE mostly makes sense for complete contracts.

@novusnota
Copy link
Member Author

That was my original thought too, but then I decided to allow all code samples but the ones in signatures — that way users can quickly tinker with any examples. But we may only allow such links for Cookbook examples, that's also fine

@anton-trunov
Copy link
Member

But we may only allow such links for Cookbook examples, that's also fine

yeah, let's start with Cookbook first and if there is popular demand, we will add more links

Also disallow links from single-line code blocks (not inline code),
since they generally pose little value to be copied that way
@anton-trunov anton-trunov changed the title feat(docs): automatic links to Web IDE from all code blocks feat(docs): automatic links to Web IDE from code blocks in Cookbook Oct 29, 2024
@anton-trunov anton-trunov self-assigned this Oct 29, 2024
@anton-trunov anton-trunov merged commit ee19808 into main Oct 29, 2024
19 checks passed
@anton-trunov anton-trunov deleted the closes-913-web-ide-links branch October 29, 2024 14:51
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.

Docs: introduce automatic or semi-automatic links to Web IDE from code snippets
2 participants