Git Product home page Git Product logo

vscode-restructuredtext / vscode-restructuredtext Goto Github PK

View Code? Open in Web Editor NEW
343.0 18.0 96.0 3.88 MB

reStructuredText Language Support in Visual Studio Code

Home Page: https://marketplace.visualstudio.com/items/lextudio.restructuredtext

License: Other

TypeScript 88.24% Batchfile 0.09% Python 6.15% HTML 4.83% JavaScript 0.69%
restructuredtext snippets visual-studio-code documentation-tool preview live-preview python python2 python3 sphinx

vscode-restructuredtext's Introduction

reStructuredText Language Support for Visual Studio Code

Become a Sponsor Build Status Stable Version Install Count Download Count Pre-release Version

This extension provides rich reStructuredText language support for Visual Studio Code. Now you write reStructuredText scripts using the excellent IDE-like interface that VS Code provides.

reStructuredText in Visual Studio Code

Features

Frequent Asked Questions can be found here.

How to install from Marketplace

This extension is hosted at Visual Studio Marketplace

  1. Upgrade to Visual Studio Code 1.82.0 or above.
  2. Switch to the Extensions view by clicking the fifth icon in the left most bar.
  3. Type "restructuredtext" in the search box and hit Enter key.
  4. Click "Install" button to install "reStructuredText" extension (by LeXtudio Inc.).

After installing this extension, please visit the homepage for this extension to learn how to use it.

Contributing to the code

Check out the development documentation for more details on how to contribute to this extension!

License

This extension is licensed under the MIT License. Please see the third-party notices file for details on the third-party files that we include with releases of this project.

Acknowledgements

Logo

The project logo comes from Legendora Icon by Teekatas Suwannakrua.

Linter

The linter support is based on Cody Hoover's ruby-linter. Linters like rstcheck/doc8/rst-lint can be used side by side.

vscode-restructuredtext's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vscode-restructuredtext's Issues

Can't preview in vscode 1.1.1

python==3.5.1

Sphinx
=======
Metadata-Version: 2.0
Name: Sphinx
Version: 1.4.2
Summary: Python documentation generator
Home-page: http://sphinx-doc.org/
Author: Georg Brandl
Author-email: [email protected]
Installer: pip
License: BSD
Location: /Users/xxxxxx/.pyenv/versions/3.5.1/lib/python3.5/site-packages

When I run ctrl+shift+r return a error below

image

Unable to open '/Preview: '/source/reputation.rst'': Cannot read property 'document' of undefined.

the developer show these error:

image

