Git Product home page Git Product logo

journey-markdown-converter's Introduction

Convert Journey.Cloud data to Markdown

This command line tool takes your export from Journey.Cloud and converts it to a folder of markdowns. It preserves all pictures and data, and lets you customize the output.

Open the Journey App and export entries as JSON. You will get a .ZIP file that can be converted with this tool.

This was tested with Journey Windows 2.14.3 (Settings -> Database -> Mass-Export)

.NET

How to run

Download a binary for one of the supported platforms:

  • Windows x86
  • Linux x64
  • macOS x64/ARM (There is still an issue with macOS support, see #2)

and run it:

journey-markdown-converter
  Converts a Journey JSON ZIP Export file into Markdown

Usage:
  journey-markdown-converter [options] <infile> [command]

Arguments:
  <infile>  Journey JSON Export ZIP File

Options:
  -o, --out-directory <out-directory>                          Specifies the output directory, if omitted it's next to the ZIP file with the
                                                               same name
  -f, --override-existing                                      Override existing files inside output directory [default: False]
  -v, --verbose                                                Show more information and more detailed error messages [default: False]
  -n, --file-name-template <file-name-template>                File name for the created Markdown file [default: {{String.Format date_journal
                                                               "yyyy-MM-dd"}} {{String.Truncate preview_text_md_oneline 100}}]
  -b, --body-template <body-template>                          Specify a Handlebars template file for the output file. If none specified, the
                                                               default template is used.
  -d, --additional-tags <additional-tags>                      Additional tags that should be added to all files
  -p, --tag-prefix <tag-prefix>                                Prefix that will be prepended to all tags (but not the additional tags)
  -c, --clean-from-filename-chars <clean-from-filename-chars>  Additional characters to clean from file name, forbidden characters are always
                                                               cleaned [default: []#.,]
  --md-github-flavoured                                        Markdown: enable GitHub flavoured [default: False]
  --md-list-bullet-char <md-list-bullet-char>                  Markdown: set a different bullet character for un-ordered lists [default: -]
  --md-smart-href-handling                                     Markdown: Smart href Handling [default: False]
  --md-pass-through-tags <md-pass-through-tags>                Markdown: pass a list of tags to pass through as is without any processing
                                                               [default: ]
  --md-unknown-tags <Bypass|Drop|PassThrough|Raise>            Markdown: pass a list of tags to pass through as is without any processing
                                                               [default: PassThrough]
  --md-table-without-header-row-handling <Default|EmptyRow>    Markdown: Table: By default, first row will be used as header row [default:
                                                               Default]
  --md-whitelist-uri-schemes <md-whitelist-uri-schemes>        Markdown: Specify which schemes (without trailing colon) are to be allowed fora
                                                               and img; tags. Others will be bypassed. By default allows everything. [default:
                                                               ]
  --version                                                    Show version information
  -?, -h, --help                                               Show help and usage information

Commands:
  dump-template <outfile>  Dumps the default Handlebars template to the specified file [default: ]

Portable build

Or download the .NET 6 Runtime and use the portable build on any platform.

Handlebars Templates

The Markdown output and the file name can be completely customized via Handlebars templates.

Default Template

Modify the default template to get custom MarkDown files

{{!
This is a handlebars template for formatting the output

It is using HandleBars.NET with all it's base extensions, see this pages for documentation
- https://github.com/Handlebars-Net/Handlebars.Net.Helpers/#using
}}
---
date_journal: {{String.Format date_journal "o"}}
modified: {{String.Format date_modified "o"}}
tags:
{{#each tags}}
- {{../tagPrefix}}{{this}}
{{/each}}
{{#each additionalTags}}
- {{this}}
{{/each}}
location:
    lat: {{lat}}
    lon: {{lon}}
    address: {{address}}
weather:
    temperature_c: {{weather.degree_c}}
    description: {{weather.description}}
---
{{! everything else is the content of the file}}
{{text_md}}

{{#if photos.length}}
# Photos
{{/if}}
{{#each photos}}
![photo]({{EscapeUri this}})
{{/each}}

Availible Fields

TBD

journey-markdown-converter's People

Contributors

andi0b avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

journey-markdown-converter's Issues

Required argument missing for command: journey-markdown-converter

Hello! Hoping against hope that you're still checking in on this project because I saw where you mentioned that you weren't developing this anymore.

Anyway, I downloaded the Windows binary and when I run it on Windows 11, I get this error: Required argument missing for command: journey-markdown-converter

The window actually only opens briefly and then closes.

So, if there's any help you can offer, that would be amazing.

Custom file name String.Format issue

I'm trying to use the custom file name option, however when using String.Format to format the date (like in the default {{String.Format date_journal "yyyy-MM-dd"}}) I get the error System.ArgumentException: Object of type 'HandlebarsDotNet.UndefinedBindingResult' cannot be converted to type 'System.String'. I'm not that experienced in code and probably I'm just making some mistake, but I couldn't solve the problem so far.

Thank you + Feedback (Mac, Zip size, name conflict issues)

Thank you!

Hello, just wanted to say thank you for taking the time to make this and put it on github!

I was able to migrate 4+ years of Journey json entries into much more future proofed markdown last night thanks to this.

I understand with such a seldom used tool might not be actively coding on it, but I figured it was worth me taking the time to document some feedback I had with using it last night.

Feedback:

1. Mac Issues

I started on mac, and I kept getting errors along the lines of not having read/write permissions on folders. I made sure my terminal had file access permissions, but still got the errors. I did not debug too much, as I then switched to Windows and ran into the below issue.

2. Zip file size

I found the tool would not work on Zip files greater than 4gb or so. Would fail to load, give an error along the lines of couldn't find end of file, etc.

I got around this by exporting my journals in chunks. 3-6 months at a time.

3. Namespace collision

I think I might have lost some entries that were posted on the same day, and started with the same first 100 characters.

This is a rare edge case, but I had forwarded some series of emails that all started the same way.

Would be nice to have a feature to not skip or overwrite, but to simply rename/add a unique number to the end.

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.