Markdown Export Format
Closed this issue · 17 comments
First i want to applaud the development of this tool, it is very much appreciated and extremely useful already.
Would you consider the custom formatting of the markdown export? Maybe clues could be taken from the Obsidian KoReader Highlights plugin, which ceased development a few years back. For example Obsidian doesn't handle "nbsp;" very well and it would be lovely to adapt the display of highlights to ones own needs. For now it is definitely already helpful to omit certain aspects like the date or chapter.
I have to think about this..
It will take awhile, since I won't be close to my PC for a couple of weeks.
When I do, I'll write back.
FYI - this can be relevant as well: (koreader/koreader#12480). I agree with pad-mac that Kohighlights is already a very useful tool. Moreover, it has a great potential to become a true annotation manager!
@edo-jan The chapter value in KOHighlights is populated from the "chapter" key, so, you'll get whatever is there..
@edo-jan The chapter value in KOHighlights is populated from the "chapter" key, so, you'll get whatever is there..
Yes, with the user patch installed, KH correctly displays the multilevel TOC entries like: "Heading L1 ▸ Heading L2 ▸ Heading L3"
In the context of the proposed improvements for markdown export: it would be awesome if the exported TOC levels were mapped to markdown headers in Obsidian. It appears that the TOC levels could be differentiated via "▸" unique character which is implemented as a divider in the user patch .
This would produce a neat hierarchical structure with collapsible TOC levels like this:
# Book Title
## TOC L1 (e.g. Part 1)
### TOC L2
###### note header for comments
###### note header for comment
### TOC L2
###### note header for comments
###### note header for comments
#### TOC L3
###### note header for comments
###### note header for comments
###### note header for comments
##### TOC L4
###### note header for comments
###### TOC L5 ▸TOC L6 ▸TOC L7, etc.
###### note header for comments
## TOC L1 (e.g. Part 2)
###### note header for comments
### TOC L2
etc.
For context,
uroybd commented last week
Olay. I'm proposing this:
Heading 1 is reserved for Book title.
Heading 6 is for an individual note's header.
We will go down gradually from Heading 2 to Heading 5. This will give us the ability to use 4 levels of depth which is okay for most books. For levels further below, we will use the format shown in the example above for the rest of the levels in Heading 5.
Does this sound reasonable?
While the excerpt above pertains to Koreader's own markdown export enhacement, it makes sense to implement this in KH as well since KH has its own markdown export capabilities. Moreover, KH already has the ability to turn on or off inclusion of page / date /etc into the export.
I'm thinking to implement this in a way that the user can do whatever it likes.
My main problem at the moment is that there are three different types of exports.
- All the highlights from different books in different files
- All the highlights from different books in a single file
- Some highlights from some of the books in a single file
This makes any attempt really complicated, since if I do custom markdown export, I'll do the same for the html/txt exports too.
Without looking at the code I can't be sure that is even possible..
We'll see 😉
I'm thinking to implement this in a way that the user can do whatever it likes. My main problem at the moment is that there are three different types of exports.
- All the highlights from different books in different files
- All the highlights from different books in a single file
- Some highlights from some of the books in a single file
I have been thinking about this as well.
I think what uroybd was suggesting Issue 12480 should also work for the above. That is to reserve H1 for the book name and H6 for the individual note header
I think what uroybd was suggesting Issue 12480 should also work for the above.
I believe that the plugin exports the Title and Author with every highlight.
This is not the case here.
- The 1st mode has a header with the title and author, and after this, only the highlights data
- The 2nd mode writes multiple groups that start with the Title and Author, followed by the highlights data only
- The 3rd mode has Title and Author included with every highlight (like the plugin)
Also, since I don't use a template for exports, the process is complicated, depending on the inclusion (or not) of the specific elements of the highlight.
Don't worry, I'll find something..
The new template works but I can't see any real difference in the outcome. What am I missing? The output has the same repeating chapter names (above each and every highlight). Of course it can be removed, and then it won't appear at all - so it is either all or nothing. With the new template feature is it going to be possible to map the hierarchical TOC levels Heading L1 ▸ Heading L2 ▸ Heading L3
to obsidian ##, ###, #### respectively without repetitions?
The new template works but I can't see any real difference in the outcome. What am I missing? The output has the same repeating chapter names (above each and every highlight). Of course it can be removed, and then it won't appear at all - so it is either all or nothing.
You must be more specific, because I don't know what you're doing or what is not happening.
With the new template feature is it going to be possible to map the hierarchical TOC levels
Heading L1 ▸ Heading L2 ▸ Heading L3
to obsidian ##, ###, #### respectively without repetitions?
I can't think of a way to do this currently.
Added in 2.2.0.0
I exported in md using v. 2.2.0 but see no difference from before. Same flat structure of TOC. Similar results when using the markdown export directly and when the "Custom Markdown" is selected from the preferences. Here is a screenshot from Obsidian without using "Custom Markdown":
And the following is whe "Custom Markdown" option is selected:
You said something similar about a week ago, but when I asked for clarifications you didn't respond.
Until today that a created a new release.. 😩
Similar results when using the markdown export directly and when the "Custom Markdown" is selected from the preferences.
The default custom settings are using a template that is as close as possible to the system I use internally.
This is a starting point.
You can customize it further (that's the point of the custom template after all)
The
character is a non-breaking space that it shouldn't be visible in the markdown reader.
This is a problem/setting of the reader you are using.
The "Page 78 []" issue I have to investigate..
You said something similar about a week ago, but when I asked for clarifications you didn't respond. Until today that a created a new release.. 😩
Sorry, for being unclear.
You must be more specific, because I don't know what you're doing or what is not happening.
I simply meant that I could not see how to use the new custom template to achieve the desired outcome (TOC levels mapped to Headings hierarchically. I was lamenting the lack of hierarchical TOC mapping in the md output.
Similar results when using the markdown export directly and when the "Custom Markdown" is selected from the preferences.
The default custom settings are using a template that is as close as possible to the system I use internally. This is a starting point. You can customize it further (that's the point of the custom template after all)
understood. thank you!
The
character is a non-breaking space that it shouldn't be visible in the markdown reader. This is a problem/setting of the reader you are using.
you are correct! I was in Obsidian's "edit" view 🫣
The "Page 78 []" issue I have to investigate..
Do you think the he hierarchical TOC levels could be implemented using the new template feature or would require a separate solution?
Do you think the he hierarchical TOC levels could be implemented using the new template feature or would require a separate solution?
As I already mentioned, it can't be implemented currently.
What can be customized, is the way a single highlight is formatted.
There is a loop that takes every highlight from a book, formats it, and add it to the text.
This is happening sequentially.
What you want to do is take all the formatted highlights and create a custom page.
This is not doable at this time.
The "Page 78 []" issue
This template
does not producing this output
You must upload the problematic output with the corresponding Custom template.
Do you think the he hierarchical TOC levels could be implemented using the new template feature or would require a separate solution?
As I already mentioned, it can't be implemented currently. What can be customized, is the way a single highlight is formatted. There is a loop that takes every highlight from a book, formats it, and add it to the text. This is happening sequentially. What you want to do is take all the formatted highlights and create a custom page. This is not doable at this time.
The "Page 78 []" issue
This template
[image]
does not producing this output
[image]
Unfortunately, it does. I know it is not supposed to (e.g. the template suggests that page is supposed to be under the chapter, not above as shown in the output).
You must upload the problematic output with the corresponding Custom template.
I attached the markdown file, but not sure how to attach the template - but it looks exactly as in the screenshot.
Wayne Grudem - Systematic Theology, Second Edition.md
Unfortunately, it does. I know it is not supposed to (e.g. the template suggests that page is supposed to be under the chapter, not above as shown in the output).
You're right. Totally missed something.. 🤦♂️
Should be fixed in v2.2.1.1