Open hustf opened 2 years ago
hmm interesting! I like the idea of having some button where you can toggle some lines on and off maybe something like
```!
using Pkg, Random # opt
a = rand(50)
println(sum(a))
with the idea that # opt
(we could find some other flag) lines are surrounded by an additional <span ...>
where the visibility can be toggled on / off by a button.
If this is indeed what you have in mind I think the easiest is to do this as a pre-processing step prior to calling highlight.js. I am incompetent in Javascript though so this would have to be picked up by someone else and could be something shown as a demo.
From a Franklin slack thread, two weeks ago. I personally use another solution, but this could be a potential improvement to Franklin.
Most lines of code are not relevant to the point we are trying to make in blog posts. The #HIDE functionality is great for dispersing the interesting snippets through a text.
On the other hand, we want to share the details with those who are interested in reproducing. Which is why I added a 'full disclosure' script page here in https://hustf.github.io/DEQ/allscripts/.
On the third hand, some might NOT want to share proprietary or shameful parts of their code. But such code could always be included in separate files. In other words, there is no need for #SECRET lines.
I can think of two ideal interfaces which Franklin could offer:
1) A separate command or argument for showing #HIDE lines in snippets. The code would be coloured. No interaction by the reader.
2) A Javascript / stylesheet solution. Hidden lines could be styled / tagged by a preprocessor and shown in a button script similar to 'copy'. The script would toggle the line height of those lines so as to be invisible, but the lines would be included in a copy operation regardless.
Personally, I now use a third, ugly and shameful solution where I run a script to process all files and store hidden lines in new files. That is duplication of effort, a special need, and not an interesting solution to include in Franklin.