如何将 pandoc 设置为“编译器”? SciTE 中的 Markdown 文件?

发布于 2024-12-07 22:00:59 字数 619 浏览 0 评论 0原文

我最近开始用 Markdown 写东西,并在 SciTE 中编辑我的文件。我在 Windows 中工作,因此这意味着我在写作过程的各个阶段同时运行 Windows 命令提示符来生成输出文件。

我主要以相同的格式输出文件,并且使用基本相同的命令行开关切换到 pandoc。例如,我常用的命令看起来像这样:

pandoc [flags] -o output.html input.markdown

为了清楚起见,我省略了常用的标志。

有没有办法设置 SciTE 来识别我用于 Markdown 文件的文件扩展名,并将其配置为使用类似这样的命令字符串“编译”文件?

最终,如果可能的话,我还想设置“构建”选项来通过 markdown2pdf 运行该文件,也许(如果我真的很幸运)有一天弄清楚如何配置 Go 来启动 HTML 文件来自运行“编译”命令...

[编辑:我将其发布在 TEX StackExchange 站点 同样,也许那是一个更好的地方。]

I've begun writing stuff in markdown lately, and edit my files in SciTE. I work in Windows, so this means I'm simultaneously running a Windows command prompt to generate output files at various stages of my writing process.

I mostly output my files in the same format, and with basically the same command line switches to pandoc. For instance, my usual command looks something like this:

pandoc [flags] -o output.html input.markdown

I've omitted my usual flags for clarity.

Is there any way to set up SciTE to recognize the file extension I'm using for markdown files and configure it to "Compile" the file with a command string something like this?

Ultimately, if this is possible I'd also like to set the "Build" option to run the file through markdown2pdf as well, and maybe (if I'm really lucky) someday figure out how to configure Go to launch the HTML file that comes from running the "compile" command...

[Edit: I posted this over on the TEX StackExchange site as well, perhaps that's a better place.]

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

抱猫软卧 2024-12-14 22:00:59

这不是一个完整的 Markdown 模式,但它是完成你想要的事情的一个很好的例子。

您可以将此文件作为 markdown.properties 添加到 /usr/share/scite 中:

# Define SciTE settings for Markdown files.

file.patterns.markdown=*.md;*.markdown

filter.markdown=Markdown (md markdown)|$(file.patterns.markdown)|

command.compile.$(file.patterns.markdown)=pandoc -o "$(FileName).html" "$(FileNameExt)"
command.go.$(file.patterns.markdown)=pandoc -o "$(FileName).html" "$(FileNameExt)" && firefox "$(FileName).html"

然后您还需要应用此补丁,如下所示:patch -p1 < SciTEGlobal.properties.patch

Changes in master
    Modified SciTEGlobal.properties
diff --git a/SciTEGlobal.properties b/SciTEGlobal.properties
index 1f41382..456ac2a 100644
--- a/SciTEGlobal.properties
+++ b/SciTEGlobal.properties
@@ -294,7 +294,7 @@ chars.accented=
 source.files=*.asm;*.c;*.cc;*.cpp;*.cxx;*.cs;*.h;*.hh;*.hxx;*.hpp;\
 *.idl;*.odl;*.rc;*.rc2;*.dlg;*.def;\
 *.vb;*.vbs;*.bas;*.frm;*.cls;*.ctl;\
-*.java;*.js;*.py;*.pl;*.rb;*.cgi;*.lua;*.conf;\
+*.java;*.js;*.py;*.pl;*.rb;*.cgi;*.lua;*.md;*.markdown;*.conf;\
 make*;*.mak;\
 *.properties;*.html;*.xml;*.iface;*.bat;*.e

@@ -330,6 +330,7 @@ $(filter.kix)\
 $(filter.lout)\
 $(filter.lua)\
 $(filter.matlab)\
+$(filter.markdown)\
 $(filter.metapost)\
 $(filter.mmixal)\
 #$(filter.modula3)\
@@ -508,6 +509,7 @@ Lisp|lisp||\
 Lu&a|lua||\
 Matlab|m.matlab||\
 &Makefile|mak|Ctrl+Shift+F11|\
+Markdown|markdown||\
 #MetaPost|mp||\
 #MMIXAL|mms||\
 #Modula-3|m3||\
@@ -590,6 +592,7 @@ import lot
 #import lout
 import lua
 import matlab
+import markdown
 import metapost
 import mmixal
 #import modula3

This is not a full Markdown mode, but it is a good example to accomplish what you want.

You can add this file to /usr/share/scite as markdown.properties:

# Define SciTE settings for Markdown files.

file.patterns.markdown=*.md;*.markdown

filter.markdown=Markdown (md markdown)|$(file.patterns.markdown)|

command.compile.$(file.patterns.markdown)=pandoc -o "$(FileName).html" "$(FileNameExt)"
command.go.$(file.patterns.markdown)=pandoc -o "$(FileName).html" "$(FileNameExt)" && firefox "$(FileName).html"

Then you'll also need to apply this patch like so: patch -p1 < SciTEGlobal.properties.patch

Changes in master
    Modified SciTEGlobal.properties
diff --git a/SciTEGlobal.properties b/SciTEGlobal.properties
index 1f41382..456ac2a 100644
--- a/SciTEGlobal.properties
+++ b/SciTEGlobal.properties
@@ -294,7 +294,7 @@ chars.accented=
 source.files=*.asm;*.c;*.cc;*.cpp;*.cxx;*.cs;*.h;*.hh;*.hxx;*.hpp;\
 *.idl;*.odl;*.rc;*.rc2;*.dlg;*.def;\
 *.vb;*.vbs;*.bas;*.frm;*.cls;*.ctl;\
-*.java;*.js;*.py;*.pl;*.rb;*.cgi;*.lua;*.conf;\
+*.java;*.js;*.py;*.pl;*.rb;*.cgi;*.lua;*.md;*.markdown;*.conf;\
 make*;*.mak;\
 *.properties;*.html;*.xml;*.iface;*.bat;*.e

@@ -330,6 +330,7 @@ $(filter.kix)\
 $(filter.lout)\
 $(filter.lua)\
 $(filter.matlab)\
+$(filter.markdown)\
 $(filter.metapost)\
 $(filter.mmixal)\
 #$(filter.modula3)\
@@ -508,6 +509,7 @@ Lisp|lisp||\
 Lu&a|lua||\
 Matlab|m.matlab||\
 &Makefile|mak|Ctrl+Shift+F11|\
+Markdown|markdown||\
 #MetaPost|mp||\
 #MMIXAL|mms||\
 #Modula-3|m3||\
@@ -590,6 +592,7 @@ import lot
 #import lout
 import lua
 import matlab
+import markdown
 import metapost
 import mmixal
 #import modula3
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文