Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
luke-strange committed Sep 6, 2024
1 parent d549fe2 commit a8be140
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 16 deletions.
18 changes: 18 additions & 0 deletions src/_includes/content/description.vto
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<h3>Why?</h3>
<p>
This tool was born from recent work on our <a href="https://open-innovations.github.io/housing/">housing site</a> where we started
<a href="https://open-innovations.github.io/housing/data/explorations/">documenting some of our code</a> using
jupyter notebooks. In summary:
<ul>
<li>If you have a <code>jupyter notebook</code> and you want to put it on a <code><a href="/">Lume</a></code> site, you need to convert it to a format <code>Lume</code> knows about.</li>
<li>You can automatically convert notebooks to <code>markdown</code> with <code>jupyter <a href="https://nbconvert.readthedocs.io/en/latest/usage.html">nbconvert</a></code>. </li>
<li>However, if you then want to include other elements like <code><a href="https://open-innovations.github.io/oi-lume-viz/samples/">OI Lume charts</a></code> or parts of other pages using <code>{{ "{{ includes }}" |> escape }}</code> tags, you need a <code><a href="https://vento.js.org/">.vento</a></code> (or <code>.njk</code>) file.</li>
<li>This tool converts the <code>markdown</code> format to <code>vento</code>, preserving things like front matter, and various <code>HTML</code> tags. It adds <code>{{ "<p>" |> escape }}</code> tags to sentences and formats any code blocks correctly so that they can be styled using the <code><a href="https://lume.land/plugins/prism/">prism</a></code> plugin. </li>
</ul>
</p>
<h3>How to use:</h3>
<p>
First, convert your notebook using the command line: <code>jupyter nbconvert your_notebok.ipynb --to markdown</code>.
The output will be saved in your current working directory. Then use this tool to convert the markdown to vento.
</p>

21 changes: 5 additions & 16 deletions src/index.vto
Original file line number Diff line number Diff line change
@@ -1,26 +1,15 @@
---
title: Markdown to Vento Converter
title:
---
<p>
On our <a href="https://open-innovations.github.io/housing/">housing site</a> we recently started
<a href="https://open-innovations.github.io/housing/data/explorations/">documenting some of our code</a> using
jupyter notebooks. It's easy to convert these to markdown format using <code>jupyter nbconvert</code>, and Lume
supports markdown as a template format. This worked fine until we wanted to put <a href="https://open-innovations.github.io/oi-lume-viz/samples/">
OI Lume charts</a> onto those pages as well. At this point, we needed to convert the files to Vento to allow us to load
the charts and maintain the styling for the code blocks. This was a tedious manual process, so we made a tool to do it for us.
This programme runs in the browser - nothing ever leaves your computer.
</p>
<p>
First, convert your notebook using the command line: <code>jupyter nbconvert your_notebok.ipynb --to markdown</code>.
The output will be saved in your current working directory. <a href="https://nbconvert.readthedocs.io/en/latest/usage.html">Read the docs</a>
for more detailed info. Then use this tool to convert the markdown to vento.
</p>

{{ include 'content/description.vto' }}

<div id="drop-area">
<p>Drop a markdown file here</p>
<p>or</p>
<input type="file" id="fileElem" accept=".md">
</div>

<p class="padded"><a id="download-link" download="converted.vto">Download Converted File</a></p>

<p class='warning padded centred'>This programme runs in the browser - nothing ever leaves your computer.</p>
<script src="/assets/js/app.js"></script>

0 comments on commit a8be140

Please sign in to comment.