Merge branch 'main' into simple_pack

This commit is contained in:
Veronica K. Berglyd Olsen
2021-01-23 13:46:31 +00:00
committed by GitHub
3 changed files with 189 additions and 122 deletions
+42 -25
View File
@@ -1,43 +1,60 @@
# Contributing
# Contributing Guide
When contributing to this repository, please first discuss the change you wish to make via the
issue tracker with the owner of this repository before making a change. If you just want to make a
minor correction, like fix a typo or similar, feel free to just make a pull request directly.
There is a code of conduct. Please follow it in all your interactions with the project.
issue tracker or the discussions page with the owner of this repository before making a change. If
you just want to make a minor correction, like fix a typo or similar, feel free to just make a pull
request directly.
## Pull Request Process
1. Make sure your code passes all tests and conforms to the style guide. You can check that the code
conforms by running `flake8` from the root of the project folder.
1. Make sure your code passes all tests and conforms to the style guide. You can check that the
code conforms by running `flake8` from the root of the project folder.
2. Please provide a complete description of the changes in the pull request, and a summary that can
be copied into the [CHANGELOG](CHANGELOG.md). Remember to reference any issue related by
providing the issue number.
3. Do not change the version number unless asked to do so. Version numbers are bumped in separate
release pull requests by the maintainer.
3. Do not change the version number. Version numbers are bumped in separate release pull requests
by the maintainer.
## Code of Conduct
There is a code of conduct. Please follow it in all your interactions with the project.
### Our Pledge
In the interest of fostering an open and welcoming environment, we as contributors and maintainers
pledge to making participation in our project and our community a harassment-free experience for
everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level
of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
everyone, regardless of age, body size, disability, ethnicity, gender identity and expression,
level of experience, nationality, personal appearance, race, religion, or sexual identity and
orientation.
Please see the [CODE_OF_CONDUCT](CODE_OF_CONDUCT.md) file for the full text.
## Code Style Guide
The source code of novelWriter broadly follows the [PEP8](https://www.python.org/dev/peps/pep-0008/)
style guide , but with a few modifications and exceptions.
The source code of novelWriter broadly follows the [PEP8](https://www.python.org/dev/peps/pep-0008)
style guide, but with a few modifications and exceptions listed below.
### Linting with flake8
### Line Length
An excellent tool for checking Python code for errors and coding style is `flake8`.
The documentation is available [here](https://flake8.pycqa.org/en/latest/).
For this project, source lines should stay within the 79 and 99 character limits described by PEP8.
79 characters is often too restrictive, so 99 character lines are acceptable when that is more
practical. Readability has priority. Generally, if a code statement requires multiple lines, the
lines should wrap at 79 characters, not 99. If wrapping can be avoided by going to 99, then that is
generally preferrable.
The `setup.cfg` file in the root of this project has the following settings:
For text files, the text should also be wrapped at 99 character. The exception is markdown image
tags and urls.
Please do not submit pull requests that re-wrap existing source or text unless this has been
discussed beforehand.
### Linting with `flake8`
An excellent tool for checking Python code for errors and coding style is `flake8`. The
documentation is available [here](https://flake8.pycqa.org/en/latest/).
The `setup.cfg` file in the root of this project has the following settings for `flake8` that
matches the coding standard:
```conf
[flake8]
ignore = E203,E221,E226,E228,E241,E251,E261,E266,E302,E305
@@ -57,20 +74,20 @@ not conform to the standard.
## Ignored Errors
Some errors are ignored in novelWriter, for various reasons. In addition, novelWriter uses camelCase
function and variable names due to this being the standard for the Qt libraries, and also because of
the author's personal preferences.
Some `flake8` error codes are ignored for this project for various reasons. The source also uses
camelCase function and variable names. This is the standard for the Qt libraries novelWriter
integrates with. It also happens to be the author's personal preferences.
The reason behind the other ignored error codes are listed below. Many of them are due to PEP8 not
permitting column alignment as opposed to many other coding styles. I find them useful in regions of
bulk value assignments. There's a reason why tables are more readable than lists. They should be
used sparingly though.
permitting column alignment as opposed to many other coding styles, like for instance for Go. I
find them useful in regions of bulk value assignments. There's a reason why tables are more
readable than lists. They should be used sparingly though.
The ignored errors are all `pycodestyle` errors, and they are documented
[here](https://pycodestyle.pycqa.org/en/latest/intro.html#error-codes).
**E203:** whitespace before :
**Reason:** Column alignment. It is natural to align dictionary columns along the `:` character.
**Reason:** Column alignment.
**E221:** multiple spaces before operator
**Reason:** Column alignment.
@@ -78,7 +95,7 @@ The ignored errors are all `pycodestyle` errors, and they are documented
**E226:** missing whitespace around arithmetic operator
**Reason:** This doesn't actually follow the PEP8 recommendation of grouping longer equations by
operator precedence like `2*a + 3*b` instead of `a * a + 3 * b`. Generally, don't use spaces around
`*`, `/` and `**`, but do use spaces around `+` and `-`. For appending strings, the spaces can be
`*`, `/` and `**`, but _do_ use spaces around `+` and `-`. For appending strings, the spaces can be
dropped. Don't use the `+` operator for appending multiple strings. Use formatting instead.
**E228** missing whitespace around modulo operator
+121 -95
View File
@@ -15,94 +15,44 @@
<img align="left" style="margin: 0 16px 4px 0;" src="https://raw.githubusercontent.com/vkbo/novelWriter/main/setup/icons/scaled/icon-novelwriter-96.png">
novelWriter is a Markdown-like text editor designed for writing novels and larger projects of many
smaller plain text documents. It uses its own flavour of Markdown that supports a meta data syntax
for comments, synopsis, and cross-referencing between files. It's designed to be a simple text
editor that allows for easy organisation of text files and notes, built on plain text files for
robustness.
novelWriter is a Markdown-like text editor designed for writing novels assembled from many smaller
text documents. It uses a minimal formatting syntax inspired by Markdown, and adds a meta data
syntax for comments, synopsis, and cross-referencing between files. It's designed to be a simple
text editor that allows for easy organisation of text files and notes, built on plain text files
for robustness.
The plain text storage is suitable for version control software, and also well suited for file
synchronisation tools. The core project structure is stored in a project XML file. Other meta data
is primarily saved in JSON files.
The plain text files are suitable for version control software, and also well suited for file
synchronisation tools. The core project structure is stored in a single project XML file. Other
meta data is primarily saved in JSON files.
The full documentation is available at
[novelwriter.readthedocs.io](https://novelwriter.readthedocs.io/).
The contributing guide is available at
[CONTRIBUTING](https://github.com/vkbo/novelWriter/blob/main/CONTRIBUTING.md).
[novelwriter.readthedocs.io](https://novelwriter.readthedocs.io).
## Implementation
The application is written in Python 3 using Qt5 via PyQt5. It is developed on Linux, but it should
in principle work fine on other operating systems as well as long as dependencies are met. The unit
tests are run on the latest versions of Ubuntu Linux, Windows Server and macOS.
in principle work fine on other operating systems as well, as long as dependencies are met. The
unit tests are run on the latest versions of Ubuntu Linux, Windows Server and macOS.
## Project Contributions
# Installing and Running
For install instructions, please check the [documentation](https://novelwriter.readthedocs.io/) in
the [Getting Started](https://novelwriter.readthedocs.io/en/latest/int_started.html) section.
## TLDR Instructions
**Note:** You may need to replace `python` with `python3` and `pip` with `pip3` in the instructions
below on some systems. You may also want to add the `--user` flag for `pip` to install in your user
space only.
### Install from PyPi
novelWriter is available on [pypi.org](https://pypi.org/project/novelWriter/), and can be installed
with:
```bash
pip install novelwriter
```
Dependencies should be installed automatically, but can also be installed directly with:
```bash
pip install pyqt5 lxml pyenchant
```
### Setup on Linux
If you're running from source, the following commands will set up novelWriter on Linux:
```bash
pip install -r requirements.txt
python setup.py install
python setup.py xdg-install
```
### Setup on macOS
If you're running from source, the following commands will set up novelWriter on macOS:
```bash
brew install enchant
pip3 install --user -r requirements.txt
pip3 install --user pyobjc
```
### Setup on Windows
For Windows, you can either install via PyPi, or use the Windows installer available from the
[releases](https://github.com/vkbo/novelWriter/releases) page.
## Debugging
If you need to debug novelWriter, you must run it from command line. It takes a few parameters,
which can be listed with the switch `--help`. The `--info`, `--debug` or `--verbose` flags are
particularly useful for increasing logging output for debugging.
Contributions to this project are welcome. However, please read the
[Contributing Guide](https://github.com/vkbo/novelWriter/blob/main/CONTRIBUTING.md) before
submitting larger additions ot changes to this project.
# Key Features
Some features of novelWriter are listed below. Consult the
[documentation](https://novelwriter.readthedocs.io/) for more information.
[documentation](https://novelwriter.readthedocs.io) for more information.
### Markdown Flavour
novelWriter is _not_ a full-feature Markdown editor. It allows for a minimal set of formatting
needed for writing text documents for novels. These are currently limited to:
novelWriter is _not_ a full-feature Markdown editor. It is a plain text editor that uses
Markdown-like syntax for adding a minimal set of formatting that is useful for the specific task
of writing novels. The formatting is currently limited to:
* Headings level 1 to 4 using the `#` syntax only.
* Headings levels 1 to 4 using the `#` syntax only.
* Emphasised and strongly emphasised text. These are rendered as italicised and bold text.
* Strikethrough text.
* Hard line breaks using two or more spaces at the end of a line.
@@ -116,20 +66,19 @@ In addition, novelWriter adds the following, which is otherwise not supported by
the comment is indexed and treated as the synopsis for the section of text under the same header.
These synopsis comments can be used to build an outline and exported to external documents.
* A set of meta data keyword/values starting with the character `@`. This is used for tagging
and inter-linking documents, and can be used to generate a project outline.
* Non-breaking spaces are supported as long as your system is using at least Qt 5.9. For earlier
version, non-breaking spaces are converted to normal spaces when saving the document. This is
done by the Qt library.
* Thin spaces are also supported, as well as non-breaking thin spaces, with the same library
version restriction as above.
* Tabs can be used in the text, and should be properly aligned. The width of a tab in pixels can be
changed in Preferences. Note that for the HTML format, most browsers will treat a tab as a space,
so it may not show up like expected. If you import the HTML file to Libre Office, for instance,
they should appear as expected.
and inter-linking documents, and can also be included when generate a project outline.
* A variety of thin and non-breaking spaces are supported. Some of them depend on the system
running at least Qt 5.9. Earlier versions of Qt will unfortunately strip them out when saving.
* Tabs can be used in the text, and should be properly aligned in both editor and viewer. This can
be used to make simple tables and lists. Full Markdown tables and lists are not supported. Note
that for HTML exports, most browsers will treat a tab as a space, so it may not show up like
expected. If you import the HTML file to Libre Office, for instance, they should appear as
expected.
The core export format of novelWriter is HTML5. You can also export the entire project as a single
novelWriter Markdown-flavour document. In addition, other exports to Open Document, PDF, and plain
text is offered through the Qt library, although with limitations to formatting.
novelWriter Markdown-flavour document. These can later be imported again into novelWriter. In
addition, export to Open Document, PDF, and plain text is offered through the Qt library, although
with limitations to formatting.
The HTML format is well suited for file conversion tools and import into other text editors.
@@ -137,20 +86,16 @@ The HTML format is well suited for file conversion tools and import into other t
### Colour Themes
The editor has syntax highlighting for the features it supports, and includes a set of different
syntax highlighting themes. The GUI also has an optional dark theme in addition to the default
system theme.
New themes can easily be added to the `nw/assets/themes` folder. Have a look in the existing
folders for examples of how to define the colours.
syntax highlighting themes. Optional GUI themes are also available, including dark themes.
### Easy Organising of Project Files
The structure of the project is shown on the left hand side of the main GUI. Project files are
The structure of the project is shown on the left hand side of the main window. Project files are
organised into root folders, indicating what class of file they are. The most important root folder
is the Novel folder, which contains all of the files that makes up the finished novel. Each root
folder can have subfolders. Folders have no impact on the final project structure, they are purely
tools for organising the files in whatever way the user needs.
is the `Novel` folder, which contains all of the files that make up the finished novel. Each root
folder can have subfolders. Subfolders have no impact on the final project structure, they are
there for you to organise your files in whatever way you want.
The editor supports four levels of headings, which determines what level the following text belongs
to. Headings of level one signify a book or partition title. Headings of level two signify the
@@ -159,10 +104,11 @@ four can be used internally in each scene to separate sections.
Each novel file can be assigned a layout format, which shows up as a flag next to the item in the
project tree. These are mostly to help the user track what they contain, but they also have some
impact on the format of the exported document. See the documentation for further details.
impact on the format of the exported document. See the
[documentation](https://novelwriter.readthedocs.io) for further details.
#### Project Notes
### Project Notes
Supporting note files can be added for the story plot, characters, locations, story timeline, etc.
These have their separate root folders. These are optional files.
@@ -177,7 +123,87 @@ are clickable in the document view pane, and control-clickable in the editor. Th
to quickly navigate between the documents while editing.
## Licenses
# Installing and Running
For install instructions, please check the [documentation](https://novelwriter.readthedocs.io/) in
the [Getting Started](https://novelwriter.readthedocs.io/en/latest/int_started.html) section.
## TLDR Instructions
If you want to run novelWriter directly from the source code, you must run the `novelWriter.py`
file from command line. For installations on Linux, macOS or Windows, see below.
**Note:** You may need to replace `python` with `python3` and `pip` with `pip3` in the instructions
below on some systems. You may also want to add the `--user` flag for `pip` to install in your user
space only.
### Install from PyPi
novelWriter is available on [pypi.org](https://pypi.org/project/novelWriter/), and can be installed
with:
```bash
pip install novelwriter
```
Dependencies should be installed automatically, but can also be installed directly with:
```bash
pip install pyqt5 lxml pyenchant
```
When installing via pip, novelWriter can be launched from command line with:
```bash
novelWriter
```
Make sure the install location for pip is in your PATH variable. This is not always the case by
default.
### Setup on Linux
If you're installing from source, the following commands will set up novelWriter on Linux:
```bash
pip install -r requirements.txt
python setup.py install
python setup.py xdg-install
```
This should make novelWriter available as a regular application on your system, with a launceher
icon, and file association with novelWriter project files.
### Setup on macOS
If you're installing from source, the following commands will set up novelWriter on macOS:
```bash
brew install enchant
pip3 install --user -r requirements.txt
pip3 install --user pyobjc
python3 setup.py install
```
At present, novelWriter isn't further integrated into the OS, so you must launch it from command
line with:
```bash
novelWriter
```
### Setup on Windows
For Windows, you can either install via PyPi, or use the Windows installer available from the
[releases](https://github.com/vkbo/novelWriter/releases) page. This should add the necessary icons
to your desktop and start menu.
## Debugging
If you need to debug novelWriter, you must run it from command line. It takes a few parameters,
which can be listed with the switch `--help`. The `--info`, `--debug` or `--verbose` flags are
particularly useful for increasing logging output for debugging.
# Licenses
This is Open Source software, and novelWriter is licensed under GPLv3. See the
[GNU General Public License website](https://www.gnu.org/licenses/gpl-3.0.en.html) for more
@@ -204,7 +230,7 @@ Bundled assets have the following licenses:
[sdras/night-owl-vscode-theme](https://github.com/sdras/night-owl-vscode-theme).
## Screenshot
# Screenshot
**novelWriter with default system theme:**
![Screenshot 1](https://raw.githubusercontent.com/vkbo/novelWriter/main/docs/source/images/screenshot_default.png)
+26 -2
View File
@@ -32,7 +32,8 @@ in principle work fine on other operating systems as long as dependencies are me
You can download the latest version of novelWriter from the source repository on GitHub_.
novelWriter is also hosted on PyPi_, and can be installed on all operating systems that support Qt5
and Python 3. It is regularly tested on Linux, Windows and macOS.
and Python 3. It is regularly tested on Linux, Windows and macOS. The latest version of novelWriter
is |release|.
To install from PyPi you must first have the ``python`` and ``pip`` commands available on your
system. If you don't, see specific instructions for your operating system later in this document.
@@ -48,7 +49,14 @@ To upgrade an existing installation, use:
pip install --upgrade novelwriter
The latest version of novelWriter is |release|.
When installing via pip, novelWriter can be launched from command line with:
.. code-block:: console
novelWriter
Make sure the install location for pip is in your PATH variable. This is not always the case by
default.
.. _GitHub: https://github.com/vkbo/novelWriter/releases
.. _PyPi: https://pypi.org/project/novelWriter/
@@ -138,6 +146,9 @@ By default, these commands install novelWriter and its icons for the current use
for all users, run the script with the ``sudo`` command. Other options are also available. Run
``python setup.py help`` for a full list of install options.
This should install novelWriter to either ``~/.local/bin/novelWriter`` if installed for local user
only, or to ``/usr/local/bin/novelWriter`` if installed for all users.
.. _a_started_macos:
@@ -160,6 +171,19 @@ dictionaries.
brew install enchant
With the dependencies in place, you can either launch the ``novelWriter.py`` script directly, or
run the install command:
.. code-block:: console
python setup.py install
After this, you should be able to launch novelWriter by running ``novelWriter`` in a command line
window.
Right now there isn't a better integration with macOS available. Contributions from someone more
familiar with macOS would be very much appreciated.
.. _brew docs: https://docs.brew.sh/Homebrew-and-Python