Use nutshell in my Franklin blog
Setup nutshell in my Franklin Blog
The setup step is quite simple: just follow the nutshell's official documentation, and everything works fine.
Find out the css incompatiblity for me (knowledge of html+css ≈ 0.1%) is nightmare !
But I just got it worked for me anyway, without knowing why 😅 :
What's more, I found that on some header, a nutshell hinter pops up when hover, which is not what I want. So, I need a rule to turn on the nutshell functions page by page:
hasnutshell = false
to turn off nutshell functions by default. Change that to hasnutshell = true
if you want to use nutshell functions in the specific markdown file. This was made happen by modifying the stylesheets.html
to add a line of:
{{if hasnutshell}}<script src="/libs/nutshell/nutshell.js"></script>{{end}}
Now, everything just works fine for me 😄.
Test normal nutshell functions
The nutshell-contained below was generated with:
:x invisible hd1
text in invisible hd1. :hd2
: visible hd2
text in visible hd2.
normal hd
text that refers :hd1 and :hd2 and plain text.
:x invisible hd1
text in invisible hd1. :hd2
: visible hd2
text in visible hd2.
normal hd
text that refers :hd1 and :hd2 and plain text.
for most cases, use the
:x header
grammar is enough;: header
will convert the header into plain text, regardless of the header levels.the hrefs cannot be Chinese for now, but the link text could be:
[:表头1](#hd1)
works fine while[:hd1](#表头1)
not;the href calling could before the href defining;
the styles within the nutshell popup are gone;
the nutshell headers would still showup on Franklin's
\toc
contents;
test code blocks
nutshell code block :here
function abc()
println("abc")
end
id, class, style ...
attributes assigned to the html. After comment out the related codes (Those start with comments of // DOMPurify
), and force the NutShell to use rawHTML for downstream work, every style comes back (except for Highlight.js
based code highlights), that's enough for me.
Comment out these code may cause unexpected bugs, I just do it for my own using scene (which seldomly contain complex css styles). Be caution when applying to YOURS!
:x test-code-blocks
function abc()
println("abc")
end
test use nutshell offical tests
To write a section,
just use headings & paragraphs like this! Then...
To embed a section,
just make a link with :colon at the front... :LIKE THIS!
Details about linking to stuff
To link to a section on the same page, use a # followed by the text of the section's heading – capitalization, spaces, and punctuation don't matter.
:This example links to #ToEmbedASection
To link to a section from a different page, link to the URL, followed by # and section heading:
:This example links to https://ncase.me/faq/#GoodMentalHealth
If you link to a page without a #SectionHeading, it'll embed the whole article.
:This example links to https://blog.ncase.me/parable-of-the-hill-climber/
Three notes on embedding from other pages:
Not sure if you're doing it right? Test your link in this demo page! (Remember the :colon in the link text, and the # for the section!)
Only embed from sites you trust! They can change their content at any time (but that's problem for regular links, too). You can mirror/copy the site to be extra safe.
The other site must either also have Nutshell installed, or :CORS enabled. If you don't know if the other site has Nutshell/CORS, test out linking to it in this demo page.
Other Fun Stuff
You want to embed an explanation, but no-one's written it yet & you can't be bothered to either? Get the intro from a Wikipedia article by linking to it!
:Catgirl on English Wikipedia links to https://en.wikipedia.org/wiki/Catgirl)
:Baguette on French Wikipedia links to https://en.wikipedia.org/wiki/Catgirl)
:Universe on Simple Wikipedia links to https://simple.wikipedia.org/wiki/Universe
You can also link to YouTube videos so they can expand in-place. You can even specify a specific starting time – on a YouTube page, click 'Share' then 'Start at [time]'.
:Knife-Wielding Tentacle, starting at 0:36 links to https://youtu.be/pQ2dI_B_Ycg?t=36
For more advanced features (like how to make a section hidden by default, get sections by text-search instead of headings, add words before/after an embedded snippet, etc...) check out the documentation!