[ty] Add a Copy Markdown button to playground#23002
[ty] Add a Copy Markdown button to playground#23002MichaReiser merged 11 commits intoastral-sh:mainfrom
Copy Markdown button to playground#23002Conversation
| return "python"; | ||
| case "json": | ||
| return "json"; | ||
| case "toml": |
There was a problem hiding this comment.
I don't think the ty.toml is yet supported by the playground so this is just some future proofing for it does get included the export till still looks right
|
Thank you for looking into this! In general, this seems like a useful feature to have, but personally, I think it would be nice not to have multiple "share" buttons? Especially if we consider having both "Markdown with link" and "Markdown with link and code" functionality like in astral-sh/ty#2675. I'm not really familiar with our frontend code here, but maybe we have some dropdown-like components that would allow us to hide those three options in the main UI? The playground was designed by @MichaReiser who is currently on an extended leave. We might want to wait for his return in March before we continue with this. |
Yeah I agree, I wasn't convinced by having two Share buttons side-by-side either but opted for the simpler approach to get a direction check instead of implementing the more complex UX out the door and have that fall flat 😅 Good to know, I will try and get a proposal for a drop-down like component (and maybe the other modes too) ready for when Micha returns (unless someone else feels brave enough to review frontend code in the meantime 😆) |
Thank you. I mainly want to make sure that you do not invest time into something that might eventually be rejected. |
fb89a11 to
9a4d4bd
Compare
MichaReiser
left a comment
There was a problem hiding this comment.
Thanks. This is great. We should include this in Ruff too.
`Copy Markdown` button: - persists state to cloudflare worker (same as share) - builds a markdown formatted output from the url returned by state persist and open files - copies the markdown to clipboard
0e4a7dc to
e64c412
Compare
Copy Markdown button to playground - astral-sh/ty#2675Copy Markdown button to playground
* main: (94 commits) Fix shell injection via `shell=True` in subprocess calls (#23894) [ty] Refactor `relation.rs` to store state on a struct rather than passing around 7 arguments every time we recurse (#23837) Don't return code actions for non-Python documents (#23905) [ty] Make the default database truly statically infallible (#23929) [ty] Add `Download` button to ty playground which creates a zip export (#23478) [ty] Respect `kw_only` overwrites in dataclasses (#23930) [ty] Clarify in diagnostics that `from __future__ import annotations` only stringifies type annotations (#23928) [ty] Add a `Copy Markdown` button to playground (#23002) [ty] Fix folding range classification of lines starting with `#` (#23831) [ty] Fix folding ranges for notebooks (#23830) [ty] fix too-many-cycle panics when inferring literal type loop variables (#23875) Add `RegularCallableTypeOf` and `into_regular_callable` in `ty_extensions` (#23909) [ty] treat properties as full structural types (#23925) [ty] Avoid duplicated work during multi-inference (#23923) [ty]: make `possibly-missing-attribute` ignored by default [ty]: split out `possibly-missing-submodule` from `possibly-missing-attribute` Update astral-sh/setup-uv action to v7.5.0 (#23922) [ty] Show truthiness in ConstraintSet display and simplify falsy error message (#23913) Bump 0.15.6 (#23919) [ty] Narrow type context during collection literal inference (#23844) ...
Summary
Closes: astral-sh/ty#2675
Adds dropdown from
Sharebutton:Copy link- existing share button functionalityCopy link as Markdown- copy just the link as markdownCopy link and code as Markdown- copy link and code in relevant language fences as markdownTest Plan
npm start --workspace ty-playgroundnpm start --workspace ruff-playgroundExample markdown output
Code sample in ty playground
main.py
ty.json
{ "environment": { "python-version": "3.14" }, "rules": { "undefined-reveal": "ignore" } }