GitHub Action
commited on
Commit
·
16c2760
1
Parent(s):
8a2c1f6
Sync from GitHub with Git LFS
Browse files
scripts/publish_to_blogger.py
CHANGED
@@ -6,7 +6,8 @@ import re
|
|
6 |
import argparse
|
7 |
from pathlib import Path
|
8 |
|
9 |
-
import
|
|
|
10 |
from googleapiclient.discovery import build
|
11 |
from googleapiclient.errors import HttpError
|
12 |
from google.auth.transport.requests import Request
|
@@ -83,7 +84,22 @@ def main(force: bool = False):
|
|
83 |
md_text = source_link + md_text
|
84 |
|
85 |
md_text = convert_md_links(md_text)
|
86 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
|
88 |
body = {
|
89 |
"kind": "blogger#post",
|
|
|
6 |
import argparse
|
7 |
from pathlib import Path
|
8 |
|
9 |
+
import markdown
|
10 |
+
from markdown.extensions import tables, fenced_code, codehilite, toc
|
11 |
from googleapiclient.discovery import build
|
12 |
from googleapiclient.errors import HttpError
|
13 |
from google.auth.transport.requests import Request
|
|
|
84 |
md_text = source_link + md_text
|
85 |
|
86 |
md_text = convert_md_links(md_text)
|
87 |
+
|
88 |
+
# Конвертация Markdown в HTML с расширениями
|
89 |
+
html_content = markdown.markdown(
|
90 |
+
md_text,
|
91 |
+
extensions=["tables", "fenced_code", "codehilite", "toc"]
|
92 |
+
)
|
93 |
+
|
94 |
+
# Добавляем CSS для корректного отображения таблиц и блок-схем
|
95 |
+
style = """
|
96 |
+
<style>
|
97 |
+
table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; }
|
98 |
+
th, td { border: 1px solid #ccc; padding: 6px 12px; }
|
99 |
+
pre { display: block; max-width: 100%; overflow-x: auto; padding: 10px; background-color: #f8f8f8; border: 1px solid #ddd; border-radius: 6px; font-family: monospace; white-space: pre; }
|
100 |
+
</style>
|
101 |
+
"""
|
102 |
+
html_content = style + html_content
|
103 |
|
104 |
body = {
|
105 |
"kind": "blogger#post",
|