Compare commits

..

12 Commits
V3.2.9 ... main

Author SHA1 Message Date
e8c8d5b530 3.4.6 更新README
Some checks are pending
Publish to PyPI on main branch update / build_and_publish (push) Waiting to run
2024-11-23 19:34:13 +08:00
8b828944c3 3.4.5 更新match-case 2024-11-23 19:29:30 +08:00
890b5d8c33 3.4.5 更新match-case 2024-11-23 19:29:22 +08:00
fefa0ad1b5 3.4.4 优化
Some checks are pending
Publish to PyPI on main branch update / build_and_publish (push) Waiting to run
2024-11-22 19:50:34 +08:00
dd9f7d2efb 3.4.3 自定义InlineHilite扩展成功 2024-11-22 19:37:10 +08:00
bbc729f1c3 3.4.2 自定义InlineHilite扩展成功
Some checks are pending
Publish to PyPI on main branch update / build_and_publish (push) Waiting to run
2024-11-21 19:03:57 +08:00
b4d4fff952 3.4.1 emm自定义InlineHilite扩展 2024-11-19 19:27:42 +08:00
dd01c2b57e 3.4 emm自定义InlineHilite扩展有点问题 2024-11-16 18:10:07 +08:00
5ab56b2e8b 3.3.2 添加警告
Some checks failed
Publish to PyPI on main branch update / build_and_publish (push) Has been cancelled
2024-11-08 19:20:21 +08:00
1b22d1fc80 3.3.1 支持KBD
Some checks failed
Publish to PyPI on main branch update / build_and_publish (push) Has been cancelled
2024-11-06 19:42:57 +08:00
1b11504238 3.2.10 小改动
Some checks are pending
Publish to PyPI on main branch update / build_and_publish (push) Waiting to run
2024-11-05 19:47:39 +08:00
8a8422ea81 更新 .gitea/workflows/pypi.yaml
Some checks failed
Publish to PyPI on main branch update / build_and_publish (push) Has been cancelled
2024-11-02 13:53:25 +08:00
10 changed files with 190 additions and 141 deletions

View File

