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

Pass more Context to Viewer Functions + Cell Viewer #575

Merged
merged 25 commits into from
Dec 21, 2023
Merged

Conversation

zampino
Copy link
Collaborator

@zampino zampino commented Nov 21, 2023

  • when a viewer's predicate is a map with a :wrapped key, its value is called against the whole wrapped value instead of just the value
  • the contents of the cell are merged into the wrapped value on which viewer functions operate
  • a cell viewer is added to allow a.o. to control the visibility of result or code programmatically.

@zampino zampino changed the title Pass more Context to Viewer Functions Pass more Context to Viewer Functions + Cell Viewer Dec 13, 2023
@zampino zampino marked this pull request as ready for review December 13, 2023 17:01
@zampino zampino requested a review from mk December 13, 2023 17:01
(-> cell :result :nextjournal/value (as-> n (when (number? n) (even? n)))))
:show
%))))))

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mk maybe an early feedback on this one 👆.

In some sense, controlling visibility is not "close to" the actual values which we want to display/hide. Unlike the usual customization of dedicated viewers matching different values, here we have just one spot in which to combine different predicates. Maybe good so anyway.

# Conflicts:
#	src/nextjournal/clerk/viewer.cljc
for ease of testing scenarios when we just can't wrap a value
this allows to easily hide anonymous toplevel forms, but still show examples
@zampino
Copy link
Collaborator Author

zampino commented Dec 21, 2023

I checked that slideshow viewer still works, as this is the usual suspect when changing the shape of a presented notebook. Moreover #593 is not a regression from these changes, I'll fix that in a separate commit.

@zampino zampino merged commit 0da53fb into main Dec 21, 2023
@zampino zampino deleted the context-viewers branch December 21, 2023 15:35
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.

2 participants