fix MicroTeX和cmark-gfm共存编译
This commit is contained in:
parent
5247485491
commit
8874cf2462
3
3rdparty/MicroTeX/src/fonts/fonts.cpp
vendored
3
3rdparty/MicroTeX/src/fonts/fonts.cpp
vendored
@ -1,11 +1,10 @@
|
|||||||
#include "fonts/fonts.h"
|
#include "fonts/fonts.h"
|
||||||
|
#include "../render.h"
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "fonts/symbol_reg.h"
|
#include "fonts/symbol_reg.h"
|
||||||
#include "graphic/graphic.h"
|
#include "graphic/graphic.h"
|
||||||
#include "render.h"
|
|
||||||
#include "res/parser/font_parser.h"
|
#include "res/parser/font_parser.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|||||||
9
3rdparty/cmark-gfm/src/buffer.h
vendored
9
3rdparty/cmark-gfm/src/buffer.h
vendored
@ -9,6 +9,15 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "cmark-gfm.h"
|
#include "cmark-gfm.h"
|
||||||
|
|
||||||
|
// 添加 CMARK_INLINE 的定义(如果需要)
|
||||||
|
#ifndef CMARK_INLINE
|
||||||
|
#if defined(_MSC_VER) && !defined(__cplusplus)
|
||||||
|
#define CMARK_INLINE __inline
|
||||||
|
#else
|
||||||
|
#define CMARK_INLINE inline
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -62,9 +62,9 @@ include_directories(${JSON}/include)
|
|||||||
find_package(CURL REQUIRED)
|
find_package(CURL REQUIRED)
|
||||||
|
|
||||||
#cmark-gfm
|
#cmark-gfm
|
||||||
#add_subdirectory(${PROJECT_SOURCE_DIR}/3rdparty/cmark-gfm)
|
add_subdirectory(${PROJECT_SOURCE_DIR}/3rdparty/cmark-gfm)
|
||||||
#include_directories(${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/cmark-gfm/src)
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/cmark-gfm/src)
|
||||||
#include_directories(${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/cmark-gfm/extensions)
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/cmark-gfm/extensions)
|
||||||
|
|
||||||
#MicroTeX
|
#MicroTeX
|
||||||
add_subdirectory(${PROJECT_SOURCE_DIR}/3rdparty/MicroTeX)
|
add_subdirectory(${PROJECT_SOURCE_DIR}/3rdparty/MicroTeX)
|
||||||
@ -148,9 +148,10 @@ target_link_libraries(
|
|||||||
Qt6::Gui
|
Qt6::Gui
|
||||||
Qt6::Widgets
|
Qt6::Widgets
|
||||||
CURL::libcurl
|
CURL::libcurl
|
||||||
#libcmark-gfm_static
|
|
||||||
#libcmark-gfm-extensions_static
|
|
||||||
LaTeX
|
LaTeX
|
||||||
|
libcmark-gfm_static
|
||||||
|
libcmark-gfm-extensions_static
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -208,8 +208,9 @@ void ctaiHistoryTextEdit::on_display_changed(QString mode)
|
|||||||
}
|
}
|
||||||
else if (mode == "LaTeX Markdown")
|
else if (mode == "LaTeX Markdown")
|
||||||
{
|
{
|
||||||
m_msg_history->setMarkdown(m_math_convert->replace_tags_svg(m_current_content));
|
m_msg_history->setHtml(m_math_convert->replace_tags_svg(m_current_content));
|
||||||
qDebug() << "LaTeX Markdown:" << m_msg_history->toMarkdown();
|
qDebug() << "LaTeX Markdown:" << m_msg_history->toMarkdown();
|
||||||
|
qDebug() << "Html:" << m_msg_history->toHtml();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// tokens按钮实现功能的槽函数
|
// tokens按钮实现功能的槽函数
|
||||||
|
|||||||
@ -100,11 +100,12 @@ QString ctaiMathConvert::replace_tags_svg(const QString &text)
|
|||||||
debug_latex_match(result, match);
|
debug_latex_match(result, match);
|
||||||
// 清理和转换公式
|
// 清理和转换公式
|
||||||
//QString cleanFormula = clean_latex_for_mula(matchedText);
|
//QString cleanFormula = clean_latex_for_mula(matchedText);
|
||||||
QString svg_markdown = markdown_base + math_convert_svg(matchedText) + ")";
|
//QString svg_markdown = markdown_base + math_convert_svg(matchedText) + ")";
|
||||||
//QString svg_html = html_base + math_convert_svg(matchedText) + "/>";
|
QString svg_html = html_base + math_convert_svg(matchedText) + "/>";
|
||||||
// 保存替换信息
|
// 保存替换信息
|
||||||
replacements.prepend({match.capturedStart(), match.capturedLength()});
|
replacements.prepend({match.capturedStart(), match.capturedLength()});
|
||||||
svgResults.prepend(svg_markdown);
|
//svgResults.prepend(svg_markdown);
|
||||||
|
svgResults.prepend(svg_html);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 从后向前执行替换,避免位置改变影响
|
// 从后向前执行替换,避免位置改变影响
|
||||||
|
|||||||
@ -1,8 +1,13 @@
|
|||||||
#ifndef CTAIMATHCONVERT_H
|
#ifndef CTAIMATHCONVERT_H
|
||||||
#define CTAIMATHCONVERT_H
|
#define CTAIMATHCONVERT_H
|
||||||
|
|
||||||
#include "latex.h"
|
// 然后包含 cmark-gfm 相关头文件
|
||||||
#include "platform/qt/graphic_qt.h"
|
#include "cmark-gfm.h"
|
||||||
|
#include "cmark-gfm-extension_api.h"
|
||||||
|
#include "cmark-gfm-core-extensions.h"
|
||||||
|
|
||||||
|
// Qt 相关头文件
|
||||||
|
#include <QObject>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
@ -11,9 +16,13 @@
|
|||||||
#include <QUuid>
|
#include <QUuid>
|
||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
#include <QRegularExpressionMatchIterator>
|
#include <QRegularExpressionMatchIterator>
|
||||||
|
|
||||||
|
// LaTeX 相关头文件
|
||||||
|
#include "latex.h"
|
||||||
|
#include "platform/qt/graphic_qt.h"
|
||||||
|
|
||||||
|
// 项目相关头文件
|
||||||
#include "ctai_base.h"
|
#include "ctai_base.h"
|
||||||
#include <regex>
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
class TexGuard {
|
class TexGuard {
|
||||||
public:
|
public:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user