@ -1,31 +1,29 @@
name: Upload Python Package name: Publish to PyPI on main branch update
on: on:
release: push:
types: [published] branches:
- main
permissions:
contents: read
jobs: jobs:
deploy: build_and_publish:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - name: Checkout code
uses: actions/checkout@v3
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v3 uses: actions/setup-python@v4
with: with:
python-version: '3.11' python-version: '3.11' # 指定你需要的Python版本
- name: Install dependencies - name: Install dependencies
run: | run: |
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip install build pip install setuptools wheel twine
- name: Build package - name: Build package
run: python -m build run: python setup.py sdist bdist_wheel
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 - name: Publish to PyPI
with: run: |
user: __token__ twine upload -u __token__ -p ${{ secrets.PYPI_TOKEN }} dist/*
password: pypi-AgEIcHlwaS5vcmcCJDYxNjk2MzExLTg2NjMtNDUwNi1hMTQ0LTM2NDkxY2U1NjExYwACKlszLCIwNmJkMmFkZS1hYjkxLTQ0MWMtOWM1ZC02MmE0OTc3NTc5Y2EiXQAABiD_N8XZktPwthdp9dRpkpm7dIEh3eVbSr-X6H_OS8OzDw

View File

@ -10,4 +10,7 @@
<orderEntry type="jdk" jdkName="Python 3.11 (CrossDown)" jdkType="Python SDK" /> <orderEntry type="jdk" jdkName="Python 3.11 (CrossDown)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
</component> </component>
<component name="PackageRequirementsSettings">
<option name="versionSpecifier" value="大于或等于 (&gt;=x.y.z)" />
</component>
</module> </module>

View File

@ -2,16 +2,16 @@
核心代码 核心代码
""" """
import re import re
import xml import xml
from typing import * from typing import *
import markdown.core
from markdown import Markdown from markdown import Markdown
from markdown.blockprocessors import BlockProcessor from markdown.blockprocessors import BlockProcessor
from markdown.extensions import Extension, meta, toc, wikilinks, legacy_attrs from markdown.extensions import Extension, meta, toc, wikilinks, legacy_attrs
from markdown.inlinepatterns import InlineProcessor from markdown.inlinepatterns import InlineProcessor
from markdown.preprocessors import Preprocessor
from pymdownx.arithmatex import ArithmatexExtension from pymdownx.arithmatex import ArithmatexExtension
from pymdownx.blocks import BlocksExtension from pymdownx.blocks import BlocksExtension
@ -37,7 +37,13 @@ from pymdownx.tilde import DeleteSubExtension
from pymdownx.magiclink import MagiclinkExtension from pymdownx.magiclink import MagiclinkExtension
from pymdownx.pathconverter import PathConverterExtension from pymdownx.pathconverter import PathConverterExtension
from .Define import Variable import kbdextension
import markdown_gfm_admonition
from xml.etree.ElementTree import ElementTree
Variable = dict[str, str | tuple[str], list[str]] | None
class Simple(InlineProcessor): class Simple(InlineProcessor):
@ -54,8 +60,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[None, None, None]): tuple[None, None, None]):
""" """
处理匹配 处理匹配
:param m: re模块的匹配对象 :param m: re模块的匹配对象
@ -84,8 +90,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[None, None, None]): tuple[None, None, None]):
""" """
处理匹配 处理匹配
:param m: re模块的匹配对象 :param m: re模块的匹配对象
@ -105,7 +111,7 @@ class ID(InlineProcessor):
需要对HTML标签设置ID实现的样式 需要对HTML标签设置ID实现的样式
""" """
def __init__(self, pattern: str, tag: str, property_: str, value: Union[str, bool] = None): def __init__(self, pattern: str, tag: str, property_: str, value: str | bool = None):
""" """
初始化 初始化
:param pattern: 正则表达式 :param pattern: 正则表达式
@ -118,8 +124,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[None, None, None]): tuple[None, None, None]):
""" """
处理匹配 处理匹配
:param m: re模块的匹配对象 :param m: re模块的匹配对象
@ -146,7 +152,7 @@ class Syllabus(BlockProcessor):
""" """
return re.match(self.syllabus_re, block) return re.match(self.syllabus_re, block)
def run(self, parent: xml.etree.ElementTree.Element, blocks: List[str]) -> bool | None: def run(self, parent: xml.etree.ElementTree.Element, blocks: list[str]) -> bool | None:
""" """
对匹配到的块进行处理 对匹配到的块进行处理
:param parent: 当前块的Element对象 :param parent: 当前块的Element对象
@ -161,44 +167,6 @@ class Syllabus(BlockProcessor):
return False return False
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 BasicExtension(Extension): class BasicExtension(Extension):
""" """
渲染基本样式 渲染基本样式
@ -219,15 +187,32 @@ class BasicExtension(Extension):
md.parser.blockprocessors.register(Syllabus(md.parser), 'syllabus', 182) # 渲染提纲 md.parser.blockprocessors.register(Syllabus(md.parser), 'syllabus', 182) # 渲染提纲
class AnchorExtension(Extension): class InlineCode:
def extendMarkdown(self, md: Markdown): def __init__(self, variable: Variable):
""" self.variable = variable
添加扩展
:param md: 转换器 def __call__(self, source: str, language: str, css_class: str, md: markdown.core.Markdown): # 自定义的单行代码格式化器
""" if language != '': # 调用默认格式化函数
md.registerExtension(self) # 注册扩展 return md.inlinePatterns['backtick'].highlight_code(
md.inlinePatterns.register(Anchor(r'\{{#([^{}#]+)}}'), 'anchor', 0) # 定义锚点 src=source, language=language, classname=css_class,
md.inlinePatterns.register(LinkLine(r'\{{([^{}#]+)}}'), 'line_link', 0) # 添加页内链接 md=md
)
try: # 尝试拆分字符串
sources: tuple[str, str, str, str] = re.compile(r'(\{)([#-]?)(.*?)(})').match(source).groups()
except AttributeError: # 不符合格式
return ''
match sources:
case '{', '#', archer, '}': # 匹配到{#锚点}
return f'<span id="{archer}">{archer}</span>'
case '{', '-', inline_link, '}': # 匹配到{-行内链接}
return f'<a href=#{inline_link}>{inline_link}</a>'
case '{', '', variable, '}': # 匹配到{变量}
if variable in self.variable:
return f'<span class="block">{self.variable[variable]}</span>'
else:
return f'<span class="block">{variable}</span>'
case _:
return f'<code>{source}</code>'
Extensions = { Extensions = {
@ -244,8 +229,8 @@ Extensions = {
{ {
'name': 'mermaid', 'name': 'mermaid',
'class': 'mermaid', 'class': 'mermaid',
'format': fence_div_format 'format': fence_div_format,
} },
] ]
}, },
}), }),
@ -258,7 +243,6 @@ Extensions = {
'标签': TabExtension(), '标签': TabExtension(),
'批评': CriticExtension(), '批评': CriticExtension(),
'代码高亮': HighlightExtension(), '代码高亮': HighlightExtension(),
'行内高亮': InlineHiliteExtension(),
'按键风格': KeysExtension(), '按键风格': KeysExtension(),
'高亮': MarkExtension(), '高亮': MarkExtension(),
'进度条': ProgressBarExtension(), '进度条': ProgressBarExtension(),
@ -271,13 +255,16 @@ Extensions = {
'超级链接': MagiclinkExtension(), '超级链接': MagiclinkExtension(),
'路径转换器': PathConverterExtension(), '路径转换器': PathConverterExtension(),
# 其它
'KBD': kbdextension.KbdExtension(),
'GFM 警告': markdown_gfm_admonition.GfmAdmonitionExtension(),
# 自定义 # 自定义
'基本风格': BasicExtension(), '基本风格': BasicExtension(),
'锚点': AnchorExtension(),
} }
def main(text: str, variable: Variable = None) -> Tuple[str, Variable]: def main(text: str, variable: Variable = None) -> tuple[str, Variable]:
""" """
主函数 主函数
:param text: 输入文本 :param text: 输入文本
@ -286,5 +273,15 @@ 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

View File

@ -1,4 +0,0 @@
from typing import *
Variable = Dict[str, Union[str, Tuple[str], List[str]]] | None

View File

@ -1,12 +1,14 @@
from typing import * from typing import *
import pickle import pickle
from .Core import main from .Core import main, Variable, Syllabus
__all__ = [ __all__ = [
'main', # 主函数 'main', # 主函数
'indent', # 添加空格 'indent', # 添加空格
'HEAD', # HTML头部引用 'HEAD', # HTML头部引用
'Meta', # 元数据处理器 'Meta', # 元数据处理器
'Syllabus', # 提纲扩展
'Variable', # 变量类型提示
] ]
__version__ = '0.11.2' __version__ = '0.11.2'
__author__ = 'CrossDark' __author__ = 'CrossDark'

View File

@ -61,11 +61,11 @@
</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>
<li><a href="#4.1">4.1 单行</a><ul> <li><a href="#4.1">4.1</a><ul>
<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>
@ -132,12 +132,20 @@
</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>
<p>效果请见<README.html></p> <p>效果请见<kbd>README.html</kbd></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> <p>安装:<code class="highlight">pip3<span class="w"> </span>install<span class="w"> </span>--index-url<span class="w"> </span>https://crossdark.net/api/packages/CrossDark/pypi/simple/<span class="w"> </span>CrossDown</code></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>
@ -166,7 +174,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="&#109;&#97;&#105;&#108;&#116;&#111;&#58;&#108;&#105;&#117;&#104;&#97;&#110;&#98;&#111;&#51;&#51;&#51;&#64;&#105;&#99;&#108;&#111;&#117;&#100;&#46;&#99;&#111;&#109;">&#108;&#105;&#117;&#104;&#97;&#110;&#98;&#111;&#51;&#51;&#51;&#64;&#105;&#99;&#108;&#111;&#117;&#100;&#46;&#99;&#111;&#109;</a></p> <p><a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;&#108;&#105;&#117;&#104;&#97;&#110;&#98;&#111;&#51;&#51;&#51;&#64;&#105;&#99;&#108;&#111;&#117;&#100;&#46;&#99;&#111;&#109;">&#108;&#105;&#117;&#104;&#97;&#110;&#98;&#111;&#51;&#51;&#51;&#64;&#105;&#99;&#108;&#111;&#117;&#100;&#46;&#99;&#111;&#109;</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>
@ -179,26 +186,27 @@
<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><span id="锚点">锚点</span></p>
<h2 id="3.2">3.2 页内链接</h2> <h2 id="3.2">3.2 链接</h2>
<p><a href="#锚点名">锚点</a></p> <p><a href=#锚点>锚点</a></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 </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>
<p>The mock shebang will be treated like text here: <code>#!js var test = 0;</code>.</p> <p>The mock shebang will be treated like text here: .</p>
<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> <sup>3</sup>H<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> // 不定义范围</p>
<p><code>¥y=x**2¥€-50,50€</code> // 定义了x范围</p> <p> // 定义了x范围</p>
<p><code>¥y=x**3¥€-50,50|-100,100€</code> // 定义了y范围</p> <p> // 定义了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> <h3 id="4.1.4">4.1.4 突出</h3>
<p><code>{突出内容}</code></p> <p><span class="block">突出内容</span></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>
@ -208,10 +216,7 @@
<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> <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">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>
@ -219,9 +224,6 @@
<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>
@ -311,7 +313,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>提纲号会被自动配置为锚点,可直接使用<a href="#7">7</a><a href="#7.1">7.1</a></p> <p>提纲号会被自动配置为锚点,可直接使用<a href=#7>7</a> <a href=#7.1>7.1</a> <em>这种情况中间必须有间隔</em></p>
<h1 id="8">8 注释</h1> <h1 id="8">8 注释</h1>
<!-- 这是注释 --> <!-- 这是注释 -->
@ -352,7 +354,7 @@
<li>c</li> <li>c</li>
</ul> </ul>
</dd> </dd>
<dt><code>{强调变量}</code></dt> <dt><span class="block">强调值</span></dt>
<dd> <dd>
<ul> <ul>
<li>a</li> <li>a</li>
@ -546,7 +548,7 @@
</div> </div>
</p> </p>
<h1 id="15">15 内部链接</h1> <h1 id="15">15 内部链接</h1>
<p><a class="wikilink" href="/Bracketed/">Bracketed</a></p> <p><kbd>Bracketed</kbd></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>
@ -620,5 +622,31 @@
<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>

View File

@ -9,9 +9,9 @@ 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 安装:`#!bash pip3 install --index-url https://crossdark.net/api/packages/CrossDark/pypi/simple/ CrossDown`
1 基本语法 1 基本语法
@ -60,8 +60,6 @@ ___
[CrossDark](https://crossdark.com) [CrossDark](https://crossdark.com)
<https://crossdark.net/>
https://crossdark.net/ https://crossdark.net/
liuhanbo333@icloud.com liuhanbo333@icloud.com
@ -92,11 +90,11 @@ liuhanbo333@icloud.com
3.1 定义 3.1 定义
{{#锚点名}} `{#锚点}`
3.2 页内链接 3.2 链接
{{锚点名}} `{-锚点}`
4 代码块 4 代码块
@ -127,6 +125,8 @@ $\lg\left(\frac{目标生物的理智值}{稳定折磨型工具人的理智值}\
++ctrl+alt+delete++ ++ctrl+alt+delete++
[[Enter]]
4.1.4 突出 4.1.4 突出
`{突出内容}` `{突出内容}`
@ -144,9 +144,6 @@ B:
- a - a
- b - b
- c - c
{[强调变量]}:
- a
- b
``` ```
4.2.2 Python 4.2.2 Python
@ -246,7 +243,7 @@ def main():
7..1...4 错误示范 7..1...4 错误示范
提纲号会被自动配置为锚点,可直接使用{{7}}{{7.1}} 提纲号会被自动配置为锚点,可直接使用`{-7}` `{-7.1}` *这种情况中间必须有间隔*
8 注释 8 注释
@ -498,3 +495,30 @@ 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.

BIN
data.pkl

Binary file not shown.

View File

@ -6,3 +6,4 @@ CrossDown>=2.2.0
setuptools~=70.1.1 setuptools~=70.1.1
emoji~=2.13.2 emoji~=2.13.2
pymdown-extensions>=10.12 pymdown-extensions>=10.12
kbdextension>=1.0.1

View File

@ -2,7 +2,7 @@ import setuptools
from CrossDown import Meta from CrossDown import Meta
meta = Meta(3, 2, 9) meta = Meta(3, 4, 5)
setuptools.setup( setuptools.setup(
name="CrossDown", name="CrossDown",