Moved convert_markdown_template to formatters

This commit is contained in:
Anastasia Gradova
2023-12-22 10:03:43 -07:00
parent 86af8fcaa4
commit 0989246334
2 changed files with 19 additions and 21 deletions

View File

@@ -4,37 +4,19 @@ from flask import (
make_response,
redirect,
render_template,
render_template_string,
request,
url_for
)
from flask_login import current_user
from flask.helpers import get_root_path
from notifications_utils.template import HTMLEmailTemplate
import markdown
import os
from app import email_branding_client, status_api_client
from app.main import main
from app.main.forms import FieldWithNoneOption
from app.main.views.pricing import CURRENT_SMS_RATE
from app.main.views.sub_navigation_dictionaries import features_nav, using_notify_nav
from app.utils.user import user_is_logged_in
#Should find a better home
def get_md(mdf):
APP_ROOT = get_root_path('notifications-admin')
file = 'app/content/' + mdf + '.md'
md_file = os.path.join(APP_ROOT, file)
with open(md_file) as f:
content_text = f.read()
md_render = markdown.markdown(content_text)
jn_render = render_template_string(md_render)
return jn_render
from app.formatters import convert_markdown_template
@main.route("/")
def index():
@@ -274,7 +256,8 @@ def get_started_old():
def get_started():
return render_template(
"views/get-started.html",
navigation_links=using_notify_nav(), content=get_md('get-started')
navigation_links=using_notify_nav(),
content=convert_markdown_template('get-started')
)