Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Support Curly Brackets for Code Block #156

Open
j9ac9k opened this issue Jan 19, 2017 · 6 comments
Open

Feature Request: Support Curly Brackets for Code Block #156

j9ac9k opened this issue Jan 19, 2017 · 6 comments

Comments

@j9ac9k
Copy link

j9ac9k commented Jan 19, 2017

Attached image to highlight what I mean

example

Ideally, there would be support for Stitch, which would include some other code chunk options such as echo=False and so on.

@jonschlinkert
Copy link
Owner

I'd be open to discussing this, but someone with more knowledge of ST would need to implement the code chunk handling. How useful would this be without that?

@j9ac9k
Copy link
Author

j9ac9k commented Mar 2, 2017

So I managed to modify the .sublime-syntax file (basically changed the regular expression that does the matching to get this working, but my fix is definitely far from ideal).

I changed line 160 460 of the .sublime-syntax file to:

    - match: '(```|~~~|{%\s*highlight)\s*{?(python)}?\s*((?:linenos\s*)?%})?$'

So basically I just made the curly brackets option using the ?regular expression symbol. I could try and modify the regular expression to look for the curly brackets in pairs (but make them optional, but they need to be a pair of open and closed.

I guess, ideally, there would be more pandoc functionality, however this library is not meant to support pandoc necessarily ..thats just my use case.

@HenrikEckermann
Copy link

@jonschlinkert 👍
Thanks for your work man!

Regarding this issue:
knitr will soon enable that Python code chunks can be used like r code chunks. This possible now but the memory is not kept between code cells, which makes it useless for scientific reporting (unless you really want to import/export files again and again.

So, many people including myself will then use rmakdown also for python as primary reporting tool. For that work really well the curly brackets are necessary because on with them you can control output through knitr. So, it would be very nice if this could be added somehow.

@j9ac9k , did the above fix just work for you without any issues?

@j9ac9k
Copy link
Author

j9ac9k commented Dec 20, 2017

@HenrikEckermann I haven't been doing as much markdown with python work recently for my academic work, but the regular expression adjustment I made before did fix my issue at the time, but I didn't attempt to pass in any of the other optional parameters (like echo=False, include=True), which I imagine won't work at all.

Given that RMarkdown has lots of overlap with Pandoc flavored markdown, I'm not sure if Markdown Extended is the right plugin to expect to use with RMarkdown. The package maintainers have been resistant to implementing the YAML header and other features that are unique to Pandoc flavored markdown/RMarkdown.

#128

#169

@HenrikEckermann
Copy link

Thanks man! Do you maybe have any other suggestions which package to use then if I am used to Rmarkdown? I guess I have to stick with Rmarkdown if I want to use knitr, right? Let me know if you know a better package for that.

@j9ac9k
Copy link
Author

j9ac9k commented Dec 20, 2017

I typically have been using Pandoc more so than RMarkdown/Knitr, so my workflow has been structured to go around that.... but when I was doing Knitr related work, I would break it up into using this extension for getting most of the contents/code in place, then would use RStudio for the rest, not ideal but it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants