From 6379b673fc23fbfd2768cbb492b25a34213b6a89 Mon Sep 17 00:00:00 2001 From: Christian Morpurgo Date: Thu, 24 Apr 2025 16:40:24 +0200 Subject: [PATCH] fix imports --- MarkdownLivePreview.py | 8 ++++++-- markdown2html.py | 11 +---------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/MarkdownLivePreview.py b/MarkdownLivePreview.py index 5d41c62..d1eb57c 100644 --- a/MarkdownLivePreview.py +++ b/MarkdownLivePreview.py @@ -1,3 +1,9 @@ +import os, sys, sublime +pkg = os.path.basename(os.path.dirname(__file__)) +lib = os.path.join(sublime.packages_path(), pkg, "lib") +if lib not in sys.path: + sys.path.insert(0, lib) + """ Terminology original_view: the view in the regular editor, without it's own window @@ -8,9 +14,7 @@ preview_window: the window with the markdown file and the preview """ import time -import os.path import struct -import sublime import sublime_plugin from functools import partial diff --git a/markdown2html.py b/markdown2html.py index 9b2efdd..f577434 100644 --- a/markdown2html.py +++ b/markdown2html.py @@ -1,12 +1,3 @@ -import sys -import os - -# Add the 'lib' directory to the Python path BEFORE any other imports -# This ensures bundled libraries are used -lib_path = os.path.join(os.path.dirname(__file__), 'lib') -if lib_path not in sys.path: - sys.path.insert(0, lib_path) - """ Notice how this file is completely independent of sublime text I think it should be kept this way, just because it gives a bit more organisation, @@ -24,7 +15,7 @@ import bs4 from functools import partial -from .lib.markdown2 import Markdown +from markdown2 import Markdown __all__ = ("markdown2html",)