Skip to content

Commit

Permalink
add docstring and license notice to render module
Browse files Browse the repository at this point in the history
  • Loading branch information
hyperdriveguy committed Jul 30, 2024
1 parent 1d751f8 commit adcda5d
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion maeser/render.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
"""
Markdown response conversion module. Intended for use with LLM output.
This module provides a utility function to convert markdown responses to HTML
with additional processing, such as adding target="_blank" to anchor tags and
adjusting paths for images.
© 2024 Carson Bush, Blaine Freestone
This file is part of Maeser.
Maeser is free software: you can redistribute it and/or modify it under the terms of
the GNU Lesser General Public License as published by the Free Software Foundation,
either version 3 of the License, or (at your option) any later version.
Maeser is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with
Maeser. If not, see <https://www.gnu.org/licenses/>.
"""

import markdown

def get_response_html(response: str) -> str:
Expand All @@ -15,4 +38,4 @@ def get_response_html(response: str) -> str:
# Add target="_blank" attribute to anchor tags
html_content = html_content.replace('<a href', '<a target="_blank" href')
html_content = html_content.replace('figures/', '/figures/')
return html_content
return html_content

0 comments on commit adcda5d

Please sign in to comment.