Develop Obsidian plugins in Python! 🐍 Interact with your notes, retrieve frontmatter, send notifications, and much more – all through simple Python scripts. Cut the complexity of writing JavaScript plugins and dive into creating your Obsidian workflows with Python!
MIT License
42
stars
1
forks
source link
Bug: regex functionality in user inputs doesn't work at all (no error but doesn't work at all) #9
import sys
import os
# -----------------------------------------
# Set up library path and import module
# -----------------------------------------
# Use the absolute path to the library
library_path = "/home/me/Document/Obsidian/MyVault/.obsidian/plugins/obsidian-python-bridge/" # My full path to ObsidianPluginDevPythonToJS.py
sys.path.append(library_path)
# Import the Python-Obsidian bridge module
from ObsidianPluginDevPythonToJS import ObsidianPluginDevPythonToJS
# -----------------------------------------
# Initialize the class with socket path
# -----------------------------------------
# Define the path to the Unix socket for communication with Obsidian
socket_path = "/tmp/obsidian-python.sock"
# Create an instance of the ObsidianPluginDevPythonToJS class
obsidian = ObsidianPluginDevPythonToJS(socket_path=socket_path)
# -----------------------------------------
# Request and handle user input (text)
# -----------------------------------------
# Request text input from the user
response = obsidian.request_user_input(
script_name="Text Input",
input_type="text",
validation_regex="^[A-Za-z]+ [A-Za-z]+$", # This regex allows strings that consist of one or more uppercase or lowercase letters,
# followed by a single space, and then one or more uppercase or lowercase letters.
# Example of a valid string: "Tom Peter"
message="Please enter your name:"
)
# Send a notification with the user's input
obsidian.send_notification(content=f"The first name is: {response['userInput']}")
What's supposed to happen: I can't submit my input, because it doesn't respect the regex indicated.
My opinion: it's not implemented or poorly implemented. A dev could do this very easily, so I'm asking for help please 🙏
It's all in the title. Here's an example:
What's supposed to happen: I can't submit my input, because it doesn't respect the regex indicated.
My opinion: it's not implemented or poorly implemented. A dev could do this very easily, so I'm asking for help please 🙏