Git Product home page Git Product logo

one2html's Introduction

one2html

one2html lets you convert OneNote® files (sections or whole notebooks) into HTML.

Installation

At the moment only installation from source is supported. This requires the latest stable Rust compiler. Once you've installed the Rust toolchain run:

cargo install one2html

Note: By default, One2HTML has support for printing stack traces when errors occur during OneNote file parsing. This however requires a nightly compiler. To compile with a stable compiler instead, add the --no-default-features flag to the cargo install command.

Usage

Download OneNote files from OneDrive

OneNote files can be retrieved using one of two methods: Either by using onedrive-cli or by downloading a notebook via the OneDrive web UI. To do this first install onedrive-cli following its instructions. After logging in using onedrive-cli login, you can download a section (a single .one file), or a notebook (a folder that contains a .onetoc2 file along with other .one files):

# Download a notebook
onedrive-cli ls Documents/
onedrive-cli cp -R :/Documents/Notebook .

# Download a section
onedrive-cli cp -R :/Documents/Notebook/Section.one .

Alternatively, to download OneNote notebooks via the OneDrive web UI, follow these steps:

  1. Visit https://onedrive.live.com/
  2. Select the folder that contains your notebooks. Typically this is the Documents folder.
  3. Use the Download button from the toolbar to download a ZIP file that contains all of your OneNote notebooks.

Convert OneNote files to HTML

OneNote sections are stored in .one files. To convert a section to HTML run:

one2html -i Section.one -o ./output_dir/

OneNote notebooks are stored as folders that contain a .onetoc2 file along with the notebook's sections stored as .one files. To convert a notebook to HTML run:

one2html -i 'Notebook/Open Notebook.onetoc2' -o ./output_dir/

Limitations

  • Due to limitations of the OneNote parser only files downloaded from OneDrive are supported. This means you can't convert files created by the OneNote 2016 desktop application using this tool.
  • Ink drawings are not supported at the moment.
  • Math formulas are not rendered properly at the moment.

Disclaimer

This project is neither related to nor endorsed by Microsoft in any way. The author does not have any affiliation with Microsoft.

one2html's People

Contributors

cccs-rs avatar dependabot[bot] avatar msiemens avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

one2html's Issues

failed to compile `one2html v1.0.0`

Hello, im new to Rust but i managed to get this far and then error, any thoughts? Very well could be something im doing wrong. (Im on mac)

error[E0554]: `#![feature]` may not be used on the stable release channel
 --> /Users/user/.cargo/registry/src/github.com-1ecc6299db9ec823/one2html-1.0.0/src/main.rs:1:36
  |
1 | #![cfg_attr(feature = "backtrace", feature(backtrace))]
  |                                    ^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
  --> /Users/user/.cargo/registry/src/github.com-1ecc6299db9ec823/one2html-1.0.0/src/utils.rs:12:41
   |
12 |     let _state = happylog::set_progress(&bar);
   |                                         ^^^^ expected struct `indicatif::progress_bar::ProgressBar`, found struct `ProgressBar`
   |
   = note: expected reference `&indicatif::progress_bar::ProgressBar`
              found reference `&ProgressBar`

error: aborting due to 2 previous errors

Some errors have detailed explanations: E0308, E0554.
For more information about an error, try `rustc --explain E0308`.
error: failed to compile `one2html v1.0.0`, intermediate artifacts can be found at `/var/folders/6y/wfd9d7ln57jbf4b_6kzc_bm80000gn/T/cargo-install05K6kd`

Caused by:
  could not compile `one2html`

