Вопрос

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.]

Это было полезно?

Решение

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
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top