adham
Follow
#896 2023-11-25 20:22:46 Join
616
Home View
48m25s
Online time
  • Where is database table in SiYuan Android apps?

    2024-01-19 20:22

    Thank you for your work and efforts!❤️ @88250

  • Where is database table in SiYuan Android apps?

    2024-01-18 03:29

    This was supposed to be released to free users at the beginning of the this month, yet it hasn't.

    Can you tell us when it will? @88250

  • Is it possible for markdown export to link to other files?

    2023-12-02 03:01

    You're welcome! I actually was too lazy to write it myself so I asked ChatGPT to do it for me and changed some mistakes in its code.

    And I might as well do it for non-document blocks, I will post the solution here too.

    In any case, it seems like this problem can be solved easily and be integrated into SiYuan.
    I am not familiar with SiYuan code or Golang in general so someone else more familiar may make a Pull Request for this feature way faster than me.
    If not, I don't mind spending some time to learn enough to build this feature into SiYuan. It's the least I can do in return for getting this amazing app for free!
    Thanks @88250 @sagar and long live the open source!

  • Self-made template?

    2023-12-02 02:51

    Oh, I didn't notice I can do that, that's very easy. Thank you!

  • Self-made template?

    2023-12-01 21:56

    I assume I can just download the sample template from the marketplace and edit it locally, right?

  • Self-made template?

    2023-12-01 21:46

    Can I make and use a template locally without pushing it to the marketplace? @88250

  • Is it possible for markdown export to link to other files?

    2023-12-01 15:42

    Here's the before and after comparison.

    Before:

    
    # Networking
    
    The most important things to know are the networking protocols.
    
    
    * [TCP](siyuan://blocks/20231110002225-jzlfmvr)
    * [UDP](siyuan://blocks/20231111114912-9gi1l0p)
    * [HTTP](siyuan://blocks/20231110002250-b9w413n)
    * [TLS](siyuan://blocks/20231111114933-oti4rz4)
    * [WebSockets](siyuan://blocks/20231111115839-xw23n4k)
    * [WebRTC](siyuan://blocks/20231111114916-nevtkga)
    
    
    

    After:

    # Networking
    
    The most important things to know are the networking protocols.
    
    
    * [TCP](/Networking/TCP.md)
    * [UDP](/Networking/UDP.md)
    * [HTTP](/Networking/HTTP.md)
    * [TLS](/Networking/TLS.md)
    * [WebSockets](/Networking/WebSockets.md)
    * [WebRTC](/Networking/WebRTC.md)
    
    
    
  • Is it possible for markdown export to link to other files?

    2023-12-01 15:38

    Thanks @sagar for your helpful solution!

  • Is it possible for markdown export to link to other files?

    2023-12-01 15:20

    I was able to do it (for documents only, not blocks, as I don't know how to find out if the link is of a block or a document, and I don't want to mutate the linked documents anyway).

    Here's the Python script:

    import os
    import re
    import requests
    
    # Replace 'YOUR_API_ENDPOINT' with the actual Siyuan API endpoint
    SIYUAN_API_ENDPOINT = "http://localhost:6806"
    
    
    # Function to make a SQL query to Siyuan API
    def query_block_details(block_id):
        query = {"stmt": f"SELECT * FROM blocks WHERE id='{block_id}'"}
        response = requests.post(f"{SIYUAN_API_ENDPOINT}/api/query/sql", json=query)
        return response.json()
    
    
    # Function to process each markdown file
    def process_markdown_file(file_path):
        with open(file_path, "r", encoding="utf-8") as file:
            content = file.read()
    
            # Use regex to find instances of [Anchor text](siyuan://blocks/block-id)
            matches = re.findall(r"\[.*?\]\(siyuan://blocks/(.*?)\)", content)
    
            for block_id in matches:
                # Query Siyuan API to get block details
                result = query_block_details(block_id)
    
                # Assumes ref is of a document, not a block
                if result:
                    hpath_value = result["data"][0].get("hpath")
    
                    # Replace the siyuan://blocks/block-id with hpath_value.md
                    new_link = f"({hpath_value}.md)"
    
                    # Replace the old link in the content
                    content = content.replace(f"(siyuan://blocks/{block_id})", new_link)
    
        # Write the updated content back to the file
        with open(file_path, "w", encoding="utf-8") as file:
            file.write(content)
    
    
    def process_markdown_directory(directory_path):
        for root, _, files in os.walk(directory_path):
            for file_name in files:
                if file_name.endswith(".md"):
                    file_path = os.path.join(root, file_name)
                    process_markdown_file(file_path)
    
    
    # Replace 'YOUR_MARKDOWN_DIRECTORY_PATH' with the actual path to your exported markdown files
    markdown_directory_path = "YOUR_MARKDOWN_DIRECTORY_PATH"
    
    # Process each markdown file in the specified path
    process_markdown_directory(markdown_directory_path)
    
    
  • Is it possible for markdown export to link to other files?

    2023-12-01 13:44

    I actually thought about doing that yesterday, and woke up today and opened my laptop to write that solution, only to find @sagar had written it. Funny!:)

  • Is it possible for markdown export to link to other files?

    2023-12-01 05:37

    I agree with @sagar that this is a very important feature which may increase SiYuan's popularity, especially against Obsidian.