Skip to content

Commit f18bd7c

Browse files
authored
v1.0 release
2 parents 52751f3 + ab65771 commit f18bd7c

File tree

8 files changed

+85
-53
lines changed

8 files changed

+85
-53
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ __pycache__
66
.DS_Store
77
FLAG_FILE
88
settings.json
9+
.release/

README.markdown

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,27 @@
1-
# Sublime Notebook
1+
<h1 align="center">
2+
Sublime Notebook :memo:
3+
</h1>
24

3-
**v0.9**
5+
**v1.0**
46

57
Sublime Notebook is an attempt to use Sublime Text as a complete note taking application.
68

79
> Blog post for v0.3.0 (no longer recommended) https://medium.com/aviaryan/b8d846c47905#.hy8alq2ip
810
911

10-
## Why did you build this?
12+
## Why did you build this? :thinking:
1113

1214
I have been note-taking for as long as I started using computers. I use notes mostly for technical stuff, but these days I am using notes to record all kinds of information like journals, ideas, snippets etc. In my career, I have tried a number of note-taking tools like OneNote, Evernote, CintaNotes, SimpleNote, Cherrytree, Google Keep, etc. But I have never been satisfied with them mainly because -
1315

1416
1. I don't have any control over how or where my notes are stored. - What if the company closes or the developer stops building the product?
15-
2. Most of these services are paid or work on only certain Operating Systems. And even if they are truly free and cross-platform, they lack critical features like fast full notebook search or hierarchical organization.
17+
2. Most of these services are paid or work on only certain Operating Systems. And even if they are truly free and cross-platform, they lack critical features like fast full notebook search or hierarchical organization.
1618

17-
Because of these reasons, I had to lose my notes a number of times and was forced to start from scratch. This was frustrating, and finally, I decided to do something about it.
19+
Because of these reasons, I had to lose my notes a number of times and was forced to start from scratch. This was frustrating, and finally, I decided to do something about it.
1820

1921
The result is this project, a wrapper/idea that converts my favorite text editor, Sublime Text, to a feature-rich note-taking tool. Sure it might not be as polished as all those premium note-taking tools, but it works and that too in the way I want it to.
2022

2123

22-
## Features
24+
## Features :sunglasses:
2325

2426
* Faaaast Search across all notes (thanks to Sublime Text)
2527
* Hierarchical organization and display of notes
@@ -29,6 +31,6 @@ The result is this project, a wrapper/idea that converts my favorite text editor
2931
* Markdown based markup and code syntax highlighting
3032

3133

32-
## Documentation
34+
## Documentation :yum:
3335

34-
Find the docs in the [sublime_notebook/docs](sublime_notebook/docs) folder.
36+
Find the docs in the [sublime_notebook/docs](sublime_notebook/docs/README.markdown) folder.

sublime_notebook/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
SETTINGS_PATH = 'sublime_notebook/settings.json'
2-
VERSION = 0.9
2+
VERSION = 1.0

sublime_notebook/cryptlib.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import re
44
from getpass import getpass
55
from .settings import Settings
6+
from .message import print_err
67

78

89
EXTRA_STR = 'ENCo0D#DT{xTCh$cKe>'
@@ -74,7 +75,7 @@ def update_file(funcptr, flist, key):
7475
if newData is None:
7576
newData = data
7677
failed = True
77-
print('Failed decrypting %s' % file)
78+
print_err('Failed decrypting %s' % file)
7879
fptr.write(newData)
7980
fptr.close()
8081
# check if failed

sublime_notebook/docs/README.markdown

Lines changed: 48 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
# Documentation
1+
<a name="docs"></a>
2+
# Table of Contents
23

3-
## Table of Contents
4-
5-
* [Requirements](#rq)
6-
* [Getting Started](#gs)
7-
* [Accessing your notes](#ac)
8-
* [Encrypting your notes](#en)
9-
* [Note taking features](#nt)
10-
* [Changing SublimeNotebook password](#cp)
11-
* [Customizing which folders are encrypted](#custen)
12-
* [Automatic git backups](#git)
13-
* [Setting up better Markdown highlighting in Sublime Text](#mdext)
14-
* [FAQ](#faq)
4+
:one: [Requirements](#rq)
5+
:two: [Getting Started](#gs)
6+
:three: [Accessing your notes](#ac)
7+
:four: [Encrypting your notes](#en)
8+
:five: [Note taking features](#nt)
9+
:six: [Changing SublimeNotebook password](#cp)
10+
:seven: [Customizing which folders are encrypted](#custen)
11+
:eight: [Automatic git backups](#git)
12+
:nine: [Setting up better Markdown highlighting in Sublime Text](#mdext)
13+
:keycap_ten: [FAQ](#faq)
1514

1615

1716
<a name="rq"></a>
18-
## Requirements
17+
## :one: Requirements
18+
:point_up_2: [[back to top](#docs)]
1919

2020
The requirements for using this tool are as follows. Make sure to have them installed before proceeding to the next section.
2121

@@ -25,7 +25,8 @@ The requirements for using this tool are as follows. Make sure to have them inst
2525

2626

2727
<a name="gs"></a>
28-
## Getting started
28+
## :two: Getting started
29+
:point_up_2: [[back to top](#docs)]
2930

3031
The first step is downloading the release from https://github.com/aviaryan/SublimeNotebook/releases/latest.
3132

@@ -37,21 +38,23 @@ Done! You can now create any number of notes in that folder. For hierarchy, you
3738

3839

3940
<a name="ac"></a>
40-
## Accessing your notes
41+
## :three: Accessing your notes
42+
:point_up_2: [[back to top](#docs)]
4143

4244
To access your notes, we will use the Projects feature of Sublime Text.
4345

4446
Open Sublime Text and click on "Open Project" in the Project menu.
4547

46-
Browse for the `notebook.sublime-project` file in the folder you downloaded and open it. Now open the Sidebar (View -> Sidebar). You will see all your notes presented there with the hierarchy.
48+
Browse for the `notebook.sublime-project` file in the folder you downloaded and open it. Now open the Sidebar (View -> Side Bar). You will see all your notes presented there with the hierarchy.
4749

4850
Whenever you want to open your Sublime Notebook, you can use the switch project shortcut (Cmd-Ctrl-P or Ctrl-Alt-P) and select `notebook.sublime-project` to switch to the Notebook project.
4951

5052
![Project Selector](https://user-images.githubusercontent.com/4047597/35473121-4556dd7a-03a1-11e8-8c3a-6e85592d5d5f.png)
5153

5254

5355
<a name="en"></a>
54-
## Encrypting your notes
56+
## :four: Encrypting your notes
57+
:point_up_2: [[back to top](#docs)]
5558

5659
To encrypt or decrypt notes, you use the `manager.py` file located in the notebook root. It runs in Python 3 and requires no additional dependencies.
5760
I recommend changing the first line of the file to point to your interpreter.
@@ -66,34 +69,42 @@ Then use `python manager.py` or `./manager.py` to run the script.
6669

6770
When it runs for the first time, it will find the notes and ask you a password for encryption.
6871
After getting the password, it will encrypt all non-public notes using that password.
72+
73+
![first time encryption](https://user-images.githubusercontent.com/4047597/35779481-b09abd92-09f3-11e8-8dee-accbf5a64581.png)
74+
6975
In the subsequent runs, `manager.py` will work as an un-locker where it will ask password to decrypt the notes and then pause its execution.
7076
Now you can view and edit your notes and then later on encrypt them again by entering 'e' in the prompt.
7177

72-
![screen shot 2018-01-27 at 8 06 07 pm](https://user-images.githubusercontent.com/4047597/35472896-897a22a4-039d-11e8-9b1d-153c06bc203e.png)
78+
![second run](https://user-images.githubusercontent.com/4047597/35779488-dc1046cc-09f3-11e8-8773-ae66da8325c4.png)
7379

7480

7581
<a name="nt"></a>
76-
## Note taking features
82+
## :five: Note taking features
83+
:point_up_2: [[back to top](#docs)]
7784

78-
To search through all your notes, use the Sublime Text’s search in project feature (Ctrl-Shift-F or Cmd-Shift-F).
85+
* To search through all your notes, use the Sublime Text’s search in project feature (Ctrl-Shift-F or Cmd-Shift-F).
7986

80-
You can use the Sublime Text sidebar to view your notes in a hierarchical fashion.
87+
* You can use the Sublime Text sidebar to view your notes in a hierarchical fashion.
8188

82-
Store the folder in Dropbox, Google Drive or Box to have it on all your computers (as well as secure a backup).
89+
* Store the folder in Dropbox, Google Drive or Box to have it on all your computers (as well as secure a backup).
8390

84-
The Python 3 script uses no extra dependencies so you can run the script out-of-the-box on any system that has Python installed (popular Linux distros and Macs for example have it by default).
91+
* The Python 3 script uses no extra dependencies so you can run the script out-of-the-box on any system that has Python installed (popular Linux distros and Macs for example have it by default).
8592

8693

8794
<a name="cp"></a>
88-
## Changing SublimeNotebook password
95+
## :six: Changing SublimeNotebook password
96+
:point_up_2: [[back to top](#docs)]
8997

9098
To change password of your Sublime Notebook, decrypt your existing notes using old `manager.py`, then exit the script in decrypted state (using "d").
9199

92100
Then start `manager.py` again to re-encrypt your notes. This time you will be asked for a new password to encrypt your notes.
93101

102+
![changing password](https://user-images.githubusercontent.com/4047597/35779512-310e70a4-09f4-11e8-9298-4243ae3fe04d.png)
103+
94104

95105
<a name="custen"></a>
96-
## Customizing which folders are encrypted
106+
## :seven: Customizing which folders are encrypted
107+
:point_up_2: [[back to top](#docs)]
97108

98109
To customize which folders are encrypted, use the `settings.json` file in `sublime_notebook/` directory.
99110

@@ -120,7 +131,8 @@ unintentional side-effects. `"is_encrypted": false` will be present in `settings
120131

121132

122133
<a name="git"></a>
123-
## Automatic git backups
134+
## :eight: Automatic git backups
135+
:point_up_2: [[back to top](#docs)]
124136

125137
> This feature comes in handy for those who don't trust cloud data storage providers. You can even use this as a second backup for your data. I personally have auto git backups set up so that my notes are stored on both Dropbox and GitHub.
126138
@@ -144,7 +156,7 @@ $ git remote add notebookbackup <GIT_REMOTE_URL>
144156

145157
The git backup will run when you re-encrypt after decrypting the notebook.
146158

147-
![git push](https://i.imgur.com/NFHZcv0.png)
159+
![git backup](https://user-images.githubusercontent.com/4047597/35779595-e2e04022-09f5-11e8-8fb6-2e808b29cdb6.png)
148160

149161
To change how frequently git backup happens, change the `git_push_interval_minutes` value in `settings.json`.
150162

@@ -158,7 +170,8 @@ To change how frequently git backup happens, change the `git_push_interval_minut
158170

159171

160172
<a name="mdext"></a>
161-
## Setting up better Markdown highlighting in Sublime Text
173+
## :nine: Setting up better Markdown highlighting in Sublime Text
174+
:point_up_2: [[back to top](#docs)]
162175

163176
* Install the packages from here.
164177

@@ -181,11 +194,13 @@ To change how frequently git backup happens, change the `git_push_interval_minut
181194
}
182195
```
183196

197+
![sublime monkai](https://camo.githubusercontent.com/e5112e65510eada23f8cdc306ba46bfe1043f201/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f3338333939342f3732363833332f30666465306431362d653133382d313165322d386533642d3864626663393132323465372e706e67)
198+
184199

185200
<a name="faq"></a>
186-
## FAQ
201+
## :keycap_ten: FAQ
202+
:point_up_2: [[back to top](#docs)]
187203

188-
Only *.txt and *.md files are detected as notes.
204+
* Only *.txt and *.md files are detected as notes.
189205

190-
You don't need to be in decrypted state to create a new note. Even when in encrypted state, you can create a note.
191-
When manager.py starts decrypting the notes, this new file will be ignored and will be encrypted when it's time to encrypt.
206+
* You don't need to be in decrypted state to create a new note. Even when in encrypted state, you can create a note. When `manager.py` starts decrypting the notes, this new file will be ignored and will be encrypted when it's time to encrypt.

sublime_notebook/message.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,13 @@
33
"""
44

55
def print_info(msg):
6-
print('\n[[ ' + msg + ' ]]\n')
6+
if msg.find('\n') > -1:
7+
print('\n' + msg)
8+
else:
9+
print('\n[[ ' + msg + ' ]]')
710

811
def print_err(msg):
9-
print('\n<< ' + msg + ' >>\n')
10-
12+
if msg.find('\n') > -1:
13+
print('\n' + msg)
14+
else:
15+
print('\n<< ' + msg + ' >>')

sublime_notebook/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def do_git_push(self):
105105
# push to remote
106106
print_info('Pushing to remote')
107107
commit_msg = "auto backup " + str(mins)
108-
out = check_output("git add . && git commit -m \"{}\" && git push notebookbackup master".format(commit_msg),
108+
out = check_output("git add -A && git commit -m \"{}\" && git push notebookbackup master".format(commit_msg),
109109
stderr=STDOUT, shell=True).decode()
110110
print_info('GIT LOG:\n\n' + out)
111111
self.json['last_git_push'] = mins

sublime_notebook/sublime_notebook.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import os
77
from sys import exit
88
from .cryptlib import get_file_list, encode, update_file, get_key, decode
9-
from .message import print_info
9+
from .message import print_info, print_err
1010
from .settings import Settings
1111
from sublime_notebook import SETTINGS_PATH
1212

@@ -28,16 +28,22 @@ def main():
2828
if not os.path.exists(SETTINGS_PATH):
2929
# new case
3030
# or decrypted state in power fail
31-
print('Not encrypted, encrypting ....')
31+
print_info('Not encrypted, encrypting ....')
3232
# create settings
33-
print_info('Created settings.json in sublime_notebook/')
33+
print_info(
34+
'Created settings.json in sublime_notebook/ directory.\n' +
35+
'By default, only the "diary" directory is privated (encrypted), you can change this setting by editing settings.json.\n' +
36+
'See the docs for more info.'
37+
)
3438
Settings._create_default_file()
3539
# get password
40+
print_info('Starting encryption process')
3641
key = get_first_time_key()
3742
update_file(encode, get_file_list(), key)
3843
# update encryption status
3944
sts = Settings()
4045
sts.change_encrypted_status(True)
46+
print_info('Sublime Notebook setup complete')
4147
else:
4248
# get settings
4349
sts = Settings()
@@ -49,11 +55,11 @@ def main():
4955
key = ''
5056
if sts.get_encrypted_status():
5157
# already encrypted
52-
print('Encrypted. Enter key to unlock')
58+
print_info('Encrypted. Enter key to unlock')
5359
key = get_key()
5460
failStatus = update_file(decode, get_file_list(), key)
5561
if failStatus:
56-
print('You entered wrong key. Fuck off!')
62+
print_err('You entered wrong key. Please try again.')
5763
exit(2)
5864
# remove encryption status
5965
sts.change_encrypted_status(False)
@@ -64,7 +70,7 @@ def main():
6470
# now decrypted
6571
ans = ''
6672
while (True):
67-
ans = input('Press "e" to encrypt\nPress "d" to stay decrypted\n> ')
73+
ans = input('Press "e" to encrypt\nPress "d" to leave decrypted\n> ')
6874
if ans == 'd' or ans == 'e':
6975
if ans == 'e' and key == '': # already decrypt case
7076
key = get_first_time_key()
@@ -73,10 +79,12 @@ def main():
7379
# encrypt
7480
update_file(encode, get_file_list(), key)
7581
sts.change_encrypted_status(True)
82+
print_info('Notes encrypted')
7683
# do git push
7784
if sts.is_git_setup():
7885
sts.do_git_push()
7986
else:
8087
# disable sublime notebook
8188
# exit as-is
89+
print_info('Notes have been left decrypted')
8290
pass

0 commit comments

Comments
 (0)