Compare commits
No commits in common. "main" and "main" have entirely different histories.
@ -1,29 +0,0 @@
|
|||||||
name: Publish to PyPI on main branch update
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build_and_publish:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Set up Python
|
|
||||||
uses: actions/setup-python@v4
|
|
||||||
with:
|
|
||||||
python-version: '3.11' # 指定你需要的Python版本
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: |
|
|
||||||
python -m pip install --upgrade pip
|
|
||||||
pip install setuptools wheel twine
|
|
||||||
|
|
||||||
- name: Build package
|
|
||||||
run: python setup.py sdist bdist_wheel
|
|
||||||
|
|
||||||
- name: Publish to PyPI
|
|
||||||
run: |
|
|
||||||
twine upload -u __token__ -p ${{ secrets.PYPI_TOKEN }} dist/*
|
|
@ -5,12 +5,8 @@
|
|||||||
<excludeFolder url="file://$MODULE_DIR$/CrossDown.egg-info" />
|
<excludeFolder url="file://$MODULE_DIR$/CrossDown.egg-info" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build" />
|
<excludeFolder url="file://$MODULE_DIR$/build" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/dist" />
|
<excludeFolder url="file://$MODULE_DIR$/dist" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/venv" />
|
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="jdk" jdkName="Python 3.11 (CrossDown)" jdkType="Python SDK" />
|
<orderEntry type="jdk" jdkName="Python 3.11" jdkType="Python SDK" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
</component>
|
</component>
|
||||||
<component name="PackageRequirementsSettings">
|
|
||||||
<option name="versionSpecifier" value="大于或等于 (>=x.y.z)" />
|
|
||||||
</component>
|
|
||||||
</module>
|
</module>
|
@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.11 (CrossDown)" project-jdk-type="Python SDK" />
|
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.11" project-jdk-type="Python SDK" />
|
||||||
</project>
|
</project>
|
@ -1,18 +1,8 @@
|
|||||||
"""
|
from markdown.extensions import Extension, extra, admonition, meta, sane_lists, toc, wikilinks, codehilite, legacy_attrs
|
||||||
核心代码
|
|
||||||
"""
|
|
||||||
|
|
||||||
import re
|
|
||||||
import xml
|
|
||||||
from typing import *
|
|
||||||
|
|
||||||
import markdown.core
|
|
||||||
from markdown import Markdown
|
|
||||||
from markdown.blockprocessors import BlockProcessor
|
|
||||||
from markdown.extensions import Extension, meta, toc, wikilinks, legacy_attrs
|
|
||||||
from markdown.inlinepatterns import InlineProcessor
|
|
||||||
|
|
||||||
|
from pymdownx.extra import ExtraExtension
|
||||||
from pymdownx.arithmatex import ArithmatexExtension
|
from pymdownx.arithmatex import ArithmatexExtension
|
||||||
|
from pymdownx.emoji import EmojiExtension
|
||||||
from pymdownx.blocks import BlocksExtension
|
from pymdownx.blocks import BlocksExtension
|
||||||
from pymdownx.blocks.admonition import AdmonitionExtension
|
from pymdownx.blocks.admonition import AdmonitionExtension
|
||||||
from pymdownx.blocks.details import DetailsExtension
|
from pymdownx.blocks.details import DetailsExtension
|
||||||
@ -20,29 +10,49 @@ from pymdownx.blocks.html import HTMLExtension
|
|||||||
from pymdownx.blocks.tab import TabExtension
|
from pymdownx.blocks.tab import TabExtension
|
||||||
from pymdownx.caret import InsertSupExtension
|
from pymdownx.caret import InsertSupExtension
|
||||||
from pymdownx.critic import CriticExtension
|
from pymdownx.critic import CriticExtension
|
||||||
from pymdownx.emoji import EmojiExtension
|
|
||||||
from pymdownx.extra import ExtraExtension
|
|
||||||
from pymdownx.fancylists import FancyListExtension
|
|
||||||
from pymdownx.highlight import HighlightExtension
|
from pymdownx.highlight import HighlightExtension
|
||||||
from pymdownx.inlinehilite import InlineHiliteExtension
|
from pymdownx.inlinehilite import InlineHiliteExtension
|
||||||
from pymdownx.keys import KeysExtension
|
from pymdownx.keys import KeysExtension
|
||||||
from pymdownx.mark import MarkExtension
|
from pymdownx.mark import MarkExtension
|
||||||
from pymdownx.progressbar import ProgressBarExtension
|
from pymdownx.progressbar import ProgressBarExtension
|
||||||
from pymdownx.saneheaders import SaneHeadersExtension
|
|
||||||
from pymdownx.smartsymbols import SmartSymbolsExtension
|
from pymdownx.smartsymbols import SmartSymbolsExtension
|
||||||
from pymdownx.superfences import fence_div_format
|
from pymdownx.superfences import fence_div_format
|
||||||
from pymdownx.tasklist import TasklistExtension
|
from pymdownx.tasklist import TasklistExtension
|
||||||
from pymdownx.tilde import DeleteSubExtension
|
from pymdownx.tilde import DeleteSubExtension
|
||||||
from pymdownx.magiclink import MagiclinkExtension
|
from pymdownx.fancylists import FancyListExtension
|
||||||
from pymdownx.pathconverter import PathConverterExtension
|
from pymdownx.saneheaders import SaneHeadersExtension
|
||||||
|
|
||||||
import kbdextension
|
from markdown.treeprocessors import Treeprocessor
|
||||||
import markdown_gfm_admonition
|
from markdown.inlinepatterns import InlineProcessor
|
||||||
|
from markdown.blockprocessors import BlockProcessor
|
||||||
|
from markdown.preprocessors import Preprocessor
|
||||||
|
from markdown.blockparser import BlockParser
|
||||||
|
from markdown import Markdown
|
||||||
|
|
||||||
from xml.etree.ElementTree import ElementTree
|
from typing import *
|
||||||
|
import re
|
||||||
|
import xml
|
||||||
|
|
||||||
|
from .Define import Variable
|
||||||
|
|
||||||
|
|
||||||
Variable = dict[str, str | tuple[str], list[str]] | None
|
class PreProcess(Preprocessor):
|
||||||
|
"""预处理"""
|
||||||
|
|
||||||
|
def __init__(self, variable: Variable):
|
||||||
|
super().__init__()
|
||||||
|
self.variable = variable
|
||||||
|
|
||||||
|
def run(self, lines: List[str]) -> List[str]:
|
||||||
|
new_lines = []
|
||||||
|
for line in lines: # 逐行遍历
|
||||||
|
for value in re.findall(r'\{\[(.+?)]}', line): # 找到变量
|
||||||
|
if value in self.variable: # 变量已定义
|
||||||
|
line = re.sub(fr'\{{\[{value}]}}', self.variable[value], line) # 替换变量为值
|
||||||
|
else:
|
||||||
|
line = re.sub(fr'\{{\[{value}]}}', value, line) # 不替换变量
|
||||||
|
new_lines.append(line)
|
||||||
|
return new_lines
|
||||||
|
|
||||||
|
|
||||||
class Simple(InlineProcessor):
|
class Simple(InlineProcessor):
|
||||||
@ -59,8 +69,8 @@ class Simple(InlineProcessor):
|
|||||||
super().__init__(pattern)
|
super().__init__(pattern)
|
||||||
self.tag = tag
|
self.tag = tag
|
||||||
|
|
||||||
def handleMatch(self, m: Match[str], data: str) -> (Tuple[xml.etree.ElementTree.Element, int, int] |
|
def handleMatch(self, m: Match[str], data: str) -> Tuple[xml.etree.ElementTree.Element, int, int] | Tuple[
|
||||||
Tuple[None, None, None]):
|
None, None, None]:
|
||||||
"""
|
"""
|
||||||
处理匹配
|
处理匹配
|
||||||
:param m: re模块的匹配对象
|
:param m: re模块的匹配对象
|
||||||
@ -89,8 +99,8 @@ class Nest(InlineProcessor):
|
|||||||
self.outer_tag = outer_tag
|
self.outer_tag = outer_tag
|
||||||
self.inner_tag = inner_tag
|
self.inner_tag = inner_tag
|
||||||
|
|
||||||
def handleMatch(self, m: Match[str], data: str) -> (Tuple[xml.etree.ElementTree.Element, int, int] |
|
def handleMatch(self, m: Match[str], data: str) -> Tuple[xml.etree.ElementTree.Element, int, int] | Tuple[
|
||||||
Tuple[None, None, None]):
|
None, None, None]:
|
||||||
"""
|
"""
|
||||||
处理匹配
|
处理匹配
|
||||||
:param m: re模块的匹配对象
|
:param m: re模块的匹配对象
|
||||||
@ -110,7 +120,7 @@ class ID(InlineProcessor):
|
|||||||
需要对HTML标签设置ID实现的样式
|
需要对HTML标签设置ID实现的样式
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, pattern: str, tag: str, property_: str, value: str | bool = None):
|
def __init__(self, pattern: str, tag: str, property_: str, value: Union[str, bool] = None):
|
||||||
"""
|
"""
|
||||||
初始化
|
初始化
|
||||||
:param pattern: 正则表达式
|
:param pattern: 正则表达式
|
||||||
@ -123,8 +133,8 @@ class ID(InlineProcessor):
|
|||||||
self.property = property_
|
self.property = property_
|
||||||
self.value = value
|
self.value = value
|
||||||
|
|
||||||
def handleMatch(self, m: Match[str], data: str) -> (Tuple[xml.etree.ElementTree.Element, int, int] |
|
def handleMatch(self, m: Match[str], data: str) -> Tuple[xml.etree.ElementTree.Element, int, int] | Tuple[
|
||||||
Tuple[None, None, None]):
|
None, None, None]:
|
||||||
"""
|
"""
|
||||||
处理匹配
|
处理匹配
|
||||||
:param m: re模块的匹配对象
|
:param m: re模块的匹配对象
|
||||||
@ -166,7 +176,110 @@ class Syllabus(BlockProcessor):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
class BasicExtension(Extension):
|
class _Anchor(InlineProcessor):
|
||||||
|
def handleMatch(self, m: Match[str], data: str) -> Tuple[xml.etree.ElementTree.Element, int, int] | Tuple[
|
||||||
|
None, None, None]:
|
||||||
|
"""
|
||||||
|
处理匹配
|
||||||
|
:param m: re模块的匹配对象
|
||||||
|
:param data: 被匹配的原始文本
|
||||||
|
:return: 标签 匹配开始 匹配结束
|
||||||
|
"""
|
||||||
|
tag = xml.etree.ElementTree.Element('span') # 创建标签
|
||||||
|
tag.text = m.group(1)
|
||||||
|
tag.set('id', m.group(1)) # 设置id
|
||||||
|
|
||||||
|
return tag, m.start(), m.end()
|
||||||
|
|
||||||
|
|
||||||
|
class LinkLine(InlineProcessor):
|
||||||
|
def handleMatch(self, m: Match[str], data: str) -> Tuple[xml.etree.ElementTree.Element, int, int] | Tuple[None, None, None]:
|
||||||
|
"""
|
||||||
|
处理匹配
|
||||||
|
:param m: re模块的匹配对象
|
||||||
|
:param data: 被匹配的原始文本
|
||||||
|
:return: 标签 匹配开始 匹配结束
|
||||||
|
"""
|
||||||
|
tag = xml.etree.ElementTree.Element('a') # 创建标签
|
||||||
|
tag.set('href', '#' + m.group(1)) # 设置id
|
||||||
|
tag.text = m.group(1)
|
||||||
|
|
||||||
|
return tag, m.start(), m.end()
|
||||||
|
|
||||||
|
|
||||||
|
class CodeLine(Treeprocessor):
|
||||||
|
"""
|
||||||
|
渲染单行代码
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self, variable: Variable):
|
||||||
|
"""
|
||||||
|
初始化
|
||||||
|
:param variable: 变量字典
|
||||||
|
"""
|
||||||
|
super().__init__()
|
||||||
|
self.variable = variable
|
||||||
|
|
||||||
|
def run(self, root: xml.etree.ElementTree.Element):
|
||||||
|
"""
|
||||||
|
渲染
|
||||||
|
:param root: Element树
|
||||||
|
"""
|
||||||
|
for code in root.findall('.//code'): # 在所有段落中查找单行代码
|
||||||
|
if re.match(r'\$[^$]*\$', code.text): # 渲染Latex
|
||||||
|
code.text = fr'\({code.text[1:-1]}\)'
|
||||||
|
code.tag = 'span'
|
||||||
|
elif re.match(r'¥[^$]*¥', code.text): # 是数学函数(单行)
|
||||||
|
if EXTRA_ABLE: # 支持扩展语法
|
||||||
|
expression, range_ = re.findall(r'¥([^$]*)¥(€[^$]*€)?', code.text)[0] # 分离表达式与范围(如果有)
|
||||||
|
x_r = (-10, 10)
|
||||||
|
y_r = (-20, 20)
|
||||||
|
if range_ != '': # 定义了范围
|
||||||
|
ranges = range_[1:-1].split('|')
|
||||||
|
if len(ranges) in (1, 2): # 定义的范围正确
|
||||||
|
x_r = tuple(int(i) for i in ranges[0].split(','))
|
||||||
|
if len(ranges) == 2: # 定义了y范围
|
||||||
|
y_r = tuple(int(i) for i in ranges[1].split(','))
|
||||||
|
code.tag = 'img'
|
||||||
|
code.set('src', f"""data:image/png;base64,{(function_drawing(
|
||||||
|
function=lambda x: eval(expression.split('=')[1]), x_range=x_r, y_range=y_r
|
||||||
|
))}""") # 绘制函数图像
|
||||||
|
code.set('alt', 'Base64 函数图片')
|
||||||
|
else: # 不支持扩展语法
|
||||||
|
code.tag = 'span'
|
||||||
|
code.set('class', 'block')
|
||||||
|
code.text = '该平台不支持扩展语法'
|
||||||
|
elif re.match(r'\{[^$]*}', code.text): # 是强调
|
||||||
|
code.tag = 'span'
|
||||||
|
code.set('class', 'block')
|
||||||
|
key = code.text[1:-1] # 去掉两边的{}
|
||||||
|
if key in self.variable:
|
||||||
|
code.text = self.variable[key]
|
||||||
|
else:
|
||||||
|
code.text = key
|
||||||
|
|
||||||
|
|
||||||
|
class Pre(Extension):
|
||||||
|
"""预处理"""
|
||||||
|
|
||||||
|
def __init__(self, variable: Variable):
|
||||||
|
"""
|
||||||
|
初始化
|
||||||
|
:param variable: 变量字典
|
||||||
|
"""
|
||||||
|
super().__init__()
|
||||||
|
self.variable = variable
|
||||||
|
|
||||||
|
def extendMarkdown(self, md: Markdown):
|
||||||
|
"""
|
||||||
|
添加扩展
|
||||||
|
:param md: 转换器
|
||||||
|
"""
|
||||||
|
md.registerExtension(self) # 注册扩展
|
||||||
|
md.preprocessors.register(PreProcess(self.variable), 'pre_process', 1000)
|
||||||
|
|
||||||
|
|
||||||
|
class Basic(Extension):
|
||||||
"""
|
"""
|
||||||
渲染基本样式
|
渲染基本样式
|
||||||
"""
|
"""
|
||||||
@ -186,31 +299,34 @@ class BasicExtension(Extension):
|
|||||||
md.parser.blockprocessors.register(Syllabus(md.parser), 'syllabus', 182) # 渲染提纲
|
md.parser.blockprocessors.register(Syllabus(md.parser), 'syllabus', 182) # 渲染提纲
|
||||||
|
|
||||||
|
|
||||||
class InlineCode:
|
class Anchor(Extension):
|
||||||
|
def extendMarkdown(self, md: Markdown):
|
||||||
|
"""
|
||||||
|
添加扩展
|
||||||
|
:param md: 转换器
|
||||||
|
"""
|
||||||
|
md.registerExtension(self) # 注册扩展
|
||||||
|
md.inlinePatterns.register(_Anchor(r'\{{#([^{}#]+)}}'), 'anchor', 0) # 定义锚点
|
||||||
|
md.inlinePatterns.register(LinkLine(r'\{{([^{}#]+)}}'), 'line_link', 0) # 添加页内链接
|
||||||
|
|
||||||
|
|
||||||
|
class Code(Extension):
|
||||||
def __init__(self, variable: Variable):
|
def __init__(self, variable: Variable):
|
||||||
|
"""
|
||||||
|
初始化
|
||||||
|
:param variable: 变量字典
|
||||||
|
"""
|
||||||
|
super().__init__()
|
||||||
self.variable = variable
|
self.variable = variable
|
||||||
|
|
||||||
def __call__(self, source: str, language: str, css_class: str, md: markdown.core.Markdown): # 自定义的单行代码格式化器
|
def extendMarkdown(self, md: Markdown):
|
||||||
if language != '': # 调用默认格式化函数
|
"""
|
||||||
return md.inlinePatterns['backtick'].highlight_code(
|
添加扩展
|
||||||
src=source, language=language, classname=css_class,
|
:param md: 转换器
|
||||||
md=md
|
"""
|
||||||
)
|
md.registerExtension(self) # 注册扩展
|
||||||
match tuple(source):
|
# md.treeprocessors.register(CodeLine(variable=self.variable), 'code_line', 0) # 渲染单行代码块
|
||||||
case '{', '#', *archers, '}': # 匹配到{#锚点}
|
# md.treeprocessors.register(CodeBlock(), 'code_block', 1000) # 渲染多行代码块
|
||||||
archer = ''.join(archers)
|
|
||||||
return f'<span id="{archer}">{archer}</span>'
|
|
||||||
case '{', '-', *inline_links, '}': # 匹配到{-行内链接}
|
|
||||||
inline_link = ''.join(inline_links)
|
|
||||||
return f'<a href=#{inline_link}>{inline_link}</a>'
|
|
||||||
case '{', *variables, '}': # 匹配到{变量}
|
|
||||||
variable = ''.join(variables)
|
|
||||||
if variable in self.variable:
|
|
||||||
return self.variable[variable]
|
|
||||||
else:
|
|
||||||
return variable
|
|
||||||
case _:
|
|
||||||
return f'<code>{source}</code>'
|
|
||||||
|
|
||||||
|
|
||||||
Extensions = {
|
Extensions = {
|
||||||
@ -222,15 +338,15 @@ Extensions = {
|
|||||||
|
|
||||||
# pymdownx
|
# pymdownx
|
||||||
'基本扩展': ExtraExtension(configs={
|
'基本扩展': ExtraExtension(configs={
|
||||||
'pymdownx.superfences': {
|
superfences: {
|
||||||
'custom_fences': [ # 渲染mermaid
|
custom_fences: [ # 渲染mermaid
|
||||||
{
|
{
|
||||||
'name': 'mermaid',
|
'name': 'mermaid',
|
||||||
'class': 'mermaid',
|
'class': 'mermaid',
|
||||||
'format': fence_div_format,
|
'format': fence_div_format
|
||||||
},
|
}
|
||||||
]
|
]
|
||||||
},
|
}
|
||||||
}),
|
}),
|
||||||
'超级数学': ArithmatexExtension(),
|
'超级数学': ArithmatexExtension(),
|
||||||
'EMOJI': EmojiExtension(),
|
'EMOJI': EmojiExtension(),
|
||||||
@ -241,6 +357,7 @@ Extensions = {
|
|||||||
'标签': TabExtension(),
|
'标签': TabExtension(),
|
||||||
'批评': CriticExtension(),
|
'批评': CriticExtension(),
|
||||||
'代码高亮': HighlightExtension(),
|
'代码高亮': HighlightExtension(),
|
||||||
|
'行内高亮': InlineHiliteExtension(),
|
||||||
'按键风格': KeysExtension(),
|
'按键风格': KeysExtension(),
|
||||||
'高亮': MarkExtension(),
|
'高亮': MarkExtension(),
|
||||||
'进度条': ProgressBarExtension(),
|
'进度条': ProgressBarExtension(),
|
||||||
@ -250,19 +367,13 @@ Extensions = {
|
|||||||
'上标': InsertSupExtension(),
|
'上标': InsertSupExtension(),
|
||||||
'高级列表': FancyListExtension(),
|
'高级列表': FancyListExtension(),
|
||||||
'高级标题': SaneHeadersExtension(),
|
'高级标题': SaneHeadersExtension(),
|
||||||
'超级链接': MagiclinkExtension(),
|
|
||||||
'路径转换器': PathConverterExtension(),
|
|
||||||
|
|
||||||
# 其它
|
|
||||||
'KBD': kbdextension.KbdExtension(),
|
|
||||||
'GFM 警告': markdown_gfm_admonition.GfmAdmonitionExtension(),
|
|
||||||
|
|
||||||
# 自定义
|
# 自定义
|
||||||
'基本风格': BasicExtension(),
|
'基本风格': Basic(),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def main(text: str, variable: Variable = None) -> tuple[str, Variable]:
|
def main(text: str, variable: Variable = None) -> Tuple[str, Variable]:
|
||||||
"""
|
"""
|
||||||
主函数
|
主函数
|
||||||
:param text: 输入文本
|
:param text: 输入文本
|
||||||
@ -271,15 +382,5 @@ def main(text: str, variable: Variable = None) -> tuple[str, Variable]:
|
|||||||
"""
|
"""
|
||||||
if variable is None:
|
if variable is None:
|
||||||
variable = {}
|
variable = {}
|
||||||
md = Markdown(extensions=list(Extensions.values()) + [
|
md = Markdown(extensions=list(Extensions.values()))
|
||||||
InlineHiliteExtension(
|
|
||||||
custom_inline=[
|
|
||||||
{
|
|
||||||
'name': '*',
|
|
||||||
'class': 'block',
|
|
||||||
'format': InlineCode(variable=variable),
|
|
||||||
},
|
|
||||||
]
|
|
||||||
),
|
|
||||||
])
|
|
||||||
return md.convert(text), md.Meta
|
return md.convert(text), md.Meta
|
||||||
|
4
CrossDown/Define.py
Normal file
4
CrossDown/Define.py
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
from typing import *
|
||||||
|
|
||||||
|
|
||||||
|
Variable = Dict[str, Union[str, Tuple[str], List[str]]] | None
|
@ -1,14 +1,11 @@
|
|||||||
from typing import *
|
from typing import *
|
||||||
import pickle
|
from .Core import main
|
||||||
from .Core import main, Variable, Syllabus
|
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
'main', # 主函数
|
'main', # 主函数
|
||||||
'indent', # 添加空格
|
'indent', # 添加空格
|
||||||
'HEAD', # HTML头部引用
|
'HEAD', #
|
||||||
'Meta', # 元数据处理器
|
|
||||||
'Syllabus', # 提纲扩展
|
|
||||||
'Variable', # 变量类型提示
|
|
||||||
]
|
]
|
||||||
__version__ = '0.11.2'
|
__version__ = '0.11.2'
|
||||||
__author__ = 'CrossDark'
|
__author__ = 'CrossDark'
|
||||||
@ -16,17 +13,15 @@ __email__ = 'liuhanbo333@icloud.com'
|
|||||||
__source__ = 'https://crossdark.net/'
|
__source__ = 'https://crossdark.net/'
|
||||||
__license__ = """MIT"""
|
__license__ = """MIT"""
|
||||||
|
|
||||||
|
|
||||||
HEAD = {
|
HEAD = {
|
||||||
# mathjax
|
('latex', 'js'): '<script type="text/javascript" async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML"></script>',
|
||||||
('latex',
|
|
||||||
'js'): '<script type="text/javascript" async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML"></script>',
|
|
||||||
|
|
||||||
# mermaid
|
# mermaid
|
||||||
('mermaid', 'js'): '<script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>',
|
('mermaid', 'js'): '<script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>',
|
||||||
('mermaid', 'init'): '<script>mermaid.initialize({startOnLoad:true})</script>',
|
('mermaid', 'init'): '<script>mermaid.initialize({startOnLoad:true})</script>',
|
||||||
|
|
||||||
# 代码高亮css
|
('code-highlight', 'css'): '<link rel="stylesheet" href="../Static/styles.css">', # 代码高亮css
|
||||||
('code-highlight', 'css'): '<link rel="stylesheet" href="../Static/styles.css">',
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -42,32 +37,3 @@ def indent(input_: Union[str, List, Tuple], indent_spaces: int = 4) -> str:
|
|||||||
return "\n".join(
|
return "\n".join(
|
||||||
f"{' ' * indent_spaces}{line}" for line in (lambda x: x.splitlines() if isinstance(x, str) else x)(input_)
|
f"{' ' * indent_spaces}{line}" for line in (lambda x: x.splitlines() if isinstance(x, str) else x)(input_)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class Meta:
|
|
||||||
"""
|
|
||||||
这是用于处理本模块的元数据的类
|
|
||||||
"""
|
|
||||||
|
|
||||||
def __init__(self, major: int, minor: int = 0, micro: int = 0, requirements='requirements.txt',
|
|
||||||
long_description='README.md'):
|
|
||||||
# 设置版本
|
|
||||||
try:
|
|
||||||
with open('data.pkl', 'rb') as file: # 读取上次版本
|
|
||||||
latest_version = pickle.load(file)
|
|
||||||
except FileNotFoundError:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
if latest_version[0] >= major: # 判断主版本号
|
|
||||||
if latest_version[1] >= minor: # 判断副版本号
|
|
||||||
if latest_version[2] >= micro: # 判断小版本号
|
|
||||||
raise ValueError('版本不对')
|
|
||||||
self.version = f'{major}.{minor}.{micro}' # 生成版本字符串
|
|
||||||
with open('data.pkl', 'wb') as file: # 记录版本
|
|
||||||
pickle.dump((major, minor, micro), file)
|
|
||||||
|
|
||||||
with open(requirements, 'r') as f: # 设置依赖
|
|
||||||
self.requirements = [line.strip() for line in f.readlines()]
|
|
||||||
|
|
||||||
with open(long_description, "r") as fh:
|
|
||||||
self.long_description = fh.read()
|
|
||||||
|
86
README.html
86
README.html
@ -61,7 +61,7 @@
|
|||||||
</li>
|
</li>
|
||||||
<li><a href="#3">3 锚点</a><ul>
|
<li><a href="#3">3 锚点</a><ul>
|
||||||
<li><a href="#3.1">3.1 定义</a></li>
|
<li><a href="#3.1">3.1 定义</a></li>
|
||||||
<li><a href="#3.2">3.2 链接</a></li>
|
<li><a href="#3.2">3.2 页内链接</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="#4">4 代码块</a><ul>
|
<li><a href="#4">4 代码块</a><ul>
|
||||||
@ -69,7 +69,6 @@
|
|||||||
<li><a href="#4.1.1">4.1.1 LaTex</a></li>
|
<li><a href="#4.1.1">4.1.1 LaTex</a></li>
|
||||||
<li><a href="#4.1.2">4.1.2 函数</a></li>
|
<li><a href="#4.1.2">4.1.2 函数</a></li>
|
||||||
<li><a href="#4.1.3">4.1.3 按键风格</a></li>
|
<li><a href="#4.1.3">4.1.3 按键风格</a></li>
|
||||||
<li><a href="#4.1.4">4.1.4 突出</a></li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="#4.2">4.2 多行</a><ul>
|
<li><a href="#4.2">4.2 多行</a><ul>
|
||||||
@ -132,20 +131,11 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="#19">19 批评</a></li>
|
<li><a href="#19">19 批评</a></li>
|
||||||
<li><a href="#20">20 警告</a><ul>
|
|
||||||
<li><a href="#20.1">20.1 告示</a></li>
|
|
||||||
<li><a href="#20.2">20.2 提示</a></li>
|
|
||||||
<li><a href="#20.3">20.3 着重</a></li>
|
|
||||||
<li><a href="#20.4">20.4 提醒</a></li>
|
|
||||||
<li><a href="#20.5">20.5 警告</a></li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<h1 id="crossdown">CrossDown</h1>
|
<h1 id="crossdown">CrossDown</h1>
|
||||||
<p>自制的markdown,添加了一些自定义的语法</p>
|
<p>自制的markdown,添加了一些自定义的语法
|
||||||
<p>效果请见<README.html></p>
|
效果请见<README.html></p>
|
||||||
<p>安装:pip3 install --index-url <a href="https://crossdark.net/api/packages/CrossDark/pypi/simple/">https://crossdark.net/api/packages/CrossDark/pypi/simple/</a> CrossDown</p>
|
|
||||||
<h1 id="1">1 基本语法</h1>
|
<h1 id="1">1 基本语法</h1>
|
||||||
<h2 id="1.1">1.1 标题</h2>
|
<h2 id="1.1">1.1 标题</h2>
|
||||||
<h1 id="_1">一级标题</h1>
|
<h1 id="_1">一级标题</h1>
|
||||||
@ -174,8 +164,6 @@
|
|||||||
<p><a href="链接地址">链接文本</a></p>
|
<p><a href="链接地址">链接文本</a></p>
|
||||||
<p><a href="https://crossdark.com">CrossDark</a></p>
|
<p><a href="https://crossdark.com">CrossDark</a></p>
|
||||||
<p><a href="https://crossdark.net/">https://crossdark.net/</a></p>
|
<p><a href="https://crossdark.net/">https://crossdark.net/</a></p>
|
||||||
<p><a href="https://crossdark.net/">https://crossdark.net/</a></p>
|
|
||||||
<p><a href="mailto:liuhanbo333@icloud.com">liuhanbo333@icloud.com</a></p>
|
|
||||||
<h3 id="1.3.2">1.3.2 图片</h3>
|
<h3 id="1.3.2">1.3.2 图片</h3>
|
||||||
<p><img alt="链接图片" src="链接地址" /></p>
|
<p><img alt="链接图片" src="链接地址" /></p>
|
||||||
<p><img alt="sea" src="https://crossdark.com/wp-content/uploads/2024/05/1715259682-sea.jpg" /></p>
|
<p><img alt="sea" src="https://crossdark.com/wp-content/uploads/2024/05/1715259682-sea.jpg" /></p>
|
||||||
@ -187,9 +175,9 @@
|
|||||||
<p>直接在文本中使用 <abbr title="长的文本">缩写</abbr> 即可</p>
|
<p>直接在文本中使用 <abbr title="长的文本">缩写</abbr> 即可</p>
|
||||||
<h1 id="3">3 锚点</h1>
|
<h1 id="3">3 锚点</h1>
|
||||||
<h2 id="3.1">3.1 定义</h2>
|
<h2 id="3.1">3.1 定义</h2>
|
||||||
<p><span id="锚点">锚点</span></p>
|
<p>{{#锚点名}}</p>
|
||||||
<h2 id="3.2">3.2 链接</h2>
|
<h2 id="3.2">3.2 页内链接</h2>
|
||||||
<p><a href=#锚点>锚点</a></p>
|
<p>{{锚点名}}</p>
|
||||||
<h1 id="4">4 代码块</h1>
|
<h1 id="4">4 代码块</h1>
|
||||||
<h2 id="4.1">4.1 <code>单行</code></h2>
|
<h2 id="4.1">4.1 <code>单行</code></h2>
|
||||||
<p>Here is some code: <code class="highlight"><span class="kn">import</span> <span class="nn">pymdownx</span><span class="p">;</span> <span class="n">pymdownx</span><span class="o">.</span><span class="n">__version__</span></code>.</p>
|
<p>Here is some code: <code class="highlight"><span class="kn">import</span> <span class="nn">pymdownx</span><span class="p">;</span> <span class="n">pymdownx</span><span class="o">.</span><span class="n">__version__</span></code>.</p>
|
||||||
@ -197,7 +185,7 @@
|
|||||||
<h3 id="4.1.1">4.1.1 LaTex</h3>
|
<h3 id="4.1.1">4.1.1 LaTex</h3>
|
||||||
<p>这是<span class="arithmatex"><span class="MathJax_Preview">CO_2</span><script type="math/tex">CO_2</script></span>二氧化碳,或者可以写成这样CO<sub>2</sub></p>
|
<p>这是<span class="arithmatex"><span class="MathJax_Preview">CO_2</span><script type="math/tex">CO_2</script></span>二氧化碳,或者可以写成这样CO<sub>2</sub></p>
|
||||||
<p>这是<span class="arithmatex"><span class="MathJax_Preview">H_2O</span><script type="math/tex">H_2O</script></span>水,或者写成H<sub>2</sub>O
|
<p>这是<span class="arithmatex"><span class="MathJax_Preview">H_2O</span><script type="math/tex">H_2O</script></span>水,或者写成H<sub>2</sub>O
|
||||||
<sup>3</sup>H<sub>2</sub>O</p>
|
H<sup>3</sup><sub>2</sub>O</p>
|
||||||
<p><span class="arithmatex"><span class="MathJax_Preview">\lg\left(\frac{目标生物的理智值}{稳定折磨型工具人的理智值}\right)</span><script type="math/tex">\lg\left(\frac{目标生物的理智值}{稳定折磨型工具人的理智值}\right)</script></span></p>
|
<p><span class="arithmatex"><span class="MathJax_Preview">\lg\left(\frac{目标生物的理智值}{稳定折磨型工具人的理智值}\right)</span><script type="math/tex">\lg\left(\frac{目标生物的理智值}{稳定折磨型工具人的理智值}\right)</script></span></p>
|
||||||
<h3 id="4.1.2">4.1.2 函数</h3>
|
<h3 id="4.1.2">4.1.2 函数</h3>
|
||||||
<p><code>¥y=x*2+1¥</code> // 不定义范围</p>
|
<p><code>¥y=x*2+1¥</code> // 不定义范围</p>
|
||||||
@ -205,19 +193,19 @@
|
|||||||
<p><code>¥y=x**3¥€-50,50|-100,100€</code> // 定义了y范围</p>
|
<p><code>¥y=x**3¥€-50,50|-100,100€</code> // 定义了y范围</p>
|
||||||
<h3 id="4.1.3">4.1.3 按键风格</h3>
|
<h3 id="4.1.3">4.1.3 按键风格</h3>
|
||||||
<p><span class="keys"><kbd class="key-control">Ctrl</kbd><span>+</span><kbd class="key-alt">Alt</kbd><span>+</span><kbd class="key-delete">Del</kbd></span></p>
|
<p><span class="keys"><kbd class="key-control">Ctrl</kbd><span>+</span><kbd class="key-alt">Alt</kbd><span>+</span><kbd class="key-delete">Del</kbd></span></p>
|
||||||
<p><kbd>Enter</kbd></p>
|
|
||||||
<h3 id="4.1.4">4.1.4 突出</h3>
|
|
||||||
<p>突出内容</p>
|
|
||||||
<h2 id="4.2">4.2 多行</h2>
|
<h2 id="4.2">4.2 多行</h2>
|
||||||
<h3 id="4.2.1">4.2.1 YAML</h3>
|
<h3 id="4.2.1">4.2.1 YAML</h3>
|
||||||
<div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal">2</span>
|
<div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"> 2</span>
|
||||||
<span class="normal">3</span>
|
<span class="normal"> 3</span>
|
||||||
<span class="normal">4</span>
|
<span class="normal"> 4</span>
|
||||||
<span class="normal">5</span>
|
<span class="normal"> 5</span>
|
||||||
<span class="normal">6</span>
|
<span class="normal"> 6</span>
|
||||||
<span class="normal">7</span>
|
<span class="normal"> 7</span>
|
||||||
<span class="normal">8</span>
|
<span class="normal"> 8</span>
|
||||||
<span class="normal">9</span></pre></div></td><td class="code"><div><pre><span></span><code><span class="hll"><span class="nt">A</span><span class="p">:</span>
|
<span class="normal"> 9</span>
|
||||||
|
<span class="normal">10</span>
|
||||||
|
<span class="normal">11</span>
|
||||||
|
<span class="normal">12</span></pre></div></td><td class="code"><div><pre><span></span><code><span class="hll"><span class="nt">A</span><span class="p">:</span>
|
||||||
</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">1. a</span>
|
</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">1. a</span>
|
||||||
<span class="hll"><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">2. b</span>
|
<span class="hll"><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">2. b</span>
|
||||||
</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">3. c</span>
|
</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">3. c</span>
|
||||||
@ -225,6 +213,9 @@
|
|||||||
<span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">a</span>
|
<span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">a</span>
|
||||||
<span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">b</span>
|
<span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">b</span>
|
||||||
<span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">c</span>
|
<span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">c</span>
|
||||||
|
<span class="p p-Indicator">{[</span><span class="nv">强调变量</span><span class="p p-Indicator">]}:</span>
|
||||||
|
<span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">a</span>
|
||||||
|
<span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">b</span>
|
||||||
</code></pre></div></td></tr></table></div>
|
</code></pre></div></td></tr></table></div>
|
||||||
<h3 id="4.2.2">4.2.2 Python</h3>
|
<h3 id="4.2.2">4.2.2 Python</h3>
|
||||||
<div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal">1</span>
|
<div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal">1</span>
|
||||||
@ -266,7 +257,7 @@
|
|||||||
p(h_j=1|\mathbf{v}) & = \sigma\left(\sum_i w_{ij}v_i + c_j\right)
|
p(h_j=1|\mathbf{v}) & = \sigma\left(\sum_i w_{ij}v_i + c_j\right)
|
||||||
\end{align}</script>
|
\end{align}</script>
|
||||||
</div>
|
</div>
|
||||||
<p>行内公式: <span class="arithmatex"><span class="MathJax_Preview">p(x|y) = \frac{p(y|x)p(x)}{p(y)}</span><script type="math/tex">p(x|y) = \frac{p(y|x)p(x)}{p(y)}</script></span></p>
|
<p>行内公式: <span class="arithmatex"><span class="MathJax_Preview">p(x|y) = \frac{p(y|x)p(x)}{p(y)}</span><script type="math/tex">p(x|y) = \frac{p(y|x)p(x)}{p(y)}</script></span> </p>
|
||||||
<h3 id="4.2.6">4.2.6 HTML</h3>
|
<h3 id="4.2.6">4.2.6 HTML</h3>
|
||||||
<div class="highlight"><pre><span></span><code><span class="p"><</span><span class="nt">head</span><span class="p">></span>
|
<div class="highlight"><pre><span></span><code><span class="p"><</span><span class="nt">head</span><span class="p">></span>
|
||||||
<span class="cm"><!--头部--></span>
|
<span class="cm"><!--头部--></span>
|
||||||
@ -279,7 +270,6 @@
|
|||||||
<div class="highlight"><pre><span></span><code>#! usr/bin/python3.11
|
<div class="highlight"><pre><span></span><code>#! usr/bin/python3.11
|
||||||
def main():
|
def main():
|
||||||
print('CrossDown')
|
print('CrossDown')
|
||||||
`#!py3 print('cd')`
|
|
||||||
</code></pre></div>
|
</code></pre></div>
|
||||||
<h1 id="5">5 转义</h1>
|
<h1 id="5">5 转义</h1>
|
||||||
<p>\ </p>
|
<p>\ </p>
|
||||||
@ -314,7 +304,7 @@
|
|||||||
<p>7.1.3. 错误示范</p>
|
<p>7.1.3. 错误示范</p>
|
||||||
<p>不能出现两个及以上连续的点,例如:</p>
|
<p>不能出现两个及以上连续的点,例如:</p>
|
||||||
<p>7..1...4 错误示范</p>
|
<p>7..1...4 错误示范</p>
|
||||||
<p>提纲号会被自动配置为锚点,可直接使用{-7}{-7.1}</p>
|
<p>提纲号会被自动配置为锚点,可直接使用{{7}}{{7.1}}</p>
|
||||||
<h1 id="8">8 注释</h1>
|
<h1 id="8">8 注释</h1>
|
||||||
<!-- 这是注释 -->
|
<!-- 这是注释 -->
|
||||||
|
|
||||||
@ -355,7 +345,7 @@
|
|||||||
<li>c</li>
|
<li>c</li>
|
||||||
</ul>
|
</ul>
|
||||||
</dd>
|
</dd>
|
||||||
<dt>强调值</dt>
|
<dt><code>{强调变量}</code></dt>
|
||||||
<dd>
|
<dd>
|
||||||
<ul>
|
<ul>
|
||||||
<li>a</li>
|
<li>a</li>
|
||||||
@ -549,7 +539,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</p>
|
</p>
|
||||||
<h1 id="15">15 内部链接</h1>
|
<h1 id="15">15 内部链接</h1>
|
||||||
<p><kbd>Bracketed</kbd></p>
|
<p><a class="wikilink" href="/Bracketed/">Bracketed</a></p>
|
||||||
<h1 id="16">16 变量</h1>
|
<h1 id="16">16 变量</h1>
|
||||||
<p>{[强调变量]}</p>
|
<p>{[强调变量]}</p>
|
||||||
<h1 id="17">17 属性设置</h1>
|
<h1 id="17">17 属性设置</h1>
|
||||||
@ -623,31 +613,5 @@
|
|||||||
<li>test add</li>
|
<li>test add</li>
|
||||||
</ul>
|
</ul>
|
||||||
</ins>
|
</ins>
|
||||||
<h1 id="20">20 警告</h1>
|
|
||||||
<h2 id="20.1">20.1 告示</h2>
|
|
||||||
<div class="admonition note">
|
|
||||||
<p class="admonition-title">Note</p>
|
|
||||||
<p>突出用户应考虑的信息</p>
|
|
||||||
</div>
|
|
||||||
<h2 id="20.2">20.2 提示</h2>
|
|
||||||
<div class="admonition tip">
|
|
||||||
<p class="admonition-title">Tip</p>
|
|
||||||
<p>帮助用户的可选信息</p>
|
|
||||||
</div>
|
|
||||||
<h2 id="20.3">20.3 着重</h2>
|
|
||||||
<div class="admonition important">
|
|
||||||
<p class="admonition-title">Important</p>
|
|
||||||
<p>Crucial information necessary for users to succeed.</p>
|
|
||||||
</div>
|
|
||||||
<h2 id="20.4">20.4 提醒</h2>
|
|
||||||
<div class="admonition warning">
|
|
||||||
<p class="admonition-title">Warning</p>
|
|
||||||
<p>Critical content demanding immediate user attention due to potential risks.</p>
|
|
||||||
</div>
|
|
||||||
<h2 id="20.5">20.5 警告</h2>
|
|
||||||
<div class="admonition caution">
|
|
||||||
<p class="admonition-title">Caution</p>
|
|
||||||
<p>Negative potential consequences of an action.</p>
|
|
||||||
</div>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
54
README.md
54
README.md
@ -8,11 +8,8 @@ base_url: http://crossdark.net:3000/crossdark/CrossDown
|
|||||||
|
|
||||||
# CrossDown
|
# CrossDown
|
||||||
自制的markdown,添加了一些自定义的语法
|
自制的markdown,添加了一些自定义的语法
|
||||||
|
|
||||||
效果请见<README.html>
|
效果请见<README.html>
|
||||||
|
|
||||||
安装:pip3 install --index-url https://crossdark.net/api/packages/CrossDark/pypi/simple/ CrossDown
|
|
||||||
|
|
||||||
1 基本语法
|
1 基本语法
|
||||||
|
|
||||||
1.1 标题
|
1.1 标题
|
||||||
@ -62,10 +59,6 @@ ___
|
|||||||
|
|
||||||
<https://crossdark.net/>
|
<https://crossdark.net/>
|
||||||
|
|
||||||
https://crossdark.net/
|
|
||||||
|
|
||||||
liuhanbo333@icloud.com
|
|
||||||
|
|
||||||
1.3.2 图片
|
1.3.2 图片
|
||||||
|
|
||||||
![链接图片](链接地址)
|
![链接图片](链接地址)
|
||||||
@ -92,11 +85,11 @@ liuhanbo333@icloud.com
|
|||||||
|
|
||||||
3.1 定义
|
3.1 定义
|
||||||
|
|
||||||
`{#锚点}`
|
{{#锚点名}}
|
||||||
|
|
||||||
3.2 链接
|
3.2 页内链接
|
||||||
|
|
||||||
`{-锚点}`
|
{{锚点名}}
|
||||||
|
|
||||||
4 代码块
|
4 代码块
|
||||||
|
|
||||||
@ -111,7 +104,7 @@ The mock shebang will be treated like text here: ` #!js var test = 0; `.
|
|||||||
这是$CO_2$二氧化碳,或者可以写成这样CO~2~
|
这是$CO_2$二氧化碳,或者可以写成这样CO~2~
|
||||||
|
|
||||||
这是$H_2O$水,或者写成H~2~O
|
这是$H_2O$水,或者写成H~2~O
|
||||||
^3^H~2~O
|
H^3^~2~O
|
||||||
|
|
||||||
$\lg\left(\frac{目标生物的理智值}{稳定折磨型工具人的理智值}\right)$
|
$\lg\left(\frac{目标生物的理智值}{稳定折磨型工具人的理智值}\right)$
|
||||||
|
|
||||||
@ -127,12 +120,6 @@ $\lg\left(\frac{目标生物的理智值}{稳定折磨型工具人的理智值}\
|
|||||||
|
|
||||||
++ctrl+alt+delete++
|
++ctrl+alt+delete++
|
||||||
|
|
||||||
[[Enter]]
|
|
||||||
|
|
||||||
4.1.4 突出
|
|
||||||
|
|
||||||
`{突出内容}`
|
|
||||||
|
|
||||||
4.2 多行
|
4.2 多行
|
||||||
|
|
||||||
4.2.1 YAML
|
4.2.1 YAML
|
||||||
@ -146,6 +133,9 @@ B:
|
|||||||
- a
|
- a
|
||||||
- b
|
- b
|
||||||
- c
|
- c
|
||||||
|
{[强调变量]}:
|
||||||
|
- a
|
||||||
|
- b
|
||||||
```
|
```
|
||||||
|
|
||||||
4.2.2 Python
|
4.2.2 Python
|
||||||
@ -205,7 +195,6 @@ $$
|
|||||||
#! usr/bin/python3.11
|
#! usr/bin/python3.11
|
||||||
def main():
|
def main():
|
||||||
print('CrossDown')
|
print('CrossDown')
|
||||||
`#!py3 print('cd')`
|
|
||||||
```
|
```
|
||||||
|
|
||||||
5 转义
|
5 转义
|
||||||
@ -245,7 +234,7 @@ def main():
|
|||||||
|
|
||||||
7..1...4 错误示范
|
7..1...4 错误示范
|
||||||
|
|
||||||
提纲号会被自动配置为锚点,可直接使用{-7}{-7.1}
|
提纲号会被自动配置为锚点,可直接使用{{7}}{{7.1}}
|
||||||
|
|
||||||
8 注释
|
8 注释
|
||||||
|
|
||||||
@ -497,30 +486,3 @@ General block handling.
|
|||||||
* test add
|
* test add
|
||||||
|
|
||||||
++}
|
++}
|
||||||
|
|
||||||
20 警告
|
|
||||||
|
|
||||||
20.1 告示
|
|
||||||
|
|
||||||
> [!NOTE]
|
|
||||||
> 突出用户应考虑的信息
|
|
||||||
|
|
||||||
20.2 提示
|
|
||||||
|
|
||||||
> [!TIP]
|
|
||||||
> 帮助用户的可选信息
|
|
||||||
|
|
||||||
20.3 着重
|
|
||||||
|
|
||||||
> [!IMPORTANT]
|
|
||||||
> Crucial information necessary for users to succeed.
|
|
||||||
|
|
||||||
20.4 提醒
|
|
||||||
|
|
||||||
> [!WARNING]
|
|
||||||
> Critical content demanding immediate user attention due to potential risks.
|
|
||||||
|
|
||||||
20.5 警告
|
|
||||||
|
|
||||||
> [!CAUTION]
|
|
||||||
> Negative potential consequences of an action.
|
|
||||||
|
@ -2,8 +2,6 @@ Markdown>=3.7
|
|||||||
matplotlib~=3.8.2
|
matplotlib~=3.8.2
|
||||||
numpy~=1.26.2
|
numpy~=1.26.2
|
||||||
pygments>=2.18.0
|
pygments>=2.18.0
|
||||||
CrossDown>=2.2.0
|
CrossDown~=2.2.0
|
||||||
setuptools~=70.1.1
|
setuptools~=70.1.1
|
||||||
emoji~=2.13.2
|
emoji~=2.13.2
|
||||||
pymdown-extensions>=10.12
|
|
||||||
kbdextension>=1.0.1
|
|
1
run.py
1
run.py
@ -2,6 +2,7 @@ import time
|
|||||||
|
|
||||||
from CrossDown import *
|
from CrossDown import *
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
# 开始计时
|
# 开始计时
|
||||||
start_time = time.perf_counter_ns()
|
start_time = time.perf_counter_ns()
|
||||||
|
15
setup.py
15
setup.py
@ -1,20 +1,23 @@
|
|||||||
import setuptools
|
import setuptools
|
||||||
|
|
||||||
from CrossDown import Meta
|
with open("README.md", "r") as fh:
|
||||||
|
long_description = fh.read()
|
||||||
meta = Meta(3, 3, 2)
|
|
||||||
|
|
||||||
setuptools.setup(
|
setuptools.setup(
|
||||||
name="CrossDown",
|
name="CrossDown",
|
||||||
version=meta.version,
|
version="2.2.0",
|
||||||
author="CrossDark",
|
author="CrossDark",
|
||||||
author_email="liuhanbo333@icloud.com",
|
author_email="liuhanbo333@icloud.com",
|
||||||
description="CrossDark's MarkDown",
|
description="CrossDark's MarkDown",
|
||||||
long_description=meta.long_description,
|
long_description=long_description,
|
||||||
long_description_content_type="text/markdown",
|
long_description_content_type="text/markdown",
|
||||||
url="https://github.com/CrossDark/CrossDown",
|
url="https://github.com/CrossDark/CrossDown",
|
||||||
packages=setuptools.find_packages(),
|
packages=setuptools.find_packages(),
|
||||||
install_requires=meta.requirements,
|
install_requires=[
|
||||||
|
'markdown',
|
||||||
|
'matplotlib',
|
||||||
|
'numpy',
|
||||||
|
],
|
||||||
package_data={
|
package_data={
|
||||||
'': ['Static/*'], # 这将包含static文件夹下的所有子文件夹和文件
|
'': ['Static/*'], # 这将包含static文件夹下的所有子文件夹和文件
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user