diff --git a/requirements.txt b/requirements.txt index 7668191..073748c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1,2 @@ -# frappe -- https://github.com/frappe/frappe is installed via 'bench init' \ No newline at end of file +frappe +markdownify diff --git a/u_utils/__init__.py b/u_utils/__init__.py index 7a0660b..b8023d8 100644 --- a/u_utils/__init__.py +++ b/u_utils/__init__.py @@ -1,3 +1 @@ - __version__ = '0.0.1' - diff --git a/u_utils/hooks.py b/u_utils/hooks.py index 1356c86..ba7c589 100644 --- a/u_utils/hooks.py +++ b/u_utils/hooks.py @@ -151,26 +151,26 @@ app_license = "GPLv3" # User Data Protection # -------------------- -user_data_fields = [ - { - "doctype": "{doctype_1}", - "filter_by": "{filter_by}", - "redact_fields": ["{field_1}", "{field_2}"], - "partial": 1, - }, - { - "doctype": "{doctype_2}", - "filter_by": "{filter_by}", - "partial": 1, - }, - { - "doctype": "{doctype_3}", - "strict": False, - }, - { - "doctype": "{doctype_4}" - } -] +# user_data_fields = [ +# { +# "doctype": "{doctype_1}", +# "filter_by": "{filter_by}", +# "redact_fields": ["{field_1}", "{field_2}"], +# "partial": 1, +# }, +# { +# "doctype": "{doctype_2}", +# "filter_by": "{filter_by}", +# "partial": 1, +# }, +# { +# "doctype": "{doctype_3}", +# "strict": False, +# }, +# { +# "doctype": "{doctype_4}" +# } +# ] # Authentication and authorization # -------------------------------- @@ -186,3 +186,9 @@ user_data_fields = [ # Recommended only for DocTypes which have limited documents with untranslated names # For example: Role, Gender, etc. # translated_search_doctypes = [] + +jenv = { + "methods": [ + "html_to_markdown:u_utils.utils.html_to_markdown" + ] +} diff --git a/u_utils/utils.py b/u_utils/utils.py new file mode 100644 index 0000000..1e37d35 --- /dev/null +++ b/u_utils/utils.py @@ -0,0 +1,6 @@ +import frappe +import markdownify + +@frappe.whitelist() +def html_to_markdown(html_content): + return markdownify.markdownify(html_content, heading_style="ATX")