To learn more, run the command again with --verbose.```

Failed to compile 1.1.1 due to dependency conflicts.

I'm new to rust so I'm working out how to identify the dependencies, but figured I would write up the issue in case it is easier for you to fix.

Error:

   Compiling askama v0.10.5
   Compiling one2html v1.1.1
error[E0308]: mismatched types
  --> /home/rharlicker/.cargo/registry/src/github.com-1ecc6299db9ec823/one2html-1.1.1/src/utils.rs:12:41
   |
12 |     let _state = happylog::set_progress(&bar);
   |                  ---------------------- ^^^^ expected struct `indicatif::progress_bar::ProgressBar`, found struct `ProgressBar`
   |                  |
   |                  arguments to this function are incorrect
   |
   = note: expected reference `&indicatif::progress_bar::ProgressBar`
              found reference `&ProgressBar`
   = note: perhaps two different versions of crate `indicatif` are being used?
note: function defined here
  --> /home/rharlicker/.cargo/registry/src/github.com-1ecc6299db9ec823/happylog-0.2.0/src/console_emitter.rs:93:8
   |
93 | pub fn set_progress(pb: &ProgressBar) -> LogPBState {
   |        ^^^^^^^^^^^^

For more information about this error, try `rustc --explain E0308`.
error: could not compile `one2html` due to previous error
error: failed to compile `one2html v1.1.1`, intermediate artifacts can be found at `/tmp/cargo-installHKyoZX`

---- Noticed the following in the logs...

   Compiling sanitize-filename v0.3.0
   Compiling indicatif v0.17.0
   Compiling indicatif v0.16.2
   Compiling rand_chacha v0.2.2

-- Did some searching, found cargo tree

rharlicker@DESKTOP-I7RFFUU:/mnt/c/repos/one2html$ rm *.lock
rharlicker@DESKTOP-I7RFFUU:/mnt/c/repos/one2html$ cargo tree -d
    Updating crates.io index
console v0.14.1
└── one2html v1.1.1 (/mnt/c/repos/one2html)

console v0.15.1
├── happylog v0.2.0
│   └── one2html v1.1.1 (/mnt/c/repos/one2html)
├── indicatif v0.16.2
│   └── one2html v1.1.1 (/mnt/c/repos/one2html)
└── indicatif v0.17.0
    └── happylog v0.2.0 (*)

indicatif v0.16.2 (*)
indicatif v0.17.0 (*)

-- I Attempted to fix the Cargo.toml file to override the dependencies to indicatif v0.17.0 but it didn't seem to take event through cargo tree and cargo tree -d looked clean afterwards.
(e.g the original error...)

cargo tree

one2html v1.1.1 (/mnt/c/repos/one2html)
├── askama v0.10.5
│   ├── askama_derive v0.10.5 (proc-macro)
│   │   ├── askama_shared v0.11.2
│   │   │   ├── askama_escape v0.10.3
│   │   │   ├── humansize v1.1.1
│   │   │   ├── nom v6.2.1
│   │   │   │   ├── bitvec v0.19.6
│   │   │   │   │   ├── funty v1.1.0
│   │   │   │   │   ├── radium v0.5.3
│   │   │   │   │   ├── tap v1.0.1
│   │   │   │   │   └── wyz v0.2.0
│   │   │   │   ├── funty v1.1.0
│   │   │   │   ├── lexical-core v0.7.6
│   │   │   │   │   ├── arrayvec v0.5.2
│   │   │   │   │   ├── bitflags v1.3.2
│   │   │   │   │   ├── cfg-if v1.0.0
│   │   │   │   │   ├── ryu v1.0.11
│   │   │   │   │   └── static_assertions v1.1.0
│   │   │   │   └── memchr v2.3.4
│   │   │   │   [build-dependencies]
│   │   │   │   └── version_check v0.9.4
│   │   │   ├── num-traits v0.2.15
│   │   │   │   [build-dependencies]
│   │   │   │   └── autocfg v1.1.0
│   │   │   ├── percent-encoding v2.1.0
│   │   │   ├── proc-macro2 v1.0.43
│   │   │   │   └── unicode-ident v1.0.3
│   │   │   ├── quote v1.0.21
│   │   │   │   └── proc-macro2 v1.0.43 (*)
│   │   │   ├── serde v1.0.143
│   │   │   │   └── serde_derive v1.0.143 (proc-macro)
│   │   │   │       ├── proc-macro2 v1.0.43 (*)
│   │   │   │       ├── quote v1.0.21 (*)
│   │   │   │       └── syn v1.0.99
│   │   │   │           ├── proc-macro2 v1.0.43 (*)
│   │   │   │           ├── quote v1.0.21 (*)
│   │   │   │           └── unicode-ident v1.0.3
│   │   │   ├── syn v1.0.99 (*)
│   │   │   └── toml v0.5.9
│   │   │       └── serde v1.0.143 (*)
│   │   ├── proc-macro2 v1.0.43 (*)
│   │   └── syn v1.0.99 (*)
│   ├── askama_escape v0.10.3
│   └── askama_shared v0.11.2 (*)
├── color-eyre v0.5.11
│   ├── backtrace v0.3.59
│   │   ├── addr2line v0.15.2
│   │   │   └── gimli v0.24.0
│   │   ├── cfg-if v1.0.0
│   │   ├── libc v0.2.132
│   │   ├── miniz_oxide v0.4.4
│   │   │   └── adler v1.0.2
│   │   │   [build-dependencies]
│   │   │   └── autocfg v1.1.0
│   │   ├── object v0.24.0
│   │   └── rustc-demangle v0.1.21
│   │   [build-dependencies]
│   │   └── cc v1.0.73
│   ├── color-spantrace v0.1.6
│   │   ├── once_cell v1.13.1
│   │   ├── owo-colors v1.3.0
│   │   ├── tracing-core v0.1.29
│   │   │   └── once_cell v1.13.1
│   │   └── tracing-error v0.1.2
│   │       ├── tracing v0.1.36
│   │       │   ├── cfg-if v1.0.0
│   │       │   ├── pin-project-lite v0.2.9
│   │       │   ├── tracing-attributes v0.1.22 (proc-macro)
│   │       │   │   ├── proc-macro2 v1.0.43 (*)
│   │       │   │   ├── quote v1.0.21 (*)
│   │       │   │   └── syn v1.0.99 (*)
│   │       │   └── tracing-core v0.1.29 (*)
│   │       └── tracing-subscriber v0.2.25
│   │           ├── sharded-slab v0.1.4
│   │           │   └── lazy_static v1.4.0
│   │           ├── thread_local v1.1.4
│   │           │   └── once_cell v1.13.1
│   │           └── tracing-core v0.1.29 (*)
│   ├── eyre v0.6.8
│   │   ├── indenter v0.3.3
│   │   └── once_cell v1.13.1
│   ├── indenter v0.3.3
│   ├── once_cell v1.13.1
│   ├── owo-colors v1.3.0
│   └── tracing-error v0.1.2 (*)
├── console v0.15.1
│   ├── libc v0.2.132
│   ├── once_cell v1.13.1
│   ├── terminal_size v0.1.17
│   │   └── libc v0.2.132
│   └── unicode-width v0.1.9
├── happylog v0.2.0
│   ├── console v0.15.1 (*)
│   ├── indicatif v0.17.0
│   │   ├── console v0.15.1 (*)
│   │   ├── number_prefix v0.4.0
│   │   └── unicode-width v0.1.9
│   ├── log v0.4.17
│   │   └── cfg-if v1.0.0
│   └── structopt v0.3.26
│       ├── clap v2.34.0
│       │   ├── ansi_term v0.12.1
│       │   ├── atty v0.2.14
│       │   │   └── libc v0.2.132
│       │   ├── bitflags v1.3.2
│       │   ├── strsim v0.8.0
│       │   ├── textwrap v0.11.0
│       │   │   └── unicode-width v0.1.9
│       │   ├── unicode-width v0.1.9
│       │   └── vec_map v0.8.2
│       ├── lazy_static v1.4.0
│       └── structopt-derive v0.4.18 (proc-macro)
│           ├── heck v0.3.3
│           │   └── unicode-segmentation v1.9.0
│           ├── proc-macro-error v1.0.4
│           │   ├── proc-macro-error-attr v1.0.4 (proc-macro)
│           │   │   ├── proc-macro2 v1.0.43 (*)
│           │   │   └── quote v1.0.21 (*)
│           │   │   [build-dependencies]
│           │   │   └── version_check v0.9.4
│           │   ├── proc-macro2 v1.0.43 (*)
│           │   ├── quote v1.0.21 (*)
│           │   └── syn v1.0.99 (*)
│           │   [build-dependencies]
│           │   └── version_check v0.9.4
│           ├── proc-macro2 v1.0.43 (*)
│           ├── quote v1.0.21 (*)
│           └── syn v1.0.99 (*)
├── indicatif v0.17.0 (*)
├── itertools v0.9.0
│   └── either v1.8.0
├── log v0.4.17 (*)
├── mime_guess v2.0.4
│   ├── mime v0.3.16
│   └── unicase v2.6.0
│       [build-dependencies]
│       └── version_check v0.9.4
│   [build-dependencies]
│   └── unicase v2.6.0 (*)
├── once_cell v1.13.1
├── onenote_parser v0.3.0
│   ├── bytes v0.5.6
│   ├── encoding_rs v0.8.31
│   │   └── cfg-if v1.0.0
│   ├── enum-primitive-derive v0.2.2 (proc-macro)
│   │   ├── num-traits v0.2.15 (*)
│   │   ├── quote v1.0.21 (*)
│   │   └── syn v1.0.99 (*)
│   ├── itertools v0.9.0 (*)
│   ├── num-traits v0.2.15 (*)
│   ├── paste v1.0.8 (proc-macro)
│   ├── thiserror v1.0.32
│   │   └── thiserror-impl v1.0.32 (proc-macro)
│   │       ├── proc-macro2 v1.0.43 (*)
│   │       ├── quote v1.0.21 (*)
│   │       └── syn v1.0.99 (*)
│   ├── uuid v0.8.2
│   └── widestring v0.4.3
├── palette v0.5.0
│   ├── approx v0.3.2
│   │   └── num-traits v0.2.15 (*)
│   ├── num-traits v0.2.15 (*)
│   ├── palette_derive v0.5.0 (proc-macro)
│   │   ├── proc-macro2 v1.0.43 (*)
│   │   ├── quote v1.0.21 (*)
│   │   └── syn v1.0.99 (*)
│   └── phf v0.8.0
│       └── phf_shared v0.8.0
│           └── siphasher v0.3.10
│   [build-dependencies]
│   └── phf_codegen v0.8.0
│       ├── phf_generator v0.8.0
│       │   ├── phf_shared v0.8.0 (*)
│       │   └── rand v0.7.3
│       │       ├── getrandom v0.1.16
│       │       │   ├── cfg-if v1.0.0
│       │       │   └── libc v0.2.132
│       │       ├── libc v0.2.132
│       │       ├── rand_chacha v0.2.2
│       │       │   ├── ppv-lite86 v0.2.16
│       │       │   └── rand_core v0.5.1
│       │       │       └── getrandom v0.1.16 (*)
│       │       ├── rand_core v0.5.1 (*)
│       │       └── rand_pcg v0.2.1
│       │           └── rand_core v0.5.1 (*)
│       └── phf_shared v0.8.0 (*)
├── percent-encoding v2.1.0
├── regex v1.4.6
│   ├── aho-corasick v0.7.15
│   │   └── memchr v2.3.4
│   ├── memchr v2.3.4
│   └── regex-syntax v0.6.27
├── sanitize-filename v0.3.0
│   ├── lazy_static v1.4.0
│   └── regex v1.4.6 (*)
└── structopt v0.3.26 (*)

Thoughts?

Support for newer versions

Hi there!

Thanks for the amazing lib!

I was able to install it, but it seems to be lacking support for newer .one versions

(base) ➜  one2html git:(master) ✗ one2html -i './data/Nina2021Weekly.one' -o ./data  
Processing section Nina2021Weekly.one...

   0: Malformed OneStore data: not a legacy OneStore file

Location:
   src/main.rs:73

Backtrace omitted.
Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.