python - Telegraph API 中的格式化列表
问题描述
在一个系统上工作,包括通过 python 在 Telegraph 上发布文章。一般来说,一切正常。但最近我发现 <ol> 和 <ul> 标签在不同浏览器中的奇怪行为。在 Telegraph 的移动版本上,它按预期工作,而在其他任何地方都没有。除了对行数进行硬编码外,还有其他解决方案吗?您可以在此处自行查看https://telegra.ph/Arthur-Conan-Doyle-Estudio-en-Escarlata-1-09-06(自 2021 年 10 月 5 日起生效)。我正在使用的代码如下:
def update_page(path, title, content, author):
response = telegraph.edit_page(path, html_content = content, title = title,
author_name = author, return_content=True)
current_path = 'http://telegra.ph/{}'.format(path)
return current_path
html = '''
<ol>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
<ul>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
'''
title = 'Testing lists'
update_page(test_path, title, html, AUTHOR)
行为示例: 我需要的行为,Telegraph 的移动版本,这是 我在 Chrome、Firefox 和 Safari 中得到的
解决方案
尝试将列表项写在一行中,例如 <li>1</li><li>2</li><li>3</li>。这为我解决了。
推荐阅读
- encryption - 在我的 MFC 应用程序中使用 crypto++ lib 时出现链接错误
- java - 转换时在正确位置找不到 XML 文件
- html - Html 选择元素选项禁用 microsoft edge
- c++ - 动态分配
- go - 如何读取带有颜色属性的命令输出?
- angular - 订阅 observable 后对象发生变化
- ansible - Playbook 中的 Ansible 变量位于何处
- c# - 如何在 blob 容器 c# 中使用 azure search 在最新文件中搜索匹配数据
- ios - 如果将代码共享给其他系统,我是否需要在代码中安装 alamofire
- r - R中的数据框子集