document-outline icon indicating copy to clipboard operation
document-outline copied to clipboard

Cannot get R Markdown (*.Rmd) working with document-outline!

Open stefanstro opened this issue 7 years ago • 2 comments

Good Morning Sir or Madam,

I have a tried to get the document-outline working for R Markdown (*.Rmd) files for a few hours now, but I could net get it working. Everything else, like spell checking, is working fine. Where am I supposed to add the grammar (text.knitr?) ?

Any hints would be greatly appreciated, Stefan from Germany

stefanstro avatar Dec 12 '18 05:12 stefanstro

I am facing the same problem. I overcome this by setting the Grammar to GitHub Markdown but I think it would make sense to include Rmd files in the list of types supported.

Anyway, thanks for this very helpful package!

KevCaz avatar Dec 20 '18 16:12 KevCaz

A temporary solution is to manually add the source.gfm.rmd grammar to the package.

This can be done by adding it in the lib/ > document-outline.js file, as shown in the following code chunk (to bring up the package files, go to Settings in Atom > Packages > Document outline and click on View code).

const MODEL_CLASS_FOR_SCOPES = {
  'source.gfm': MarkdownModel,
  'text.md': MarkdownModel,
  'source.gfm.rmd': MarkdownModel,
  'source.weave.md': MarkdownModel,
  'text.tex.latex': LatexModel,
  'text.tex.latex.beamer': LatexModel,
  'text.tex.latex.knitr': LatexModel,
  'text.knitr': LatexModel,
  'text.restructuredtext': ReStructuredTextModel,
  'source.asciidoc': AsciiDocModel
};

This fix gets overwritten when updating the package.

stefanocoretta avatar Feb 05 '20 12:02 stefanocoretta