ENOENT: no such file or directory, stat ./_build/html/source/***.html

In fact, my directory tree are:

image

[New Feature] Support of PlantUML syntax highlight

This is not an issue but new change request.

I am working with Sphinx and apart from restructuredText we are using also plantUML diagrams in the same files. Are you able to provide syntax highlight also for PlantUML which is embedded in reStructuredText file?

There are separate plugins for this (like Yog PlantUML Highlight) but it would be nice to have support it in the same file (without need to change file type - which is very annoying).

Improve live preview performance

The current design emphasizes on preview accuracy, so that what you see in the preview would be almost the same when your project finally publishes as a web site.

To achieve this level of accuracy, the extension calls sphinx-build every time you save a file, which can be a performance issue for large projects or low end hardware, which is the price.

Other extensions for reStructuredText might take shortcuts to speed up previewing (using docutils to generate a single page, or converting RST prematurely to a single page). Those approaches hurt accuracy significantly and can lead to broken preview elements too. But if you prefer performance to accuracy, switch to them.

In the long term, this extension might find a way to switch to sphinx-autobuild which builds incrementally. It might improve the performance but no guarantee.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

How to see extended logs

This maybe related not necessary to plugin itself but maybe to Visual Studio Code.

How can I see detailed problems which are behind the error.
As you can see preview is not working because some problem. Unfortunately exception stack is truncated and cannot be easy copy/paste.

error

Do you have some kind of debug window which detailed information about exception is displayed / logged? If not maybe it is good idea to put it somwhere in output window.

Preview not working: syntax error and newlines displayed literally

Hello

When trying to preview a rst document (1),
I get a Python error. The parentheses are missing. The script broke with fixing #8.
When changing file preview.py from
print html_document.encode('utf8')
to
print (html_document.encode('utf8'))
the html preview works again.

However all the newlines in the reStructuredText document are translated to \n in the output.
tomanynewlines

Thanks for your extension, Matthias

(1) https://github.com/divio/django-cms/blob/master/docs/contributing/code.rst

Error when trying to open the preview

Please provide the following information,

Environment

  • Extension version: 0.0.21
  • Visual Studio Code version: 1.9.1
  • Operating System version: Windows 10
  • Python version: 2.7.10
  • sphinx version: 1.3.2
  • A sample of conf.py or its important fragments: ???

Expected behavior

Should open something... a window to display the preview.

Actual behavior

An error:

image

Detailed Steps to reproduce the problem

Just click the preview button when inside a rst file.

image

Workspace settings warning: Unknown configuration setting

Please provide the following information,

Environment

  • Extension version: 0.0.19
  • Visual Studio Code version: 1.8.1
  • Operating System version: Windows 8.1 Pro
  • Python version: 3.5.1
  • sphinx version: 1.4.5
  • A sample of conf.py or its important fragments:

Expected behavior

I expect to have the following in settings.json:

{
    "restructuredtext.confPath" : "conf.py",
    "restructuredtext.builtDocumentationPath" : "../app/help/",
    "restructuredtext.updateOnTextChanged" : "false"
}

Actual behavior

When entering the above settings, I get warnings: Unknown configuration setting for all three rows.

Detailed Steps to reproduce the problem

  • Select File -> Preferences -> Workspace settings
  • Paste the above settings.
  • Save

SPHINXBUILD, sphinxBuildPath and python.pythonPath does not work with Makefile

SPHINXBUILD, sphinxBuildPath and python.pythonPath does not work with Makefile.

Environment

  • Extension version: 26.0.0
  • Visual Studio Code version: 1.12.2
  • Operating System version: 10.10.5
  • Python version: 2.7.9
  • sphinx version: 1.6.1

Expected behavior

make html called from this extension should find sphinx-build when SPHINXBUILD, sphinxBuildPath or python.pythonPath is set.

Actual behavior

Error: Unable to open 'Preview 'file.rst''

Detailed Steps to reproduce the problem

The sphinx-build binary is passed as an environment variable to the make html call [1]. This is only supported for the Windows make.bat. For the Makefile it needs to be passed as an additional argument:

make html SPHINXBUILD=/path/to/sphinx-build

[1] https://github.com/vscode-restructuredtext/vscode-restructuredtext/blob/c6db222a5fb7c8700141e3058364184be0df4746/src/extension.ts#L220...L239

Preview seems to be cached (do not show changes of rst code)

Please provide the following information,

Environment

  • Extension version: 0.0.18
  • Visual Studio Code version: 1.7.1
  • Operating System version: Windows 7
  • Python version: 2.7.12
  • sphinx version: 1.4.8
  • A sample of conf.py or its important fragments:

Expected behavior

  1. Run preview (CTRL+K r or CTRL+SHIFT+R)
  2. Modify RST file
  3. Run preview (CTRL+K r or CTRL+SHIFT+R) to see changes made after step 2

Actual behavior

  1. Run preview (CTRL+K r or CTRL+SHIFT+R)
  2. modifiy rst file
  3. Run preview (CTRL+K r or CTRL+SHIFT+R) no modification of file are visible in preview

(Looks like cached version of file is used)

Detailed Steps to reproduce the problem

Preview failed on Unicode

When previewing documents containing Unicode (Chinese characters for example), it fails with

print(html document) 
UnicodeEncodeError: 'ascii' codec can't encode characters in position 50-58: ordinal not in range(128)

virtualenv is not used

Please provide the following information,

Environment

  • Extension version: 0.0.21
  • Visual Studio Code version: 1.8.1
  • Operating System version: macOS 10.12.3
  • Python version: 2.7.13
  • sphinx version: Sphinx (sphinx-build) 1.5.1

Expected behavior
sphinx builds and I see a preview

Actual behavior
Error message, no preview

Detailed Steps to reproduce the problem
I do not want to install sphinx globally but I have no problem installing it in a VirtualEnv.
I already use the pythonVSCode Plugin and in my .vscode/settings.json is already the alternative virtualenv python interpreter set:

{
    "python.pythonPath": "/Users/auser/.virtualenvs/pybossa/bin/python",
}

would be nice to be able to set virtualenv globally or project wide for this plugin. Thanks.

Error without details - is there a log?

Hi,

Thanks for providing this VSCode extension. I am encountering an error and actually I would like to investigate what could be wrong before submitting an issue to you. But I don't see how to get more details about the error. Is there any way to get to that info?

Currently don't have the time to create a minimal project to reproduce the error. I encountered it in https://github.com/simplifhir/simplifier-docs.git.

Regards, Christiaan

Please provide the following information,

Environment

  • [v26.0.0 ] Extension version:
  • [1.12.2 ] Visual Studio Code version:
  • [Windows 10 64 bit (winver.exe: version 1607)] Operating System version:
  • [2.7.13 ] Python version:
  • [1.5.5 ] sphinx version:
  • A sample of conf.py or its important fragments:

extensions = [
'sphinx.ext.intersphinx',
]
intersphinx_mapping = {'https://docs.python.org/': None}

Expected behavior
An error occurs, and I am directed to a log or other means of determining the actual problem.

Actual behavior
An error occurs, and vscode just shows: Unable to open 'Preview 'index.rst'': Error

Detailed Steps to reproduce the problem

Can't preview the .rst file

Please provide the following information,

Environment

  • Extension version:0.0.19
  • Visual Studio Code version:1.8.1
  • Operating System version:Windows 10
  • Python version:Python 3.5
  • sphinx version:1.5.1
  • A sample of conf.py or its important fragments:

Expected behavior
Preview the .rst file

Actual behavior
无法打开“Preview 'README.rst'”: Error

Detailed Steps to reproduce the problem
workbench.main.js:94 无法打开“Preview 'README.rst'”: Error
Command failed: make html

Error: Command failed: make html

at ChildProcess.exithandler (child_process.js:218:12)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:877:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)

。: Error: 无法打开“Preview 'README.rst'”: Error
Command failed: make html

Error: Command failed: make html

at ChildProcess.exithandler (child_process.js:218:12)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:877:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)


at t.doHandleSetInputError (file:///C:/Program Files (x86)/Microsoft VS Code/resources/app/out/vs/workbench/electron-browser/workbench.main.js:126:3539)
at file:///C:/Program Files (x86)/Microsoft VS Code/resources/app/out/vs/workbench/electron-browser/workbench.main.js:126:3145
at then (file:///C:/Program Files (x86)/Microsoft VS Code/resources/app/out/vs/workbench/electron-browser/workbench.main.js:32:18898)
at t.doSetInput (file:///C:/Program Files (x86)/Microsoft VS Code/resources/app/out/vs/workbench/electron-browser/workbench.main.js:126:2891)
at file:///C:/Program Files (x86)/Microsoft VS Code/resources/app/out/vs/workbench/electron-browser/workbench.main.js:126:770
at then (file:///C:/Program Files (x86)/Microsoft VS Code/resources/app/out/vs/workbench/electron-browser/workbench.main.js:32:19522)
at t.doOpenEditor (file:///C:/Program Files (x86)/Microsoft VS Code/resources/app/out/vs/workbench/electron-browser/workbench.main.js:126:742)
at t.openEditor (file:///C:/Program Files (x86)/Microsoft VS Code/resources/app/out/vs/workbench/electron-browser/workbench.main.js:126:19)
at e.doOpenEditor (file:///C:/Program Files (x86)/Microsoft VS Code/resources/app/out/vs/workbench/electron-browser/workbench.main.js:114:308)
at e.openEditor (file:///C:/Program Files (x86)/Microsoft VS Code/resources/app/out/vs/workbench/electron-browser/workbench.main.js:113:31760)

[Feature request] Add outline support

Hi,

it would be great if the document sections get shown in the outline view. This way there would be an overview about the document structure. By clicking a section in the outline the editor should jump to the related section then.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

[Feature request] Display preformatted text in dedicated color

Hi,

it would be great if preformatted sections gets displayed in a different color. The color may be the same for general code samples starting with :: or dedicated language samples starting with .. code-block:: python for example.

If it further would be possible to syntax highlight language dedicated code samples the way sphinx does this would be perfect - but i suppose this implies a lot of work...

Thanks for this plugin 👍


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Unable to open 'Preview 'filename.rst'':Cannot read property 'document' of undefined.

Please provide the following information,

Environment

  • [x ] Extension version:0.0.22
  • [ x] Visual Studio Code version:1.1.2
  • [ x] Operating System version:windows 7
  • [ x] Python version:3.6
  • [x ] sphinx version:
  • [x ] A sample of conf.py or its important fragments:

Expected behavior
show preview for an reStructuredText page
Actual behavior
Unable to open 'Preview 'filename.rst'':Cannot read property 'document' of undefined.
Detailed Steps to reproduce the problem
python 3.6
pip sphinx,
pip sphinx-autobold
install vscode 1.1.2
install extension
reopen code .
ctr+shift+r

Prieview broken

Environment

  • Extension version: 0.0.23
  • Visual Studio Code version: 1.12.1
  • Operating System version: Windows 10
  • Python version: 3.6.1
  • sphinx version: 1.5.5
  • A sample of conf.py or its important fragments:

Expected behavior
show preview for an reStructuredText page
Actual behavior
Unable to open 'Preview 'filename.rst'':ErrorENOENT: no such file or directory
Detailed Steps to reproduce the problem
install extension
reopen code .
ctr+shift+r

preview(uri) function add last 3 characters from working directory name (documentation -> ion)
preview-err

Quick fix:

>         whole = whole.substring(3, ext) + ".html";
---
<         whole = whole.substring(0, ext) + ".html";

Wrong settings key for the linter executable in error message

The following error message "Cannot lint /Users/admin/papervoucher_revised/index.rst. The executable was not found. Use the 'restructuredtext.executablePath' setting to configure the location of the executable" (see attached screenshot)

screen shot 2017-07-24 at 12 05 09

The key for the settings has a typo, it says restructuredtext.executablePath instead of restructuredtext.linter.executablePath.

Help me with configure restruturedtext preview for docs folder

If I have the project folder like below then the preview not working...

.vscode
|__ settings.json
|__ docs/
    |__ config.py

Environment

  • Extension version: 29.0.0
  • Visual Studio Code version: 1.13.0
  • Operating System version: Ubuntu 16
  • Python version: 2.7.12
  • sphinx version: 1.3.6
  • A sample of conf.py or its important fragments:
// Place your settings in this file to overwrite default and user settings.
{
    "restructuredtext.builtDocumentationPath" : "docs/_build/html",
    "restructuredtext.confPath"               : "docs",
    "restructuredtext.updateOnTextChanged"    : "true", 
    "restructuredtext.sphinxBuildPath"        : "sphinx-build"
}

Expected behavior
Ctrl + Shift + r to open preview window

Actual behavior

Unable to open 'Preview 'index.rst'': Error

Detailed Steps to reproduce the problem
Follow Sample Project and make sure the preview work. Then move all the files and folder to docs/ then create a .vscode/settings.json with above configuration.

Am I missing something? It should show the preview. Please help.

Preview fails to open due to hardcoded paths

Preview fails to open due to hard coded paths that expect docs in specific location:
https://github.com/vscode-restructuredtext/vscode-restructuredtext/blob/master/src/extension.ts#L123

Error is:

ENOENT: no such file or directory, stat 'c:\Users\Martin\data\identities\personal\project\lucidity\_build\html\doc\guide\introduction.html'

Actual files after build are located at c:\Users\Martin\data\identities\personal\project\lucidity\build\doc\html\guide\introduction.html

Note that target for built docs can be controlled through various means by project owner so might be worth letting that path be a configuration variable.

Additionally, the rest of the path should be relative to the conf.py I think rather than relative to the root of the workspace (in my example the docs are under a doc subdirectory, but that won't be in the generated html path).

Broken in Code 1.9

Please provide the following information,

Environment

  • [ 0.0.21] Extension version:
  • [1.9.0 ] Visual Studio Code version:
  • [ Win 10] Operating System version:
  • [3.5.2 ] Python version:
  • [ 1.4.5] sphinx version:
  • A sample of conf.py or its important fragments:

VS Code updated to 1.9 Jan release.
Ctrl+K+R opens the preview window, but it does not show anything. No errors, just an empty window.
Further investigation shows the _build folder was create and all files generated.

I installed 1.8.1 and it worked again.
I exited 1.8.1 and it updated itself to 1.9 and it was broken once again.

Spurious underlining in RST tables

Every second column is being underlined, making the tables hard to work with, because the underlining masks actual underlines. Is this a bug or a feature? ;)

Table RST code:

+---------+-------+--------+
| Example | Table | Header |
+=========+=======+========+
| Lorem   | Ipsum | Dolor  |
+---------+-------+--------+
| Sit     | Amet  | Lorem  |
+---------+-------+--------+
| Ipsum   | Dolor | Sit    |
+---------+-------+--------+

Rendering in vscode:
rst-rable

Unable to open '/Preview: 'index.rst''

不知道是我没配置好还是作者安装过程没太写明白,捣鼓了一下午,全部都是不能打开rst 文件的报错。结果看到安装目录的json文件中有用到node 的命令。安装一下node.js 就可以转换了。

sphinx separate source and build

When editing a sphinx project, created using the quickstart option to separate source and build:

You have two options for placing the build directory for Sphinx output.
Either, you use a directory "_build" within the root path, or you separate
"source" and "build" directories within the root path.
Separate source and build directories (y/n) [n]: y

the documentation tree ends up as:

ROOT/make.bat
ROOT/Makefile
ROOT/source/*
ROOT/build/html/*

then I add the following code configuration file for code in ROOT/.vscode/settings.json:

{
    "restructuredtext.builtDocumentationPath" : "build/html",
    "restructuredtext.makefilePath"           : ".",
    "restructuredtext.updateOnTextChanged"    : "false",
    "restructuredtext.sphinxBuildPath"        : null
}

I then start code in the ROOT directory, but when I try to preview one of the FILE.rst files inside "source" it fails with the dreaded "Error" seen in other posts.

Using the Console output I see that the extension is trying to open:
'ROOT/build/html/source/FILE.html'
where the extra "source" in the pathname is incorrect (the build ends up in ROOT/build/html/FILE.html).

I do not see how to correct this in the settings.json file with the 4 configuration options available. As a workaround I added a "source" link to "." inside the ROOT/build/html folder and the preview immediately started working.

Thanks for the great plugin, hope this might help someone...

Environment

  • Extension version: 26.0.0
  • Visual Studio Code version: 1.11.2
  • Operating System version: Linux debian stretch
  • Python version: 2.7.13
  • sphinx version: 1.4.9
  • A sample of conf.py or its important fragments: NOT RELEVANT (I think)

Unknown configuration setting

Environment

  • Extension version: 0.0.19
  • Visual Studio Code version: 1.8.1
  • Operating System version: ubuntu 16.04
  • Python version: 3.5
  • sphinx version: 1.5.1

I know this is a duplicate of #33 but my workspace setting conf file is in the proper path .vscode/settings.json at the root project directory (the opened folder in vscode).

These 3 settings are still mark as unknown :

  • restructuredtext.builtDocumentationPath
  • restructuredtext.makefilePath
  • restructuredtext.updateOnTextChanged

I have try to restart vscode but no way, these settings are still underline by the linter with the popup message

Unknown configuration setting

Obvisouly, there is something missing to inform VScode what these settings are... no?

Thanks

Ability to reformat text?

I just might be missing something obvious but is there a way to reformat text to wrap it to some appropriate length? I currently have to do that manually as our build system uses doc8 to lint and has line length restrictions enabled.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.