Release v0.1.2
This commit is contained in:
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on Keep a Changelog, and the project uses Semantic Versioning.
|
||||
|
||||
## [0.1.2] - 2026-04-18
|
||||
|
||||
### Added
|
||||
|
||||
- Streamlit UI now supports converting Markdown pasted from the clipboard in addition to uploaded `.md` files.
|
||||
|
||||
## [0.1.1] - 2026-04-17
|
||||
|
||||
### Fixed
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
Сервис конвертации Markdown в самодостаточный HTML (через GitHub API).
|
||||
|
||||
Текущая версия: `0.1.1`
|
||||
Текущая версия: `0.1.2`
|
||||
|
||||
Часто нужен адекватно (минималистично) выглядящий HTML из Markdown. HTML получем через открытый API GitHub, а стили просто захардкожены в шаблоне.
|
||||
|
||||
@@ -13,7 +13,7 @@ GITHUB_TOKEN не нужен, если не требуется массовая
|
||||
Есть два интерфейса:
|
||||
|
||||
- FastAPI на `http://localhost:8000`
|
||||
- Streamlit UI на `http://localhost:8501`
|
||||
- Streamlit UI на `http://localhost:8501` с двумя режимами ввода: загрузка `.md` файла или вставка Markdown-текста из буфера обмена
|
||||
|
||||
## Локальный запуск
|
||||
|
||||
@@ -68,14 +68,14 @@ curl http://localhost:8000/version
|
||||
|
||||
```bash
|
||||
git add VERSION CHANGELOG.md
|
||||
git commit -m "Release v0.1.1"
|
||||
git tag v0.1.1
|
||||
git commit -m "Release v0.1.2"
|
||||
git tag v0.1.2
|
||||
git push origin main --tags
|
||||
gh release create v0.1.1 --notes-file CHANGELOG.md
|
||||
gh release create v0.1.2 --notes-file CHANGELOG.md
|
||||
```
|
||||
|
||||
После публикации релиза GitHub Actions автоматически собирает Docker-образ и публикует его в GitHub Container Registry:
|
||||
|
||||
```bash
|
||||
docker pull ghcr.io/fserg/md-to-html:v0.1.1
|
||||
docker pull ghcr.io/fserg/md-to-html:v0.1.2
|
||||
```
|
||||
|
||||
+33
-7
@@ -149,15 +149,34 @@ if "preview_url" not in st.session_state:
|
||||
|
||||
st.title("Markdown → HTML")
|
||||
st.caption(
|
||||
f"Версия {__version__}. Загрузите markdown-файл, проверьте превью и скачайте готовый HTML."
|
||||
f"Версия {__version__}. Загрузите markdown-файл или вставьте текст, проверьте превью и скачайте готовый HTML."
|
||||
)
|
||||
|
||||
uploaded_file = st.file_uploader(
|
||||
input_mode = st.segmented_control(
|
||||
"Источник Markdown",
|
||||
options=["Файл", "Текст"],
|
||||
default="Файл",
|
||||
)
|
||||
|
||||
uploaded_file = None
|
||||
pasted_markdown = ""
|
||||
|
||||
if input_mode == "Файл":
|
||||
uploaded_file = st.file_uploader(
|
||||
"Загрузите .md файл",
|
||||
type=["md", "markdown"],
|
||||
)
|
||||
)
|
||||
else:
|
||||
pasted_markdown = st.text_area(
|
||||
"Вставьте Markdown из буфера обмена",
|
||||
placeholder="# Заголовок\n\nВставьте сюда markdown-текст.",
|
||||
height=260,
|
||||
)
|
||||
|
||||
html_result = st.session_state["html_result"]
|
||||
is_convert_disabled = (
|
||||
uploaded_file is None if input_mode == "Файл" else not pasted_markdown.strip()
|
||||
)
|
||||
|
||||
with st.container(border=True):
|
||||
action_col, preview_col, download_col = st.columns(
|
||||
@@ -168,7 +187,7 @@ with st.container(border=True):
|
||||
with action_col:
|
||||
convert_clicked = st.button(
|
||||
"Конвертировать",
|
||||
disabled=uploaded_file is None,
|
||||
disabled=is_convert_disabled,
|
||||
type="primary",
|
||||
icon=":material/auto_awesome:",
|
||||
use_container_width=True,
|
||||
@@ -213,14 +232,21 @@ with st.container(border=True):
|
||||
else:
|
||||
st.caption("После конвертации здесь появятся действия с готовым файлом.")
|
||||
|
||||
if convert_clicked and uploaded_file is not None:
|
||||
if convert_clicked and not is_convert_disabled:
|
||||
if input_mode == "Файл":
|
||||
markdown_bytes = uploaded_file.getvalue()
|
||||
markdown_text = markdown_bytes.decode("utf-8")
|
||||
output_name = f"{Path(uploaded_file.name).stem}.html"
|
||||
fallback_title = Path(uploaded_file.name).stem or "Document"
|
||||
output_name = f"{fallback_title}.html"
|
||||
else:
|
||||
markdown_text = pasted_markdown
|
||||
fallback_title = "Document"
|
||||
output_name = "document.html"
|
||||
|
||||
try:
|
||||
st.session_state["html_result"] = convert(
|
||||
markdown_text,
|
||||
fallback_title=Path(uploaded_file.name).stem or "Document",
|
||||
fallback_title=fallback_title,
|
||||
)
|
||||
st.session_state["output_name"] = output_name
|
||||
st.session_state["preview_url"] = register_preview(st.session_state["html_result"])
|
||||
|
||||
Reference in New Issue
Block a user