![38% of CISOs Fear They’re Not Moving Fast Enough on AI](https://cdn.sanity.io/images/cgdhsj6q/production/faa0bc28df98f791e11263f8239b34207f84b86f-1024x1024.webp?w=400&fit=max&auto=format)
Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
@infosupport/kc-cli
Advanced tools
CLI for serving slick Reveal.js presentations for the Info Support Kenniscentrum
The one-stop-shop for @infosupport employees to create and serve slick Reveal.js presentations.
Both local and global installations are possible. Global is easiest and therefore the recommended approach.
Global
This has the advantage that you only have to install it and you're ready to go.
npm install --global @infosupport/kc-cli # Windows
npm install --global @infosupport/kc-cli --unsafe-perm=true # Linux
Local
With this, you are free to choose when you want to upgrade to newer versions of the CLI with, for example, a new corporate design.
You will have to make it an npm
project.
npm init --yes
npm install @infosupport/kc-cli # Windows
npm install @infosupport/kc-cli --unsafe-perm=true # Linux
Then, in the package.json
, add a start script:
{
"scripts": {
"start": "kc serve"
}
}
To get a setup quick and easy, run kc init
. After choosing the "demo" example, it generates a folder structure similar to this:
├── css
│ └── custom.css
├── kc.json
├── labSolutions
├── labs
│ ├── lab01.md
│ ├── lab02.md
│ └── starter
│ └── readme.md
├── slides
│ ├── 00-intro
│ │ ├── 01-title.md
│ │ ├── 02-agenda.md
│ │ └── 03-about.md
│ ├── 01-markdown-basics
│ │ ├── 01-title.md
│ │ ├── 02-text.md
│ └── 99-wrap-up
│ ├── 01-title.md
│ ├── 02-best-practices.md
│ ├── 97-questions.md
│ ├── 98-end.md
│ └── 99-logo.md
└── web-components
└── my-component
├── my-component.js
├── my-component.styles.js
└── my-component.template.js
From there, use your favorite text editor (e.g., Visual Studio Code) to change the content of the slides, modify the custom CSS, etc.
A couple of notes on the project folders:
/slides
contains subdirectories for each chapter/module and holds markdown files (the slides) inside those subfolders. /slides
is the only required folder for a minimal setup/css
is for customizing the style of your presentation using CSS/assets
is for holding assets like images and videos. You can also name this folder something else like /img
/web-components
is for your own custom, interactive presentation widgets. It's advanced stuff. Scroll down for more information./labs
is where you put the labs.To view your presentation:
kc serve # for global installations
npm start # for local installations
option | description |
---|---|
kc serve | serve presentation from current directory on default port |
kc serve -o | open presentation in default browser |
kc serve -o -f java | open presentation in default browser for flavor 'java' (see flavors) |
kc serve -p | use random port |
kc serve -p <port> | use specified <port> |
kc serve --nolive | disable live reload |
Both the presentation as the labs are served. When you run kc serve
you will see message like this:
Presentation url: http://localhost:15000, labs url: http://localhost:15000/labs
You can open one of these URLs in chrome.
Note: Firefox is supported, but Chrome presentations look crispier because revealjs uses proprietary chrome features.
This will export your slides to PDF using Decktape and pdf-lib. First, Decktape reads all the presentation slides and uses pdf-lib to generate a PDF where every page is a slide. With a bit of custom code, this PDF is transformed into a PDF that fits our corporate design.
kc print
will serve
the presentation itself.
option | description |
---|---|
kc print | print presentation to PDF |
kc print --output [filename] | use specified filename |
kc print --module [module number] | generate a PDF for a specific module |
kc print --per-module | generate a PDF for each module. The module titles will be used for filenames |
kc print --flavor java | generate a PDF for a specific flavor (see flavors) |
kc print --no-labs | skip generating a PDF for the labs. |
option | description |
---|---|
kc lint | diagnose issues for when the presentation isn't running as it should |
By default, the corporate identity is applied to every slide. Certain slides can receive specific theming.
<!-- .slide: class="is-welcome" -->
.<!-- .slide: class="is-module" -->
.<!-- .slide: class="is-closing" -->
.<!-- .slide: class="is-fancy1" -->
through <!-- .slide: class="is-fancy3" -->
.<!-- .slide: class="is-lab" -->
.<!-- .slide: class="is-empty" -->
.The CLI offers a few options out of the box:
kc-flex
to turn an element into a flex containerkc-columns
to turn an element into a flex container where all its children have an equal widthkc-grid
to apply a grid to an elementkc-gap1
through kc-gap5
to create a gap between flex/grid itemskc-table
to apply alternating row colors to a tablekc-smaller
to decrease font sizekc-smallest
to decrease font size furtherkc-left
and kc-right
for floating left/right
margin
for tablesApply these classes with a bit of HTML
<div class="kc-flex">
- item 1
- item 2
- item 3
</div>
or with special comments
![Example image](img/example.png)
<!-- .element: class="kc-right" -->
See the example/
folder for exact implementations.
With Reveal.js, we can leverage Web Components to make slides more awesome. Right now, you can use these components out-of-the-box.
Note that web components are not natively supported in IE and this CLI is quite comfortable with not making any effort whatsoever to make it work in those browsers.
web component | description |
---|---|
<kc-timeline events='[{ "year": 2019, "caption": "cool stuff", "description": "detailed explanation of cool stuff" }]'> | A graphical visualization of a timeline. |
<npm-weekly-downloads package="@stryker-mutator/core"></npm-weekly-downloads> | Retrieves the number of weekly downloads for an npm package. Also caches the number in the session storage as to unburden npm's servers |
If you have (created or not) a web component that should be in this list, please let us know.
css
and placing .css
files in there.web-components
with subfolders for every components. The main .js
file should be the same name as the folder it's in.Example folder structure:
|-- css
|-- ...
|-- slides
|-- ...
|-- web-components
|-- cool-graph
|-- cool-graph.js
|-- cool-graph.html.js
|-- cool-graph.css.js
It is possible to host multiple presentations from one master presentation. This is also called a 'monorepo' or 'polyglot' repository.
To get a setup quick and easy, run kc init
and choose the flavors
example.
It will generate the following structure:
.
├── kc.json
├── labs
│ ├── lab01-csharp.md
│ ├── lab01-java.md
│ └── lab02-shared.md
└── slides
├── 00-intro
│ └── 01-title.md
├── 01-chapter-csharp
│ └── 01-title.md
├── 01-chapter-java
│ └── 01-title.md
├── 02-shared-chapter
│ ├── 01-title.md
│ ├── 02-specific-slide-csharp.md
│ ├── 02-specific-slide-java.md
│ ├── 03-shared-slide.md
│ └── 04-lab.md
└── 03-outro
└── 99-recap.md
This is an example of using 2 flavors: csharp
or java
. Flavors names can be anything, they don't have to be programming languages.
kc.json
The kc.json file is where you configure the flavors. The example looks like this:
{
"$schema": "https://unpkg.com/@infosupport/kc-cli/kc-schema.json",
"flavors": {
"csharp": {
"trainingCode": "FLCS"
},
"java": {
"trainingCode": "FLJV"
}
}
}
Here, each flavor has a name ("csharp" and "java" in this example) and a trainingCode
. The training code is used to base the pdf
name on when using kc print
and they should reflect the KC training code for the training.
When you run kc serve
with multiple flavors defined in the kc.json
file, you can choose which flavor to active using the ?flavor=flavorName
on the query string. It is also printed to the console:
Presentation has 2 flavor(s):
csharp: http://localhost:35943?flavor=csharp
java: http://localhost:35943?flavor=java
Using serve
with --open
(or -o
) will open all the flavors in your default browser, or it will open a specific flavor of your choosing with --flavor java
(or -f java
).
You can switch flavors mid-presentation using the c
button. This can be especially helpful when you're creating the presentation to see.
When using multiple flavors, slides are shown as usual, but there are ways to choose what to display on specific flavors:
01-chapter-flavorName
directory to create a chapter specific to a flavor.01-chapter/01-slide-flavorName.md
file to create a markdown file specific to a flavor.<-- slide: data-kc-flavor="flavorName" -->
to create 1 slide specific to a flavor.flavor-flavorName
CSS class to deviate inside text.
java
flavor.Here are some useful examples:
The mocking framework we're going to use is <span class="flavor-java">mockito</span><span class="flavor-csharp">moq</span>
Installing this with:
```sh
dotnet add package moq
```
<!-- .element class="flavor-csharp" -->
```xml
<!-- <project><dependencies> -->
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>4.11.0</version>
<scope>test</scope>
</dependency>
<!-- </dependencies></project> -->
```
<!-- .element class="flavor-java" -->
When printing a presentation with multiple flavors, they are all printed by default. You can choose a specific flavor to print using --flavor flavorName
.
The kc-cli uses this naming scheme for pdfs:
[output]-<trainingCode>-[nr-chapterTitle].pdf
Where:
output
is the optional --output
parameter value.trainingCode
is the required training code associated with the flavor.nr-chapterTitle
nr and chapter title are the nr and name of the chapter when using --per-module
.None at the moment.
FAQs
CLI for serving slick Reveal.js presentations for the Info Support Kenniscentrum
The npm package @infosupport/kc-cli receives a total of 198 weekly downloads. As such, @infosupport/kc-cli popularity was classified as not popular.
We found that @infosupport/kc-cli demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.