balena-io / pensieve

A tool for managing and viewing structured documents, backed by the power of git
7 stars 5 forks source link

Add a function to import entries from a markdown document #202

Closed LucianBuzzo closed 6 years ago

LucianBuzzo commented 6 years ago

Fixes #201

An entry is denoted by an h2 tag (## in markdown), all text until the next h2 tag is considered to be part of the entry. The value of the h2 tag is used as the entry title. The first element in the schema is treated as the entry title. Any h3 tag (### in markdown) is converted to an entry field. The value for the h3 tag is used as the entry field's name and all text until the next occurring h3 tag is considered to be the value of the field. If there is text immediately after an h2 tag, it is added to the entry using the key Imported copy.

change-type: minor

lekkas commented 6 years ago

relevant thread: https://www.flowdock.com/app/rulemotion/r-process/threads/HNBF5A0mDADOsy7KlXmR28g4S3d

I think I might have been a bit impatient and tested a still in progress branch :P In any case, I have a few notes/questions:

LucianBuzzo commented 6 years ago

@lekkas

What is the import copy key? I'm don't quite follow the last point in the instructions

If for example your markdown looks like this:

## Entry title
Lorem ipsum dolor sit amet
### Subheader
Duis eu metus maximus, malesuada ex sed, volutpat neque.

We need somewhere to store the text immediately after the h2 tag but before the first h3 tag.

I'd love to have the option to make changes to the imported markdown in a similar fashion. That is, by editing the entries MD directly. If it makes sense to you, I can open an issue.

You get access to the markdown stored in fields by editing an entry, is that not so?

Probably irrelevant to this PR, I'm not sure why I cannot get nested points working consistently in MD text boxes (see example 1 and example 2) - I should probably open a separate issue for this as well

I experimented with this and found that the showdown module we're using for markdown requires you to use 4 spaces, if this is inconsistend with GitHub's approach we should probably adjust this

alexandrosm commented 6 years ago

In case kostas wants to edit the whole entry as a single markdown file, I would say "sorry, that's not going to be possible" since the "external" markdown may interfere with markdown inside a specific markdown field, and also information (like datatypes) may have to be thrown away in the conversion process. The entry as it is in pensieve is a higher-quality piece of information than a markdown file. as such, we can go markdown -> pensieve, but not the other way around.

--

Alexandros Marinos

Founder & CEO, Resin.io

+1 206-637-5498

@alexandrosm

On Wed, Nov 22, 2017 at 9:55 AM, Lucian Buzzo notifications@github.com wrote:

What is the import copy key? I'm don't quite follow the last point in the instructions If for example your markdown looks like this:

Entry title

Lorem ipsum dolor sit amet

Subheader

Duis eu metus maximus, malesuada ex sed, volutpat neque.

We need somewhere to store the text immediately after the h2 tag but before the first h3 tag.

I'd love to have the option to make changes to the imported markdown in a similar fashion. That is, by editing the entries MD directly. If it makes sense to you, I can open an issue.

You get access to the markdown stored in fields by editing an entry, is that not so?

Probably irrelevant to this PR, I'm not sure why I cannot get nested points working consistently in MD text boxes (see example 1 and example 2)

  • I should probably open a separate issue for this as well I experimented with this and found that the showdown module we're using for markdown requires you to use 4 spaces, if this is inconsistend with GitHub's approach we should probably adjust this

— You are receiving this because your review was requested. Reply to this email directly, view it on GitHub https://github.com/resin-io/pensieve/pull/202#issuecomment-346427692, or mute the thread https://github.com/notifications/unsubscribe-auth/ABLUCGYYrqKuq9wHpUznZSsPKLpVFeDGks5s5GAHgaJpZM4Qnpuk .

lekkas commented 6 years ago

We need somewhere to store the text immediately after the h2 tag but before the first h3 tag.

Makes sense

You get access to the markdown stored in fields by editing an entry, is that not so?

Yes, I'm aware of that option, markdown -> pensieve path would be a nice to have and not a blocker. As @alexandrosm notes this introduces some non trivial considerations however, so I agree that it doesn't worth exploring for now and fields are fine.

On tabs, I think that github nested md works with even two spaces, like

LucianBuzzo commented 6 years ago

@lekkas Issue here https://github.com/resin-io/pensieve/issues/205