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

[feature request]new Option:Show The First Line of a Heading #8

Closed
cloudrflight opened this issue Jan 12, 2022 · 7 comments
Closed

Comments

@cloudrflight
Copy link

Have a look at this ex. below:

- # A Heading
version:: A
type:: book
price:: ff
some describe of A heading
  - ## B heading
  - ## C heading

use tocgen plugin code ' {{renderer :tocgen , [[my page]],6,h }}',become to this:

↓A Heading version:: A
type:: book
price:: ff
some describe of A heading
   ↓B heading
   ↓C heading

actually,I want to show that like this:

↓A Heading version:: A
   ↓B heading
   ↓C heading

So,I'd like to request to show only'the first line'

@sethyuan
Copy link
Owner

Are you using the latest version of the plugin? Currently, block properties are removed from the content, so, the latest plugin would show something like this:

image

It's not quite what you want, but I don't think block properties should be displayed in title, what I can do, is to only use the first line of content (without block property) as title. What do you think?

@sethyuan
Copy link
Owner

I built a new version with this behavior. That is, only use the first line as title.

@cloudrflight
Copy link
Author

I built a new version with this behavior. That is, only use the first line as title.

That's exactly what I need(v1.6.0) , Thx a lot!

By the way,I'm coming to a new problem,My note use datomic like

@cloudrflight
Copy link
Author

I use a lot datomic advance queries to organize my page view like (get all feathers in last 10 day)

↓A Heading
#+BEGIN_QUERY
{
	:query
	[
		:find(pull	?b [ *])		
     :where
			[?b :block/page ?p]
			[?p :block/properties ?prop]
			[(get ?prop :type) ?v]
			(or [(= ?v "feather")] [(contains? ?v "feather")])
			[(get ?prop :created-at) ?ti]
			[(>= ?ti 20220101)]
			[(<= ?ti 20220112)]
    ]
   
 }
#+END_QUERY
↓B heading
↓C heading

Preview like:

↓A Heading
    ↓D Heading
↓B heading
↓C heading

Could I request a new feature for showing the heading in the queries?

@sethyuan
Copy link
Owner

Can you elaborate? You want the query result be part of the TOC?

@cloudrflight
Copy link
Author

Can you elaborate? You want the query result be part of the TOC?

Yes,I want to build outline of "my page" , "my page" made by a queries of many pages ,not a single [[page]];

for ex:

title:: my page
- A Heading
#+BEGIN_QUERY
{
	:query
	[
		:find(pull	?b [ *])		
     :where
			[?b :block/page ?p]
			[?p :block/properties ?prop]
			[(get ?prop :type) ?v]
			(or [(= ?v "feather")] [(contains? ?v "feather")])
			[(get ?prop :created-at) ?ti]
			[(>= ?ti 20220101)]
			[(<= ?ti 20220112)]
    ]
 }
#+END_QUERY
- B Heading
- C Heading

and preview is:

- # A Heading
2 results
Table view   |    Set properties
    - ## Book 'herrypotter'
    blablabla..........
    - ## Book 'King of Lord'
    blablabla.........
- # B Heading
- # C Heading

I want toc to show:

↓A Heading
    ↓Book 'herrypotter'
    ↓Book 'King of Lord'
↓B Heading
↓C Heading

@sethyuan
Copy link
Owner

Interesting, I'm not sure if this is appropriate to do though. I think it's better to have another plugin to pull query results into the current page, then use tocgen to generate TOC as would normally do. Processing of query results shouldn't be part of a plugin like this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants