Adds snippets and syntax highlighting for reStructuredText files (.rst
/.rest
).
Originally converted from the reStructuredText TextMate bundle.
Contributions are greatly appreciated.
A ReStructuredText syntax package for Atom
License: MIT License
Adds snippets and syntax highlighting for reStructuredText files (.rst
/.rest
).
Originally converted from the reStructuredText TextMate bundle.
Contributions are greatly appreciated.
content
snippet like below :
..content:: title
:depth: 2
there is no spacing between double dot and directive 'content'.
Hi,
highlight of rST syntax stopped working in my Atom, while e.g. completion of directives works just fine.
I guess it could be a conflict with some other community package. Could you please investigate?
I suspect one of those highlight packages (listed below).
Do you have a list of conflicting packages? Just an idea... :)
Atom version: 1.40.1
Community packages installed: badges, busy-signal, highlight-line, highlight-nbsp, intentions, language-latex, language-restructuredtext, linter, linter-ui-default, misc-text-util, pandoc, project-viewer, quick-highlight, rst-preview-pandoc, simple-drag-drop-text, text-tools, underline, xml-tools
It would nice to have the ability to highlight multiple lines and then press alt + / to add a ..
at the beginning of each line that is highlighted
When I use the section snippets, I type sec
, hit tab and then see:
subsection name
${1/(.)|\s/(?1:=:=)/g}
If I continue typing, it replaces "subsection name" with what I type as expected, but the second line just looks like a regular expression.
I first searched for rst in atom, and the plugin is not shown. Might be useful to add rest / rst to the description to make it easier to find.
If I add a link in running text using the snippet, e.g. My homepage is at lin<Tab>
, there are several issues. First, the snippet starts with a newline, so it autofills to
My homepage is at
`Title<http://link>`_
which does not look like it's desired.
Second, there is no space between Title
and <
, which apparently is illegal link markup, so when I fill out the link with bar<Tab>foo.com
, my Sphinx complains with ERROR: Unknown target name: "bar<foo.com>".
:-( Adding a space after bar
fixes the issue, so this probably should be made part of the snippet?
Third, after filling the Title and URL, I would have expected another <Tab>
to jump the cursor to after the snippet so that I can continue typing, but this only adds a tab-space after the URL. Am I using this wrong, or is this a bug?
This is with version 0.10.0, on Atom 1.3.0.
e.g. Opening this file https://github.com/peterjc/galaxy_blast/blob/2c44d9e2346b18ebb0046121dbb44e4189a6d6ff/README.rst in Atom with default settings the URLs are in purple, however, there is a problem when there is an underscore in the URL, e.g.
...
The main focus of this work is the development of the NCBI BLAST+ command line
tool wrappers and datatype definitions for Galaxy, published on the Galaxy
Tool Shed here:
* http://toolshed.g2.bx.psu.edu/view/devteam/ncbi_blast_plus/
* http://toolshed.g2.bx.psu.edu/view/devteam/blast_datatypes/
...
Bug Reports
===========
You can file an issue here https://github.com/peterjc/galaxy_blast/issues or ask
us on the Galaxy development list http://lists.bx.psu.edu/listinfo/galaxy-dev
...
Here only http://toolshed.g2.bx.psu.edu/view/devteam/ncbi
is purple, with _blast_plus/
in normal text color. Likewise with the other URLs with an underscore (not just in bullet lists, but also in plain text paragraphs).
Update: Tested with Atom 1.2.4 with language-restructuredtext v0.10.0 under Mac OS X 10.10.5
Is there a way to let these two packages work together to preview .rst
files?
Thanks
Atom Version: 1.9.0-beta0
System: Mac OS X 10.11.2
{
"core": {
"allowPendingPaneItems": false,
"disabledPackages": [
"language-python",
"symbols-tree-view"
],
"ignoredNames": [
".*",
"*~",
"*.pdf",
"*.png",
"*.pyc",
"*.npz"
],
"openEmptyEditorOnStart": false
},
"linter": {}
}
# User
atomic-emacs, v0.9.1 (active)
file-watcher, v0.4.0 (active)
language-cython, v0.3.0 (active)
language-restructuredtext, v0.16.0 (active)
linter, v1.11.7 (active)
linter-flake8, v1.13.0 (active)
linter-markdown, v1.5.2 (active)
MagicPython, v0.5.11 (active)
markdown-scroll-sync, v2.1.2 (active)
markdown-writer, v2.3.4 (inactive)
minimap, v4.24.4 (active)
minimap-cursorline, v0.2.0 (active)
symbols-tree-view, v0.13.2 (inactive)
atom-dark-syntax, v0.27.0 (inactive)
atom-dark-ui, v0.51.0 (inactive)
atom-light-syntax, v0.28.0 (inactive)
atom-light-ui, v0.43.0 (inactive)
base16-tomorrow-dark-theme, v1.1.0 (inactive)
base16-tomorrow-light-theme, v1.1.1 (inactive)
one-dark-ui, v1.3.2 (active)
one-light-ui, v1.3.2 (inactive)
one-dark-syntax, v1.2.0 (active)
one-light-syntax, v1.2.0 (inactive)
solarized-dark-syntax, v1.0.2 (inactive)
solarized-light-syntax, v1.0.2 (inactive)
about, v1.5.2 (active)
archive-view, v0.61.1 (active)
autocomplete-atom-api, v0.10.0 (active)
autocomplete-css, v0.11.1 (active)
autocomplete-html, v0.7.2 (active)
autocomplete-plus, v2.31.0 (active)
autocomplete-snippets, v1.11.0 (active)
autoflow, v0.27.0 (inactive)
autosave, v0.23.1 (active)
background-tips, v0.26.0 (active)
bookmarks, v0.41.0 (active)
bracket-matcher, v0.82.1 (active)
command-palette, v0.38.0 (inactive)
deprecation-cop, v0.54.1 (active)
dev-live-reload, v0.47.0 (active)
encoding-selector, v0.22.0 (active)
exception-reporting, v0.38.1 (active)
fuzzy-finder, v1.2.0 (active)
git-diff, v1.0.1 (active)
find-and-replace, v0.198.0 (inactive)
go-to-line, v0.31.0 (inactive)
grammar-selector, v0.48.1 (active)
image-view, v0.58.0 (active)
incompatible-packages, v0.26.1 (active)
keybinding-resolver, v0.35.0 (active)
line-ending-selector, v0.5.0 (active)
link, v0.31.1 (inactive)
markdown-preview, v0.158.0 (active)
metrics, v0.53.1 (active)
notifications, v0.64.1 (active)
open-on-github, v1.1.0 (inactive)
package-generator, v1.0.0 (inactive)
settings-view, v0.238.0 (active)
snippets, v1.0.2 (active)
spell-check, v0.67.1 (active)
status-bar, v1.3.1 (active)
styleguide, v0.46.0 (active)
symbols-view, v0.113.0 (inactive)
tabs, v0.98.0 (active)
timecop, v0.33.1 (active)
tree-view, v0.208.0 (active)
update-package-dependencies, v0.10.0 (active)
welcome, v0.34.0 (active)
whitespace, v0.32.2 (active)
wrap-guide, v0.38.1 (active)
language-c, v0.52.1 (active)
language-clojure, v0.21.0 (active)
language-coffee-script, v0.47.0 (active)
language-csharp, v0.12.1 (active)
language-css, v0.36.2 (active)
language-gfm, v0.86.0 (active)
language-git, v0.13.0 (active)
language-go, v0.42.0 (active)
language-html, v0.44.1 (active)
language-hyperlink, v0.16.0 (active)
language-java, v0.22.0 (active)
language-javascript, v0.119.0 (active)
language-json, v0.18.0 (active)
language-less, v0.29.3 (active)
language-make, v0.22.2 (active)
language-mustache, v0.13.0 (active)
language-objective-c, v0.15.1 (active)
language-perl, v0.35.0 (active)
language-php, v0.37.0 (active)
language-property-list, v0.8.0 (active)
language-python, v0.45.0 (inactive)
language-ruby, v0.68.5 (active)
language-ruby-on-rails, v0.25.0 (active)
language-sass, v0.52.0 (active)
language-shellscript, v0.22.3 (active)
language-source, v0.9.0 (active)
language-sql, v0.21.1 (active)
language-text, v0.7.1 (active)
language-todo, v0.28.0 (active)
language-toml, v0.18.0 (active)
language-xml, v0.34.8 (active)
language-yaml, v0.26.0 (active)
# Dev
No dev packages
Store package settings files in the settings/
directory instead of scoped-properties/
Package.loadSettings (/Applications/Atom.app/Contents/Resources/app/src/package.js:565:9)
<unknown> (/Applications/Atom.app/Contents/Resources/app/src/package.js:187:43)
The color of the section part used to be green, but changing to white after updating to 0.16.
Is it the intended result?
Window on the right is how markdown code was rendered and it is what I'm expecting.
I'm using
language-restructuredtext 0.16.0
Atom 0.18
Fedora 23
When I type snippets (e.g. the default image
or link
), they will not be completed. From Sublime Text I'm used that you have to explicitly enable snippets for the text scope, but since HTML snippets work in Atom, I don't suspect that's the case. Any idea why they don't work?
Hi, according to the escaping mechanism of reStructuredText, the following text should not be highlighted:
These \*symbols\* should be escaped.
These \*\*too\*\*.
What about \|these\|?
your atom package is marking embedded Python blocks as full Python code (source.python) instead of embedded Python (source.embedded.python)
if you were to open this rst from within Atom:
https://raw.githubusercontent.com/YosaiProject/yosai/master/doc/authorization.rst
scopes at cursor at line 127 shows the following:
text.restructuredtext source.gfm.restructuredtext
meta.paragraph.restructuredtext
source.python
meta.function-call.python
meta.function-call.arguments.python
invalid.illegal.operator.python
please note that I raised this as an issue in the atomlinter project:
AtomLinter/linter-flake8#139 (comment)
Consider the following example .rst file:
Paragraph 1
``monospaced``
.. code-block:: sh
$ cat >py.sh <<EOT
#!/bin/bash
py=$(which python)
$py "$@"
EOT
``monospaced``
Paragraph 2
Atom when using this package highlights this incorrectly. Anything after the <<
gets highlighted in green (same as text in double backquotes). Usage of double backquotes after that does not reset this highlighting.
Screen shot how the above file is highlighted:
When I remove one of the two <
characters, the highlighting is correct again, so this is clearly triggered by the presence of two <<
:
Everything after a java code block containing a method reference is highlighted as if it were java code.
Example of breaking code block:
.. code-block:: java
String someString = getOptionalString().orElseThrow(IllegalArgumentException::new);
Would it be possible to add support for more snippets ? For example, it would be nice to have snippet autocompletion for directives and roles described in this cheatsheet.
Following snippet is valid sphinx, but produce annoying warning highlights.
It considers any of ``\r``, ``\n``, and ``\r\n`` to be newlines.
Because of the ambiguity of an append operation ending in the character ``\r`` (it may be a bare ``\r`` or half of ``\r\n``), the last line of such an append operation will be buffered until the next append or flush.
I stumbled over this issue when I tied to use a code block inside a glossary block.
This compiles just fine with sphinx - but the atom language grammar keeps the syntax highlighting to that language until the next line that begins with no indent.
Same issue when just using indented blocks:
Indented Block...
.. code-block:: java
Point a = new Point();
Other stuff in indented block...
Works fine again...
Hi! It appears as if the tree parsing works fine for the Atom plugin, but we are getting the following warning. I assume this just means that this dependency needs to be included in this project.
If in the first line of the current buffer there is ...* rst
the text should be colored according rst, even if the extension is .txt.
The reStructuredText Markup Specification has the following to say about reference names for links:
Simple reference names are single words consisting of alphanumerics plus isolated (no two adjacent) internal hyphens, underscores, periods, colons and plus signs; no whitespace or other characters are allowed
The highlighter currently does not allow colon or plus (which the spec says is valid), but it does allow spaces, parentheses and forward slash (which are invalid according to the spec).
I can understand that it might allow a bit more characters than the spec, but I'm missing highlighting when I use a colon (e.g. as a separator: .. _figure:this-is-my-figure:
).
I noticed the rule for raw directive syntax highlighting is not right. For example, the correct way to write something in raw html
is:
.. raw:: html
<iframe src="https://google.com"></iframe>
However, in atom this won't trigger the html syntax highlighting, which only happens when i write like this (without the blank line, which is incorrect):
.. raw:: html
<iframe src="https://google.com"></iframe>
In my main settings I have a tab length of 4.
In reStructuredText I want a tab length of 2 which is actually the default.
But when I enter a tab length of 2 or also when I enter nothing it got changed to 4.
Other values are excepted.
I think this is the case, because 2 is the default value which gets overridden by the main settings.
(I was directed over here because Github uses TextMate-style language grammars through the linguist project (https://github.com/github/linguist/ ) and linguist points (https://github.com/github/linguist/tree/master/vendor/grammars ) to the language-restructuredtext project)
Could support for a few more Sphinx extensions be added? Over on https://gist.github.com/sitsofe/5610dafcddc5c89c8dbb9e5d3bce668d#job-description the one that is most problematic is the .. option::
directive (http://www.sphinx-doc.org/en/stable/domains.html?highlight=option#directive-option ). There are few others such as the :option:
inline markup (http://www.sphinx-doc.org/en/stable/markup/inline.html#role-option ) and :manpage:
inline markup (http://www.sphinx-doc.org/en/stable/markup/inline.html?highlight=manpage#role-manpage ) but those are more minor...
I have been working on the reStructuredText extension for Visual Studio Code, and recently developing a language server for it.
I just notice that Atom also supports LSP, as https://ide.atom.io indicates, so write in now to see if you have any plan developing your own language server, or reuse my server for auto completion. There can be some opportunities for collaboration.
Look forward to your reply.
Markdown documents have spell checking enabled by default. It would be great if rst documents were given the same treatment.
For now, my workaround is to switch the grammar to markdown periodically.
The following snippet tries to match a closing quote, which it is just an apostrophe.
I have no problem if I use http://www.fileformat.info/info/unicode/char/2019/index.htm but I would prefer to stick with ASCII as much as possible.
Twisted's service implementation does not support asynchronous ``startService`` methods.
According to http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#sections the complete list is ! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _
{ | } ~. The recommended list is
= - : . ' " ~ ^ _ * + #
. Unfortunately the support in the package doesn't fully cover the recommended list, let alone the complete list. It would be great if support for at least the recommended list was added.
not sure whether it's the right place to file this but looks like this repo is what's used to highlight rst in GitHub, I've also filled this in github/markup#1446
this won't render as rst:
Heading1
========
Heading2
--------
Heading3
~~~~~~~~
Heading4
========
Heading5
~~~~~~~~
this will:
Heading1
========
Heading2
--------
Heading3
~~~~~~~~
Heading4
========
Heading4b
---------
Heading5
~~~~~~~~
See github/markup#1446 for details.
Follow up on #5:
Commit 7897d5b replaced the non-working regexes with fixed-size underline, rendering these snippets more useful in the short term. However, ideally we would like to have the underlines be generated dynamically: the number of underline characters should be the same as the section name's length.
That would likely require a post-snippet-editing mechanism be added to the snippet package?
When I'm editing blocks of text -- especially with Sphinx docs -- it's annoying that the indentation isn't kept, leading to me having to re-indent after every newline instead of un-indenting when I'm finally done.
Store package settings files in the settings/
directory instead of scoped-properties/
Package.loadSettings (/Applications/Atom.app/Contents/Resources/app/src/package.js:547:9)
<unknown> (/Applications/Atom.app/Contents/Resources/app/src/package.js:168:43)
issue #9 refers.
I am very new to Atom, but a regular rst user. I'd appreciate if there were some way to have the same type of elements "coded" in some way across all the default Atom themes.
In particular, when you compare the normal light theme vs solarized light (which I use because its not as harsh in contrast as most of the others), you can see that styling is not the same between them; code in backticks is not styled nor is code text in indented blocks.
I am not sure how or where to begin to make any changes to make this work?
When I enabled live update, whenever I changed the source file, the preview panel flashes with a github symbol and "loading rst", which becomes very distractive and I had to disable the live update mode. Are there any ways to disable the loading icon or bind a keystroke to update preview? (All I can find is rst preview: toggle
, I want something like rst preview: update
)
Similar to language-pfm, it would be nice to have math scope + highlighting in .. math:
blocks and :math:
inline.
This was fixed upstream in: textmate/restructuredtext.tmbundle@608d8bc
Not sure how you want to handle porting that commit in.
Directives with domains like theses:
.. py:functions:: foo(bar)
.. cpp:class:: Name
are parsed and highlighted as comments.
The same issue seems to appears with the Github highlighting:
.. code::
.. py:class:: Test
Steal liberally from atom/language-gfm to do syntax highlighting within code blocks for RestructuredText.
.. code-block:: python
import awesome
awesome.hifive("everyone")
I was wondering what made you choose .gfm.restructuredtext
as scope name. If reStructuredText was GFM-based (GitHub Flavoured Markdown), the natural choice would be .source.gfm.restructuredtext
. Since it isn't, I'd suggest using .text.restructuredtext
instead (maybe .source.restructuredtext
). Your scope name works, it's just that it seems an odd choice.
See this comparison of Sublime Text and Atom scopes
Right now headings are not highlighted and only have the scope text.restructuredtext
. Please add additional scopes to allow syntax highlighting: heading.markup.restructuredtext
for all headings, and heading-#.restructuredtext
where #
is the pertinent numbered heading.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.