summaryrefslogtreecommitdiff
path: root/kodereviewer/mdconverter.py
diff options
context:
space:
mode:
Diffstat (limited to 'kodereviewer/mdconverter.py')
-rw-r--r--kodereviewer/mdconverter.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/kodereviewer/mdconverter.py b/kodereviewer/mdconverter.py
new file mode 100644
index 0000000..1d0a653
--- /dev/null
+++ b/kodereviewer/mdconverter.py
@@ -0,0 +1,30 @@
+from markdown import markdown
+from PySide6.QtCore import QObject, Signal, Slot, Property
+from PySide6.QtQml import QmlElement
+
+QML_IMPORT_NAME = "org.deprecated.kodereviewer"
+QML_IMPORT_MAJOR_VERSION = 1
+
+
+@QmlElement
+class MdConverter(QObject):
+ """A simple markdown converter"""
+
+ sourceTextChanged = Signal()
+
+ def __init__(self, _source_text=""):
+ super().__init__()
+ self._source_text = _source_text
+
+ @Property(str, notify=sourceTextChanged)
+ def sourceText(self):
+ return self._source_text
+
+ @sourceText.setter
+ def sourceText(self, val: str):
+ self._source_text = val
+ self.sourceTextChanged.emit()
+
+ @Slot(result=str)
+ def mdFormat(self):
+ return markdown(self._source_text)