-
Notifications
You must be signed in to change notification settings - Fork 79
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
Use viewer api to to enable customization of markdown nodes #122
Conversation
by defaulting to a <span> element to host reagent dangerously-set inline HTML
CleanShot.2022-03-24.at.18.45.08.mp4 |
bdbbaf0
to
b8b56d4
Compare
Evaluating the inspect function on edamame read instead of having to deal with ifns seems to make Reagent happier.
I do not completely grasp why fe1e9a6 fixes the in-text slider re-rendering issue, but the reagent structure in devtools shows that with |
e3d99a4
to
1ee6b2c
Compare
deps.edn
Outdated
io.github.nextjournal/viewers {:git/sha "d88a9abd1f2bfd28ff2d3983407a9319c6f04501"} | ||
io.github.nextjournal/viewers {:git/sha "d88a9abd1f2bfd28ff2d3983407a9319c6f04501" | ||
:exclusions [io.github.nextjournal/markdown | ||
io.github.nextjournal/clerk]} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👆 these redundant deps confuse my intellij, can we exclude them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's remove those from the viewers so it doesn't bring both of those in.
81ef1ed
to
359761c
Compare
deps.edn
Outdated
io.github.nextjournal/viewers {:git/sha "d88a9abd1f2bfd28ff2d3983407a9319c6f04501"} | ||
io.github.nextjournal/viewers {:git/sha "d88a9abd1f2bfd28ff2d3983407a9319c6f04501" | ||
:exclusions [io.github.nextjournal/markdown | ||
io.github.nextjournal/clerk]} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's remove those from the viewers so it doesn't bring both of those in.
notebooks/described_markdown.clj
Outdated
(with-md-viewer (parse text)))) | ||
|
||
(reset! nextjournal.clerk.webserver/!doc nextjournal.clerk.webserver/help-doc) | ||
(reset! v/!viewers (v/get-all-viewers))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's drop this.
src/nextjournal/clerk/viewer.cljc
Outdated
{:name :nextjournal.markdown/sidenote | ||
:transform-fn (into-markup (fn [{:keys [attrs]}] [:span.sidenote [:sup {:style {:margin-right "3px"}} (-> attrs :ref inc)]]))} | ||
{:name :nextjournal.markdown/sidenote-ref | ||
:transform-fn (into-markup [:sup.sidenote-ref])} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's move those to a separate def.
we'll deal with this by removing clerk and markdown from the root deps of viewers
This processes the parsed markdown nodes through the viewer api, enabling the same customization as for results. In addition, folks can extend the markdown tokenization and use the JVM-parts of the viewer api (
:fetch-fn
and:transform-fn
) to introduce new behavior.CleanShot.2022-03-30.at.09.42.30.mp4