Code Monkey home page Code Monkey logo

Comments (12)

dwrolvink avatar dwrolvink commented on May 24, 2024

Hmm yes, that could work, provided process_all: True. Because the tags are currently only discovered during the processing of a file.

To change that, (so to have it also work for process_all: False) we'd first need to build a tagtree, then find all the notes with the configured tag, build an index.md, set that as the entrypoint, and then run as normal.

Sounds like this could be something that is run entirely separately from the current flow, like a function that checks if such a tag exists, then runs the normal flow with an extra argument to denote it should only build the tagtree. Then builds the index and then updates the config vars, after which the normal flow will kick off like nothing happened.

This is kind of the reason I opted initially to just create a note with links to everything that I wanted to include, and just iterate over that note, way simpler. But I guess the introduction of process_all opened the door to this feature. I can imagine how it would be comfy to just add a tag to a note that you have currently opened and have it be included in the homepage.

Though I expect the feature request of ordering the resulting index.md on alphabetical order / date tags / etc 😵‍💫 Complexity begs more complexity

from obsidian-html.

dwrolvink avatar dwrolvink commented on May 24, 2024

working on this

from obsidian-html.

dwrolvink avatar dwrolvink commented on May 24, 2024

@jcolson see the commit in my fork, if you want you can try if this works for you.

It needs these config settings to work:

toggles:
  process_all: True

  features:
    # Create an index.md with links to notes that have one of the given tags.
    # This index.md will serve as the entrypoint
    # !! Enabling this feature will overwrite obsidian_entrypoint_path_str and md_entrypoint_path_str
    # !  Will only work for process_all: True at the moment.
    create_index_from_tags:
      enabled: True
      tags:
        - tag1
        - tag2     

Optional:

toggles:
  features:
    create_index_from_tags:
      add_links_in_graph_tree: True # The index.md will be created, and thus will be without links, this setting will create links to the notes that are matched.    

I want this to be better tested before committing to master.
I'll continue next weekend probably, so you might find it useful in the mean time.

from obsidian-html.

dwrolvink avatar dwrolvink commented on May 24, 2024

Update:
It should now also work for toggles/process_all: False

In that case, each found note is treated as its own entrypoint. So only the matched notes will be included + everything that those (in)directly link to.

from obsidian-html.

jcolson avatar jcolson commented on May 24, 2024

very cool work! it looks like the links created in the index.html are linking to the md pages, instead of html:

[2022-02-07 12:21:42] ERROR `/output/html/TTRPG/DragonHeart/Dec-15,-2021-18-31-57-GMT Session.md' not found.
[2022-02-07 12:21:50] ERROR `/output/html/TTRPG/DragonHeart/Jan 12, 2022 Session 1.md' not found.
[2022-02-07 12:21:54] ERROR `/output/html/TTRPG/DragonHeart/Jan 15, 2022 Downtime Session.md' not found.
[2022-02-07 12:21:55] ERROR `/output/html/TTRPG/DragonHeart/Session - Jan 24, 2022.md' not found.
<li><a href="/output/html/TTRPG/DragonHeart/Dec-15,-2021-18-31-57-GMT Session.md">Dec-15,-2021-18-31-57-GMT Session</a></li>
<li><a href="/output/html/TTRPG/DragonHeart/Jan 12, 2022 Session 1.md">Jan 12, 2022 Session 1</a></li>
<li><a href="/output/html/TTRPG/DragonHeart/Jan 15, 2022 Downtime Session.md">Jan 15, 2022 Downtime Session</a></li>
<li><a href="/output/html/TTRPG/DragonHeart/Session - Jan 24, 2022.md">Session - Jan 24, 2022</a></li>

from obsidian-html.

jcolson avatar jcolson commented on May 24, 2024

and, also looks as though no other html is being created beyond these:

drwxr-xr-x   - jcolson staff  7 Feb 12:35 -M 98682199-5ac9-448c-afc8-23ab7359a91b-static
.rw-r--r-- 22k jcolson staff  7 Feb 12:35 -M index.html
.rw-r--r-- 16k jcolson staff  7 Feb 12:35 -- not_created.html
drwxr-xr-x   - jcolson staff  7 Feb 12:35 -M tags

output/html/98682199-5ac9-448c-afc8-23ab7359a91b-static:
.rw-r--r--  534 jcolson staff  7 Feb 12:35 -- external.svg
.rw-r--r--  418 jcolson staff  7 Feb 12:35 -- graph.css
.rw-r--r--  875 jcolson staff  7 Feb 12:35 -M graph.json
.rw-r--r-- 9.0k jcolson staff  7 Feb 12:35 -M main.css
.rw-r--r-- 5.3k jcolson staff  7 Feb 12:35 -- mermaid.css
.rw-r--r-- 1.1M jcolson staff  7 Feb 12:35 -- mermaid.min.js
.rw-r--r-- 193k jcolson staff  7 Feb 12:35 -- SourceCodePro-Regular.ttf
.rw-r--r--   36 jcolson staff  7 Feb 12:35 -- taglist.css

output/html/tags:
.rw-r--r-- 16k jcolson staff  7 Feb 12:35 -M index.html

from obsidian-html.

jcolson avatar jcolson commented on May 24, 2024

this definitely has something to do with html_url_prefix ...

            if ('/'+link.rel_src_path_posix).split(config["html_url_prefix"]+'/',1)[1] not in files.keys():
                continue

allows it to pass this section .... without the removal of the html_url_prefix, there are no matches with keys

it now replaces the .md with .html, but doesn't complete the rest of the pages

from obsidian-html.

dwrolvink avatar dwrolvink commented on May 24, 2024

Hmm I had no issues with this, can you share your config yaml? Perhaps there are some settings not set correctly.

from obsidian-html.

dwrolvink avatar dwrolvink commented on May 24, 2024

nvm, I didn't test for the html prefix. I can recreate the error. Will look into it.

Gonna work on unit testing soon, should automate a lot of these cases, as the number of combinations of settings is starting to explode.

from obsidian-html.

jcolson avatar jcolson commented on May 24, 2024

found the issue. regex needs to exclude the prefix .. i hard coded this and it worked for my prefix (/output/html)

    proper_links = re.findall(".*\]\(\/output\/html\/?(.*)\)", md.page)

from obsidian-html.

dwrolvink avatar dwrolvink commented on May 24, 2024

found the issue. regex needs to exclude the prefix .. i hard coded this and it worked for my prefix (/output/html)

    proper_links = re.findall(".*\]\(\/output\/html\/?(.*)\)", md.page)

That is one solution, though I think the error was that I added the html prefix at all in the markdown step already, see my latest commit, I removed adding it and now it works in both cases (with/without prefix).

I only needed to add the prefix in the node/link building step.

from obsidian-html.

jcolson avatar jcolson commented on May 24, 2024

yes - just found that ;-)

from obsidian-html.

Related Issues (20)

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.