Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Desktop: Resolves #5224: Add Yaml exporter/importer #5465

Merged
merged 23 commits into from
Oct 16, 2021
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
794bd60
Add Yaml exporter/importer
CalebJohn Sep 15, 2021
c92b804
Use local time in yaml import tests
CalebJohn Sep 16, 2021
5893bb7
Add tests for Yaml Export
CalebJohn Sep 27, 2021
785d6d0
Fix quoting issues with negative numbers
CalebJohn Sep 27, 2021
524c97c
Fix the package-lock version change
CalebJohn Sep 27, 2021
c19c9d9
Merge branch 'dev' into yaml-export
CalebJohn Sep 28, 2021
0de144a
rename Yaml export to Markdown + Metadata
CalebJohn Sep 29, 2021
81278be
Add test for newlines in title
CalebJohn Sep 29, 2021
9ad9abc
Add importing support for multimarkdown, r-markdown and pandoc
CalebJohn Sep 29, 2021
d76b810
Markdown + Metadata -> Markdown + Front Matter
CalebJohn Sep 29, 2021
893ae2f
Add partial support for Jekyll and hugo import
CalebJohn Sep 29, 2021
c67f759
Re-order ignore files
CalebJohn Sep 29, 2021
e0fe889
Merge branch 'dev' into yaml-export
CalebJohn Sep 29, 2021
bf39290
Merge branch 'dev' into yaml-export
CalebJohn Oct 3, 2021
74b4e44
Merge branch 'dev' into yaml-export
CalebJohn Oct 4, 2021
96beac1
Add test for importing notes with timezone information
CalebJohn Oct 6, 2021
7469530
Don't export coordinates if they're all 0
CalebJohn Oct 6, 2021
2967a7d
Use lowercase for field names
CalebJohn Oct 6, 2021
e7af96a
Use Iso 8601 RFC 3339 datetime for export
CalebJohn Oct 6, 2021
f3db0bc
Change display of MD_FRONTMATTER to MD
CalebJohn Oct 6, 2021
5cfd203
Add spec document
CalebJohn Oct 7, 2021
24daa95
Fix failing test No -> no
CalebJohn Oct 7, 2021
b01d43a
Add more comprehensive types
CalebJohn Oct 9, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -1302,6 +1302,12 @@ packages/lib/services/interop/InteropService_Exporter_Jex.js.map
packages/lib/services/interop/InteropService_Exporter_Md.d.ts
packages/lib/services/interop/InteropService_Exporter_Md.js
packages/lib/services/interop/InteropService_Exporter_Md.js.map
packages/lib/services/interop/InteropService_Exporter_Md_frontmatter.d.ts
packages/lib/services/interop/InteropService_Exporter_Md_frontmatter.js
packages/lib/services/interop/InteropService_Exporter_Md_frontmatter.js.map
packages/lib/services/interop/InteropService_Exporter_Md_frontmatter.test.d.ts
packages/lib/services/interop/InteropService_Exporter_Md_frontmatter.test.js
packages/lib/services/interop/InteropService_Exporter_Md_frontmatter.test.js.map
packages/lib/services/interop/InteropService_Exporter_Raw.d.ts
packages/lib/services/interop/InteropService_Exporter_Raw.js
packages/lib/services/interop/InteropService_Exporter_Raw.js.map
Expand All @@ -1326,6 +1332,12 @@ packages/lib/services/interop/InteropService_Importer_Md.js.map
packages/lib/services/interop/InteropService_Importer_Md.test.d.ts
packages/lib/services/interop/InteropService_Importer_Md.test.js
packages/lib/services/interop/InteropService_Importer_Md.test.js.map
packages/lib/services/interop/InteropService_Importer_Md_frontmatter.d.ts
packages/lib/services/interop/InteropService_Importer_Md_frontmatter.js
packages/lib/services/interop/InteropService_Importer_Md_frontmatter.js.map
packages/lib/services/interop/InteropService_Importer_Md_frontmatter.test.d.ts
packages/lib/services/interop/InteropService_Importer_Md_frontmatter.test.js
packages/lib/services/interop/InteropService_Importer_Md_frontmatter.test.js.map
packages/lib/services/interop/InteropService_Importer_Raw.d.ts
packages/lib/services/interop/InteropService_Importer_Raw.js
packages/lib/services/interop/InteropService_Importer_Raw.js.map
Expand Down
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -1285,6 +1285,12 @@ packages/lib/services/interop/InteropService_Exporter_Jex.js.map
packages/lib/services/interop/InteropService_Exporter_Md.d.ts
packages/lib/services/interop/InteropService_Exporter_Md.js
packages/lib/services/interop/InteropService_Exporter_Md.js.map
packages/lib/services/interop/InteropService_Exporter_Md_frontmatter.d.ts
packages/lib/services/interop/InteropService_Exporter_Md_frontmatter.js
packages/lib/services/interop/InteropService_Exporter_Md_frontmatter.js.map
packages/lib/services/interop/InteropService_Exporter_Md_frontmatter.test.d.ts
packages/lib/services/interop/InteropService_Exporter_Md_frontmatter.test.js
packages/lib/services/interop/InteropService_Exporter_Md_frontmatter.test.js.map
packages/lib/services/interop/InteropService_Exporter_Raw.d.ts
packages/lib/services/interop/InteropService_Exporter_Raw.js
packages/lib/services/interop/InteropService_Exporter_Raw.js.map
Expand All @@ -1309,6 +1315,12 @@ packages/lib/services/interop/InteropService_Importer_Md.js.map
packages/lib/services/interop/InteropService_Importer_Md.test.d.ts
packages/lib/services/interop/InteropService_Importer_Md.test.js
packages/lib/services/interop/InteropService_Importer_Md.test.js.map
packages/lib/services/interop/InteropService_Importer_Md_frontmatter.d.ts
packages/lib/services/interop/InteropService_Importer_Md_frontmatter.js
packages/lib/services/interop/InteropService_Importer_Md_frontmatter.js.map
packages/lib/services/interop/InteropService_Importer_Md_frontmatter.test.d.ts
packages/lib/services/interop/InteropService_Importer_Md_frontmatter.test.js
packages/lib/services/interop/InteropService_Importer_Md_frontmatter.test.js.map
packages/lib/services/interop/InteropService_Importer_Raw.d.ts
packages/lib/services/interop/InteropService_Importer_Raw.js
packages/lib/services/interop/InteropService_Importer_Raw.js.map
Expand Down
9 changes: 9 additions & 0 deletions packages/app-cli/tests/support/test_notes/yaml/duplicates.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: ddd
tags:
- banana
- banana
- banana
---

And a link to note [full](./full.md), and link to the [same note](./full.md).
18 changes: 18 additions & 0 deletions packages/app-cli/tests/support/test_notes/yaml/full.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
title: Test Note Title
updated: 2019-05-01 16:54
created: 2019-05-01 16:54
Source: https://joplinapp.org
author: Joplin
latitude: 37.084021
longitude: -94.51350100
altitude: 0.0000
Completed?: false
due: 2021-08-22 00:00
tags:
- Joplin
- nOte
- pencil
---
Comment on lines +2 to +16
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a mix of lowercase (author) and uppercase (Completed) in there. Is it on purpose? Also the dates don't seem to be UTC?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both of those are on purpose, the importer is meant to be quite flexible and handles poor formatting (case) and as many date formats as possible. If no timezone is provided, the importer will interpret the timezone as local. There's another test that checks notes with ISO 8601 time zones.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense, thanks for clarifying.


This is the note body
6 changes: 6 additions & 0 deletions packages/app-cli/tests/support/test_notes/yaml/inline_tags.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
Title: Inline Tags
Tags: [inline, tag]
---

Body
9 changes: 9 additions & 0 deletions packages/app-cli/tests/support/test_notes/yaml/normalize.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: norm
tags:
- tag1
- tag2
- tag3
---

note body
5 changes: 5 additions & 0 deletions packages/app-cli/tests/support/test_notes/yaml/numbers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: 001
---

note body
20 changes: 20 additions & 0 deletions packages/app-cli/tests/support/test_notes/yaml/r-markdown.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
title: "YAML metadata for R Markdown with examples"
subtitle: "YAML header"
author: Hao Liang
date: "2021-06-10"
output:
md_document:
toc: yes
toc_depth: 2
abstract: YAML is a human-readable and easy to write language to define data structures.
keywords: ["YAML", "Rmd"]
subject: Medicine
description: Rmd makes it possible to use a YAML header to specify certain parameters right at the beginning of the document.
category:
- Rmd
- Medicine
lang: "en-US"
---

Example taken from https://github.com/hao203/rmarkdown-YAML
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: "Distill for R Markdown"
author:
- name: "JJ Allaire"
url: https://github.com/jjallaire
affiliation: RStudio
affiliation_url: https://www.rstudio.com
---

Example taken from https://github.com/hao203/rmarkdown-YAML
7 changes: 7 additions & 0 deletions packages/app-cli/tests/support/test_notes/yaml/short_date.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
title: Date
created: 2017-01-01
updated: 2021-01-01
---

I hope the dates are imported correctly
9 changes: 9 additions & 0 deletions packages/app-cli/tests/support/test_notes/yaml/split.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: xxx
---

---
author: xxx
---

note body
12 changes: 12 additions & 0 deletions packages/app-cli/tests/support/test_notes/yaml/title_newline.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
Title: |-
First
Second
Updated: 28/09/2021 20:57
Created: 28/09/2021 20:57
Latitude: 0.00000000
Longitude: 0.00000000
Altitude: 0.0000
---

This note has a newline in the title
8 changes: 8 additions & 0 deletions packages/app-cli/tests/support/test_notes/yaml/unquoted.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
Title: Unquoted
Longitude: -94.51350100
Completed?: No
DUE: 2022-04-04 13:00
---

note body
7 changes: 7 additions & 0 deletions packages/app-cli/tests/support/test_notes/yaml/utc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
title: Test Note Title
updated: 2019-05-01T16:54:00Z
created: 2019-05-01 16:54-07:00
---

This is the note body
Loading