Vscode Jupyter Notebook Markdown



Markdown

Motivation

After attending MicroStrategy World at the Cosmopolitan in Las Vegas one message stuck in my mind from watching the demos: What we can do with the platform is only limited by our imagination. The new shift toward Embedded Analytics was exciting, so I wanted to test out how easy would it be to embed MicroStrategy with one of my favorite tools, Jupyter Notebook. I use Jupyter Notebook a lot especially when I am testing a new idea that I want to code since it allows me to easily document my thinking process; add headers and bullets all using markdown and few needed keyboard shortcuts (Literate Programming).

Implementation

Vscode Jupyter Notebook Markdown

Here's how to format Markdown cells in Jupyter notebooks: Headings Use the number sign (#) followed by a blank space for notebook titles and section headings: # for titles ## for major headings ### for subheadings #### for 4th level subheadings; Emphasis Use the following code to emphasize text: Bold text: string or.string. Italic text.

In this short example, I will be using the MicroStrategy Tutorial project. Before we start you will either need to create a new Dossier or use an existing one. Drivers tp-link modems. In this case, I created two that I plan to embed. Once you have your visualization ready, you will need to publish/save to the MicroStrategy Library.

Jupyter notebook markdown new line

What is a MicroStrategy Library?

Vscode Jupyter Notebook Markdown

This is how MicroStrategy describes it:

Issue Type: Bug After installing the latest updates, my jupyter notebooks no longer works. VS Code version: Code - Insiders 1.54.0-insider (9ecd3fc, 2021-02-23T10:46:22.816Z) OS version: WindowsNT x64 10.0.21313 System Info Item Value C. Import pandas as pd import seaborn as sns from sklearn.linearmodel import RidgeCV import numpy as np. Mar 26, 2020 I wrote all the text, symbols (even the arrows!) and equations in the image above on Jupyter notebook’s markdown! Without a doubt, documentation is an essential part of working in Data Science.

Business users can access dossier apps through a simple, personalized interface: the MicroStrategy Library™. This central hub lets users quickly locate the content they need by scanning thumbnail tiles or using our advanced search functionality to locate dossiers, objects, or specific visualizations. Available on the web and in a dedicated mobile app, the MicroStrategy Library puts answers in users’ hands, wherever they are.

Vscode Jupyter Notebook Markdown

Once your Dossier is published in the MicroStrategy Library you will need to copy the URL for the specific Dossier you want to embed. Crazy brave joy harjo.

Jupyter Notebook and Magic Cells

For those not familiar with Jupyter Notebook, it is a very popular tool for writing code since you can combine code cells with other cell types such as Markdown or LaTeX (for formatting mathematical formulae). You can run each code cell individually (one at a time) and see the output of each cell right underneath that cell. Jupyter also offers advanced techniques and widgets to make the document more interactive which can be ideal when it comes to sharing these documents with others for training, step-by-step tutorials or sharing knowledge (i.e. blogging). You can install different kernels to support languages such as Python, R, Julia, NodeJS, Scala to name few. Python is the most popular and common usage.

Jupyter also comes with additional tools for exporting and converting the notebooks to other formats such as HTML, PDF, LaTeX .etc.

In addition, there are built-in commands known as IPython Magic commands: Line Magic and Cell Magic. We will be leveraging %%html and %%javascript in order to embed our Dossier.

Vscode Jupyter Notebook Markdown

Output example:

Let’s code:

Launch your jupyter notebook.

We then start by referencing the MicroStrategy Javascript library that supports embedding which comes with the install.

In the first cell we enter:

We will add to the same cell our <div> tag to create a placeholder for where we would like to embed the Dossier. The id can be anything, which later you will reference in the Javascript document.getElementById(). If you are embedding more than one visualization, make sure they each have unique ids. In my case, I will be using id='chart1' and id='chart2'.

In a second cell we use %%javascript to insert our javascript code. Here you will paste the URL to the Dossier from the MicroStrategy Library.

And that’s it. Once you run the cell, the visualization will load and it’s interactive.

This is how the code would look like in the notebook cells:


Now, if your desire is to export this into HTML or PDF you can do so with nbconvert. Launch your terminal and type:

This will create the HTML file with embedded ‘interactive’ visualizations that you can publish. If you want other formats like Markdown, PDF, Slides (which generates a Reveal.js HTML slideshow) all you need to do is just replace --to HTML with the appropriate value.

Vs Code Jupyter Notebook Markdown Free

As an added bonus: if you don’t want the code cells to be always visible there is an option to create a toggle button (to hide/unhide the code). The toggle button will be part of the HTML export and users can switch (on/off) to see the code if they wish.

Here is the snippet which I found to be useful. Place this as the first cell in the notebook: Evernote add to stack.

Vscode Jupyter Notebook Markdown Cell

First of all, we can use built-in magic commands. The full list of commands can be obtained:

It can be useful, for example if we want to use some fast shell command like sed, awk or just

All of this beauty we can use as variable in our notebook:

Vscode Python Notebook

Very powerfull command is psource, that can show us signature of functions and source code. Also we can use command ?, ?? for that. For capturing output from pager to our notebook we can overload method (also see, stackoverflow's discussion about it.):

Vscode Jupyter Notebook Markdown New Line

If we want to run other python file or even notebook file (*.ipynb), command %run helps us.