andrewheiss / SublimeKnitr

Plugin that adds knitr Markdown and LaTeX support in Sublime Text 2 and 3
71 stars 11 forks source link

Support user-defined Markdown and Latex language definitions (e.g. from #8

Open jlegewie opened 11 years ago

jlegewie commented 11 years ago

Hi,

I am using my own Markdown language definition, which I adopted from Byworded. Is there a way to use the Markdown language/theme file set by the user and just add the extensions for knitr such as the code snippets?

Thanks!

andrewheiss commented 11 years ago

In theory it should already be doing this. Near the end of the .tmLanguage file there's this key:

<dict>
    <key>comment</key>
    <string>Import any other Markdown syntaxes.</string>
    <key>include</key>
    <string>text.html.markdown</string>
</dict>

Which should import any other Markdown syntax definitions you have. The only stuff included in this .tmLangauge file deals with chunks and code blocks and Pandoc-style metadata (since that's what knitr uses), so the rest of the Markdown stuff should come from other files.

You may need to add Rmd as an acceptable file type in your custom Markdown language definition. Near the top of your definition you should have a fileTypes key. Make sure Rmd is included. That should get it working.

<key>fileTypes</key>
<array>
    <string>md</string>
    <string>Rmd</string>
</array>
jlegewie commented 11 years ago

I guess I should have been more specific. In my Markdown.sublime-settings file, I have set an option "color_scheme": "Packages/Markdown/Byworded Light-edit.tmTheme". I did the same now for my knitr-Markdown.sublime-settings and now it's using my markdown highlighting. The code blocks, however, just look like normal text. Is that intentional or do I get my R code highlighting within Rmd files?