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

Allow hiding query result header #359

Closed
Remich opened this issue Aug 24, 2020 · 10 comments
Closed

Allow hiding query result header #359

Remich opened this issue Aug 24, 2020 · 10 comments
Assignees
Labels
case-for-themes documentation Improvements or additions to documentation

Comments

@Remich
Copy link

Remich commented Aug 24, 2020

Hi,
when creating automatic links using queries, Neuron always displays the tags as some kind of headline.

It would be nice to have a option in the link (something like ?cf) to disable the displaying of the tags.

In my Zettels I often have a headline followed by some automatic links. It does not look very nice, if the tags act as a "second headline".

@srid srid added the discussion Forum like question asked; not exactly a feature or a bug. label Aug 24, 2020
@srid
Copy link
Owner

srid commented Aug 24, 2020

Tags are actually not displayed in the zettel query results (see here for example). What version of neuron are you using?

@Remich
Copy link
Author

Remich commented Aug 25, 2020

Sorry, I might have explained it wrong.

In your example there is an additional divider being inserted:
<div class="ui horizontal divider" title="Neuron ZettelQuery">All zettels</div>

If one would specify some tags in the automatic link, this divider would display those tags, defined in the automatic link.
It would be cool to have a option to disable said divider.

Your example also fits my description of the use case: There are somewhat two headlines: "Recently Created Zettels" and below "All Zettels".

@srid srid added case-for-themes and removed discussion Forum like question asked; not exactly a feature or a bug. labels Aug 25, 2020
@srid srid changed the title Add option to disable showing of tags when using "automatic links using queries". Add hiding the header above the results of automatic links Aug 26, 2020
@srid
Copy link
Owner

srid commented Aug 26, 2020

A better approach would be to allow the user to specify a custom .css file that gets used in addition to builtin css. And add a class to this divider div, which this custom.css can hide by setting display: none.

@Remich
Copy link
Author

Remich commented Aug 26, 2020

This approach would hide the divider div always.
But it should still be possible to display the divider div sometimes.

@srid
Copy link
Owner

srid commented Aug 27, 2020

I'm hesitant to add too specific a behaviour to the more general link query feature. Here's an alternative approach, one that is more general:

outdated idea
[[z:zettels?tag=foo&class=bare]]

i.e.; allow link queries to accept an argument for a custom CSS class (here we specify class=bare). Then wrap the resulting view in either a span or a div, with that class. Then you can specify a custom CSS using #362 to style that div/span however you want. To hide the header for the above query for example you would the write CSS like:

div.query-result.bare div.divider {
  display: none !important;
}

@srid
Copy link
Owner

srid commented Aug 27, 2020

Actually, wait. We can use the attributes extension from #176 to inject this class (no need to add class=bare):

For example, the following will add the classes "ui" "red" and "message" to a wrapping div:

:::{.ui .red .message}
[[z:zettels?tag=timeline/**&timeline]]
:::

image

Then, all we need to implement is #362.

@Remich
Copy link
Author

Remich commented Aug 27, 2020

Why would that be to specific and why are you hesistant to add that kind of option? You already implemented something like ?cf for regular links. It don't see much difference to have some kind of customization for auto-linking.

While your approach would work, it seems kind of overkill:

  1. It introduces a lot of unnecessary markup in the zettels, which impairs readability in the markdown file itself.
  2. With this approach we are adding markup, to remove/hide other markup. (This does not sound right).
  3. We have to rely on another technology (CSS) which should not be concerned with what gets rendered to the DOM.
  4. Users without CSS knowledge might run into problems.

@srid
Copy link
Owner

srid commented Aug 27, 2020

Don't complect UI configuration and data querying.

The link query syntax has one purpose -- to query zettels from the zettelkasten for establishing connections to. Piling it with UI features is just unnecessary complexity; I consider the existing ?timeline and ?showid to be a bad idea already, and I wouldn't want to make that situation worse.

Your point (3) and (4) can be addressed by providing the CSS classes as builtin (eg: .neuron-hideheader, .neuron-showdate), then users only need to use the commonmark attributes syntax to hide the various elements of the results view -- header, timeline dates or IDs.


Anyway, I'm not convinced with any of the proposed ideas so far. Commonmark attributes extension is Markdown-only, and it can't be used in org-mode.

Another option is to remove the header completely. However, one main reason to not do that a) it is actually useful to see which group of zettels are being listed below, especially when you use multiple queries (see here), b) showing the header in those situations where it makes sense to hide them (such as the 'Recent zettels' of my site) is not that big of a deal.

@srid srid changed the title Add hiding the header above the results of automatic links Allow hiding query result header Aug 27, 2020
@srid srid added the documentation Improvements or additions to documentation label Feb 23, 2021
@srid srid pinned this issue Feb 23, 2021
@srid srid self-assigned this Feb 23, 2021
@srid
Copy link
Owner

srid commented Feb 23, 2021

@Remich You can achieve this by putting the following in your head.html:

<style>
    /* Hide the query divider */
    .pandoc .tag-query-results .divider {
        display: none !important;
    }
</style> 

Demo: https://stream.srid.ca/

I'll close this issue, but with a reminder to document this "recipe" in #565

@srid srid closed this as completed Feb 23, 2021
@srid srid unpinned this issue Feb 23, 2021
@srid
Copy link
Owner

srid commented Feb 23, 2021

If you wanted to hide the divider from just a selected list queries, then I suggest filing a new issue. One way to address that is to have the queries take a class=foo argument, and then pass that as a CSS class in generated html (so you can hide it as shown above).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
case-for-themes documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants