Giter Site home page Giter Site logo

Comments (7)

jun6lee avatar jun6lee commented on July 27, 2024 1

Sure thing.

I was looking to do something like this which I was using on another plugin:

---
book: {{library.ZSORTTITLE}}
author: {{library.ZAUTHOR}}
language: {{library.ZLANGUAGE}}
last_opened: {{dateFormat library.ZLASTOPENDATE "YYYY/MM/DD HH:mm:ss" }}
tags:
- highlights/iBooks
---
# ๐Ÿ“” {{library.ZSORTTITLE}}
---
{{#if library.ZBOOKDESCRIPTION}}

## ๐Ÿงพ Description
---
	{{{library.ZBOOKDESCRIPTION}}}
{{/if}}

### ๐Ÿ” Highlights
---

{{#group annotation by="ZFUTUREPROOFING5"}}
#### ๐Ÿ“š{{value}}
---

{{#each items}}
{{#if ZANNOTATIONSELECTEDTEXT}}
{{#is ZANNOTATIONSTYLE 5}}
- ๐ŸŽฏ <mark style="background: #C4B3D9;">{{ZANNOTATIONSELECTEDTEXT}}</mark>
{{/is}}
{{#is ZANNOTATIONSTYLE 4}}
- ๐ŸŽฏ <mark style="background: #E6A5AB;">{{ZANNOTATIONSELECTEDTEXT}}</mark>
{{/is}}
{{#is ZANNOTATIONSTYLE 3}}
- ๐ŸŽฏ <mark style="background: #EDD570;">{{ZANNOTATIONSELECTEDTEXT}}</mark>
{{/is}}
{{#is ZANNOTATIONSTYLE 2}}
- ๐ŸŽฏ <mark style="background: #A8BADE;">{{ZANNOTATIONSELECTEDTEXT}}</mark>
{{/is}}
{{#is ZANNOTATIONSTYLE 1}}
- ๐ŸŽฏ <mark style="background: #B0D17F;">{{ZANNOTATIONSELECTEDTEXT}}</mark>
{{/is}}
{{#is ZANNOTATIONSTYLE 0}}
- ๐ŸŽฏ <mark style="background: #FFD9B3;">{{ZANNOTATIONSELECTEDTEXT}}</mark>
{{/is}}
{{/if}}
{{#if ZANNOTATIONNOTE}}
        - โœ๏ธ {{ZANNOTATIONNOTE}}
{{/if}}
<sub>Highlighted: {{dateFormat ZANNOTATIONCREATIONDATE "YYYY/MM/DD HH:mm:ss" }}</sub>
---
{{/each}}
{{/group}}
Source::  [Apple Books Link](ibooks://assetid/{{library.ZASSETID}})

from obsidian-apple-books-highlights-plugin.

jun6lee avatar jun6lee commented on July 27, 2024 1

Works for me, no rush. :)

from obsidian-apple-books-highlights-plugin.

bandantonio avatar bandantonio commented on July 27, 2024

@jun6lee Thank you for your interest in the plugin.
I briefly reviewed your PR, lgtm but as I can see, the annotationStyle is unused within the template. Furthermore, you said that

Will share a suggested template for anyone looking to do the same, once we have the fields.

Would it make more sense for you to update the PR to introduce colors for the highlights? Without it, the PR looks a bit unfinished. Ultimately, these changes can then be reflected in documentation as "advanced" template customization for those who want (or need) color differentiation in their book highlights. What do you think?

Thanks

from obsidian-apple-books-highlights-plugin.

jun6lee avatar jun6lee commented on July 27, 2024

If you could push what I've added so far, I can test this and share an advanced_template file in a day or two.

Would that work for you?

from obsidian-apple-books-highlights-plugin.

jun6lee avatar jun6lee commented on July 27, 2024

I also think I may need to add an apple date converter proc, which I have on standby.

from obsidian-apple-books-highlights-plugin.

jun6lee avatar jun6lee commented on July 27, 2024

const APPLE_EPOCH_START = new Date("2001-01-01").getTime();
--- been able to dig out that Apple does a weird thing with EPOCH timestamps, so start with this.

and feed the ZANNOTATIONMODIFICATIONDATE or ZANNOTATIONCREATIONDATE something like this:

      modifiedAt: convertAppleTime(r.modifiedAt),
      createdAt: convertAppleTime(r.createdAt),

using

function convertAppleTime(appleTime) {
  return new Date(APPLE_EPOCH_START + appleTime * 1000).getTime();
}

from obsidian-apple-books-highlights-plugin.

bandantonio avatar bandantonio commented on July 27, 2024

@jun6lee Thanks for sharing.

I was looking to do something like this which I was using on another plugin:

I see no problems integrating colors into the template and provide it as an example of advanced customization. You also saved me time for testing the mapping of ZANNOTATIONSTYLE numbers to their respective colors ๐Ÿ˜„

If you could push what I've added so far, I can test this and share an advanced_template file in a day or two.

I'm now in the middle of releasing a new version and will get back to the colored template in a day or two as well, so basically I can pick up your PR #1 where you left off and add all the necessary changes, if you don't mind.

As for the time, it looks doable, but it's definitely a separate improvement. I would like to check it on my side.

from obsidian-apple-books-highlights-plugin.

Related Issues (8)

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.