├── LICENSE
├── MIGRATION-v8.md
├── MIGRATION-v8.norg
├── README.md
├── doc
└── tags
├── docgen.py
├── norg_tutorial-v7.0.md
├── norg_tutorial-v7.0.norg
├── norg_tutorial.md
├── norg_tutorial.norg
└── static
├── build-done.png
├── lazy-uninstalled.png
├── luarocks-build.png
├── neorg-build.png
└── plugin-dir.png
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------
/MIGRATION-v8.md:
--------------------------------------------------------------------------------
1 | # Introduction
2 |
3 | I assume you are reading this article because neorg did not setup correctly with the recommended setup provided by [Vhyrro's article](https://vhyrro.github.io/posts/neorg-and-luarocks).
4 |
5 | If you haven't seen this article yet, read that. This article is aimed to troubleshoot people who already tried all options listed there.
6 |
7 | Also this article is not perfect. If you manage to solve the problem in a way that's not written here, please consider making a PR to enrich this document.
8 |
9 | # Troubleshooting
10 |
11 | Please do not run commands that are not listed here between the sections. Some commands may generate cache and will not behave the same on the second execution, which might lead to worse situations. So, let's get going. Be prepared, this is not a short journey.
12 |
13 | ## No Errors on Startup but Highlights won't Load
14 |
15 | ### Change `config =`
16 |
17 | If you have `config = true` for neorg spec change that to a function.
18 |
19 | The only working options are a) NO arguments at all or b) you at least pass `load = { ["core.defaults"] = {} }`.
20 |
21 | ``` lua
22 | {
23 | "nvim-neorg/neorg",
24 | dependencies = { "luarocks.nvim" },
25 | config = function()
26 | -- Pick one of ...
27 |
28 | -- a) NO arguments at all to setup
29 | require("neorg").setup()
30 |
31 | -- b) at least load "core.defaults"
32 | require("neorg").setup({
33 | load = {
34 | ["core.defaults"] = {},
35 | },
36 | })
37 | end,
38 | }
39 | ```
40 |
41 | ### Try to run `:=require("lua-utils")`.
42 |
43 | If you see a wall of errors, build process did not run successfully. So basically you do not have `luarocks.nvim` / `neorg` installed correctly no matter what you think.
44 |
45 | Follow all instructions I provide including [Uninstall `luarocks.nvim` / `neorg`](#uninstall-luarocksnvim--neorg).
46 |
47 | If you follow all instructions and still cannot make it to work, please visit [Discord](https://discord.gg/T6EgTAX7ht).
48 |
49 | ## Termux Users
50 |
51 | Out of luck. Luarocks cannot be executed due to weird system configuration. Stick to neorg v7.
52 |
53 | When neorg v9 is out, there will be a better treesitter parser (v3) and a mobile app for editing neorg is being developed with this parser. So you might not need termux at all?
54 |
55 | ## Install System Dependencies
56 |
57 | Install the system dependencies based on your distribution.
58 |
59 | - `sudo dnf install luajit compat-lua-devel-5.1.5`: [comment](https://github.com/nvim-neorg/neorg/issues/1342#issuecomment-2017167912)
60 | - `sudo pacman -Syu luajit lua51`: [comment](https://github.com/nvim-neorg/neorg/issues/1342#issuecomment-2017814358)
61 | - `sudo apt install luajit liblua5.1-0-dev`: [comment](https://github.com/nvim-neorg/neorg/issues/1342#issuecomment-2017728318)
62 | - `brew install luajit luarocks`: [comment](https://github.com/nvim-neorg/neorg/issues/1342#issuecomment-2020157539)
63 | - NixOS: see [NixOS](#nixos).
64 | - Termux: unavailable. See [Termux Users](#termux-users).
65 |
66 | Do not forget to update your system as well. Up to date system is always better regardless of my advice here.
67 |
68 | ## Delete `build =` Flag
69 |
70 | If you have `build = ":Neorg sync-parsers",` in your lazy spec, delete that line. Run `:Lazy build neorg`. You might see everything working now.
71 |
72 | Be careful if you are an AstroNvim user, this is set by default and there's not much you can do right now. It will be fixed soon so wait patiently.
73 |
74 | -
75 |
76 | ## Uninstall `luarocks.nvim` / `neorg`
77 |
78 | Open the lazy UI (`:Lazy`) and move your cursor to `luarocks.nvim`. Press `x` (lower `x`) to uninstall this single plugin. Do this again for `neorg`.
79 |
80 | 
81 |
82 | ## Restart Neovim
83 |
84 | Exit neovim and restart. You should see the lazy UI automatically starting and the installation of both plugins should start.
85 |
86 | If you don't see the UI, set `config.install.missing = true` for lazy's config (this is the default value).
87 |
88 | If you see these notifications and all tasks ran successfully, you are good to go. \* You might not see `pathlib.nvim >= 1.0.2` in the second image; that's OK.
89 |
90 | If you missed them, you can see the list with `:Notifications` or `:messages`.
91 |
92 |  
93 |
94 | If you don't see those notifications, try running these two commands.
95 |
96 | - `:Lazy build luarocks.nvim`
97 | - `:Lazy build neorg`
98 |
99 | Go to [Build Task Failed](#build-task-failed) if you see any of the tasks fail.
100 |
101 | If you still don't see the notifications and there is no checkmark next to the two plugins like this, please try...
102 |
103 | 
104 |
105 | 1. Open lazy UI: `:Lazy`.
106 | 2. Search `luarocks.nvim`.
107 | 3. Press `` (enter).
108 | 4. You should see information of the installed plugin.
109 | 5. Remember the path shown with `dir:`
110 | 6. Run `:source /build.lua`
111 | 1. For example in my case, I will run `:source ~/.local/share/nvim/lazy/luarocks.nvim/build.lua`.
112 |
113 |  If you successfully see the notifications, rerun the same process for neorg as well.
114 |
115 | ## Build Task Failed
116 |
117 | Read this section if any of the tasks report fail.
118 |
119 | ### No Notifications at All
120 |
121 | #### a) Install nvim-notify
122 |
123 | This should be an optional dependency but installation process might not work without this plugin. Please install [nvim-notify](https://github.com/rcarriga/nvim-notify) via lazy.nvim and try again.
124 |
125 | #### B) You Already Have Luarocks Installed
126 |
127 | Check if you already have `/.rocks/bin/luarocks`. (i.e. `~/.local/share/nvim/lazy/luarocks.nvim/.rocks/bin/luarocks`)
128 |
129 | You must have not followed the instructions somewhere. Good luck on your own.
130 |
131 | ### Cloning luarocks repository with lowest depth
132 |
133 | The clone destination already exists. You must have not followed the instructions somewhere. Good luck on your own.
134 |
135 | ### Performing luarocks `./configure` if Unix systems
136 |
137 | Most likely luarocks could not find lua header files (`lua.h`) in your system. Make sure you followed [Install System Dependencies](#install-system-dependencies) or this should not happen.
138 |
139 | Run `locate lua.h` and find the most relevant file. Pass the dirname to `luarocks_build_args` as below.
140 |
141 | #### NixOS
142 |
143 | If you are on NixOS, there are a few ways to do things, as always.
144 |
145 | One way to do this is by adding lua or luajit to your neovim's bin path. There will be a few different ways to do this depending on how you're installing neovim on NixOS, this is how [I](https://github.com/benlubas/nix-config/blob/af644f0c157182c5f5e033959ca68db968c5dc38/programs/neovim.nix) do it with plain old nix:
146 |
147 | ``` nix
148 | { lib, pkgs, ... }:
149 |
150 | let
151 | binpath = lib.makeBinPath (with pkgs; [
152 | lua # required for luarocks.nvim to work
153 | # ... other language servers and stuff only nvim needs
154 | ]);
155 | neovimConfig = pkgs.neovimUtils.makeNeovimConfig {
156 | # ... whatever else you normally have here
157 | customRC = "luafile ~/.config/nvim/init.lua";
158 | };
159 | fullConfig = (neovimConfig // {
160 | wrapperArgs = lib.escapeShellArgs neovimConfig.wrapperArgs
161 | + " --prefix PATH : ${binpath}"; # this is the important part!
162 | });
163 | in {
164 | nixpkgs.overlays = [
165 | (_: super: {
166 | neovim-custom = pkgs.wrapNeovimUnstable
167 | (super.neovim-unwrapped.overrideAttrs (oldAttrs: {
168 | buildInputs = oldAttrs.buildInputs ++ [ super.tree-sitter ];
169 | })) fullConfig;
170 | })
171 | ];
172 | environment.systemPackages = with pkgs; [
173 | neovim-custom
174 | ];
175 | }
176 | ```
177 |
178 | Another possible workaround is to tell luarocks.nvim where in the nix store you're luajit is installed. This path will vary by system, and will of course break when you update, so it's not recommended.
179 |
180 | ``` lua
181 | {
182 | "vhyrro/luarocks.nvim",
183 | opts = {
184 | luarocks_build_args = {
185 | -- NOTE: This path will be different for you.
186 | -- Find it with `nix-store --query $(which luajit)` Don't forget to add the `/include`
187 | "--with-lua-include=/nix/store/98blcb69q9qy0k279xjk10lcmfwnd4rg-luajit-2.1.1693350652/include",
188 | },
189 | },
190 | }
191 | ```
192 |
193 | ### Performing luarocks `make` if Unix systems
194 |
195 | Umm, you probably did something wrong. Ask it on [Discord](https://discord.gg/T6EgTAX7ht).
196 |
197 | ### Performing luarocks `make install` if Unix systems
198 |
199 | Umm, you probably did something wrong. Ask it on [Discord](https://discord.gg/T6EgTAX7ht).
200 |
201 | ## Update Dependencies
202 |
203 | With your favorite package manager, uninstall `wget` and reinstall.
204 |
205 | `sudo apt uninstall wget && sudo apt update && sudo apt install wget`.
206 |
207 | ## `nvim-treesitter` Does Not Load
208 |
209 | ``` lua
210 | {
211 | "nvim-neorg/neorg",
212 | dependencies = { "luarocks.nvim", "nvim-treesitter" }, -- Add nvim-treesitter here
213 | config = function()
214 | ...
215 | }
216 | ```
217 |
--------------------------------------------------------------------------------
/MIGRATION-v8.norg:
--------------------------------------------------------------------------------
1 | @document.meta
2 | title: MIGRATION-v8
3 | description: Tips and tricks for how to merge to neorg v8.
4 | authors: takuto
5 | categories:
6 | created: 2024-03-26T19:27:15+0900
7 | updated: 2024-03-31T01:02:07+0900
8 | version: 1.1.1
9 | @end
10 |
11 | * Introduction
12 |
13 | I assume you are reading this article because neorg did not setup correctly with the
14 | recommended setup provided by
15 | {https://vhyrro.github.io/posts/neorg-and-luarocks}[Vhyrro's article].
16 |
17 | If you haven't seen this article yet, read that.
18 | This article is aimed to troubleshoot people who already tried all options listed there.
19 |
20 | Also this article is not perfect.
21 | If you manage to solve the problem in a way that's not written here,
22 | please consider making a PR to enrich this document.
23 |
24 | * Troubleshooting
25 |
26 | Please do not run commands that are not listed here between the sections.
27 | Some commands may generate cache and will not behave the same on the second execution,
28 | which might lead to worse situations.
29 | So, let's get going. Be prepared, this is not a short journey.
30 |
31 | ** No Errors on Startup but Highlights won't Load
32 |
33 | *** Change `config =`
34 |
35 | If you have `config = true` for neorg spec change that to a function.
36 |
37 | The only working options are a) NO arguments at all or b) you at least pass `load = { ["core.defaults"] = {} }`.
38 | @code lua
39 | {
40 | "nvim-neorg/neorg",
41 | dependencies = { "luarocks.nvim" },
42 | config = function()
43 | -- Pick one of ...
44 |
45 | -- a) NO arguments at all to setup
46 | require("neorg").setup()
47 |
48 | -- b) at least load "core.defaults"
49 | require("neorg").setup({
50 | load = {
51 | ["core.defaults"] = {},
52 | },
53 | })
54 | end,
55 | }
56 | @end
57 |
58 | *** Try to run `:=require("lua-utils")`.
59 |
60 | If you see a wall of errors, build process did not run successfully.
61 | So basically you do not have `luarocks.nvim` / `neorg` installed correctly no matter what you think.
62 |
63 | Follow all instructions I provide including {** Uninstall `luarocks.nvim` / `neorg`}.
64 |
65 | If you follow all instructions and still cannot make it to work, please visit {https://discord.gg/T6EgTAX7ht}[Discord].
66 |
67 | ** Termux Users
68 |
69 | Out of luck. Luarocks cannot be executed due to weird system configuration.
70 | Stick to neorg v7.
71 |
72 | When neorg v9 is out, there will be a better treesitter parser (v3) and a mobile app
73 | for editing neorg is being developed with this parser.
74 | So you might not need termux at all?
75 |
76 | ** Install System Dependencies
77 |
78 | Install the system dependencies based on your distribution.
79 |
80 | - `sudo dnf install luajit compat-lua-devel-5.1.5`: {https://github.com/nvim-neorg/neorg/issues/1342#issuecomment-2017167912}[comment]
81 | - `sudo pacman -Syu luajit lua51`: {https://github.com/nvim-neorg/neorg/issues/1342#issuecomment-2017814358}[comment]
82 | - `sudo apt install luajit liblua5.1-0-dev`: {https://github.com/nvim-neorg/neorg/issues/1342#issuecomment-2017728318}[comment]
83 | - `brew install luajit luarocks`: {https://github.com/nvim-neorg/neorg/issues/1342#issuecomment-2020157539}[comment]
84 | - NixOS: see {# NixOS}.
85 | - Termux: unavailable. See {# Termux Users}.
86 |
87 | Do not forget to update your system as well.
88 | Up to date system is always better regardless of my advice here.
89 |
90 | ** Delete `build =` Flag
91 |
92 | If you have `build = ":Neorg sync-parsers",` in your lazy spec, delete that line.
93 | Run `:Lazy build neorg`. You might see everything working now.
94 |
95 | Be careful if you are an AstroNvim user, this is set by default and there's not much you can do right now.
96 | It will be fixed soon so wait patiently.
97 | - {https://github.com/AstroNvim/astrocommunity/pull/813}
98 |
99 | ** Uninstall `luarocks.nvim` / `neorg`
100 |
101 | Open the lazy UI (`:Lazy`) and move your cursor to `luarocks.nvim`.
102 | Press `x` (lower `x`) to uninstall this single plugin.
103 | Do this again for `neorg`.
104 |
105 | !{/ static/lazy-uninstalled.png}
106 |
107 | ** Restart Neovim
108 |
109 | Exit neovim and restart.
110 | You should see the lazy UI automatically starting and the installation of both plugins should start.
111 |
112 | If you don't see the UI, set `config.install.missing = true` for lazy's config (this is the default value).
113 |
114 | If you see these notifications and all tasks ran successfully, you are good to go.
115 | \* You might not see `pathlib.nvim >= 1.0.2` in the second image; that's OK.
116 |
117 | If you missed them, you can see the list with `:Notifications` or `:messages`.
118 |
119 | !{/ ./static/luarocks-build.png}
120 | !{/ ./static/neorg-build.png}
121 |
122 | If you don't see those notifications, try running these two commands.
123 | - `:Lazy build luarocks.nvim`
124 | - `:Lazy build neorg`
125 |
126 | Go to {** Build Task Failed} if you see any of the tasks fail.
127 |
128 | If you still don't see the notifications and there is no checkmark next to the two plugins like this, please try...
129 |
130 | !{/ ./static/build-done.png}
131 |
132 | ~ Open lazy UI: `:Lazy`.
133 | ~ Search `luarocks.nvim`.
134 | ~ Press `` (enter).
135 | ~ You should see information of the installed plugin.
136 | ~ Remember the path shown with `dir:`
137 | ~ Run `:source /build.lua`
138 | ~~ For example in my case, I will run `:source ~/.local/share/nvim/lazy/luarocks.nvim/build.lua`.
139 |
140 | !{/ ./static/plugin-dir.png}
141 | If you successfully see the notifications, rerun the same process for neorg as well.
142 |
143 | ** Build Task Failed
144 |
145 | Read this section if any of the tasks report fail.
146 |
147 | *** No Notifications at All
148 |
149 | **** a) Install nvim-notify
150 |
151 | This should be an optional dependency but installation process might not work without this plugin.
152 | Please install {https://github.com/rcarriga/nvim-notify}[nvim-notify] via lazy.nvim and try again.
153 |
154 | **** B) You Already Have Luarocks Installed
155 |
156 | Check if you already have `/.rocks/bin/luarocks`.
157 | (i.e. `~/.local/share/nvim/lazy/luarocks.nvim/.rocks/bin/luarocks`)
158 |
159 | You must have not followed the instructions somewhere.
160 | Good luck on your own.
161 |
162 | *** Cloning luarocks repository with lowest depth
163 |
164 | The clone destination already exists.
165 | You must have not followed the instructions somewhere.
166 | Good luck on your own.
167 |
168 | *** Performing luarocks `./configure` if Unix systems
169 |
170 | Most likely luarocks could not find lua header files (`lua.h`) in your system.
171 | Make sure you followed {** Install System Dependencies} or this should not happen.
172 |
173 | Run `locate lua.h` and find the most relevant file.
174 | Pass the dirname to `luarocks_build_args` as below.
175 |
176 | **** NixOS
177 |
178 | If you are on NixOS, there are a few ways to do things, as always.
179 |
180 | One way to do this is by adding lua or luajit to your neovim's bin path. There
181 | will be a few different ways to do this depending on how you're installing
182 | neovim on NixOS, this is how
183 | {https://github.com/benlubas/nix-config/blob/af644f0c157182c5f5e033959ca68db968c5dc38/programs/neovim.nix}[I]
184 | do it with plain old nix:
185 | @code nix
186 | { lib, pkgs, ... }:
187 |
188 | let
189 | binpath = lib.makeBinPath (with pkgs; [
190 | lua # required for luarocks.nvim to work
191 | # ... other language servers and stuff only nvim needs
192 | ]);
193 | neovimConfig = pkgs.neovimUtils.makeNeovimConfig {
194 | # ... whatever else you normally have here
195 | customRC = "luafile ~/.config/nvim/init.lua";
196 | };
197 | fullConfig = (neovimConfig // {
198 | wrapperArgs = lib.escapeShellArgs neovimConfig.wrapperArgs
199 | + " --prefix PATH : ${binpath}"; # this is the important part!
200 | });
201 | in {
202 | nixpkgs.overlays = [
203 | (_: super: {
204 | neovim-custom = pkgs.wrapNeovimUnstable
205 | (super.neovim-unwrapped.overrideAttrs (oldAttrs: {
206 | buildInputs = oldAttrs.buildInputs ++ [ super.tree-sitter ];
207 | })) fullConfig;
208 | })
209 | ];
210 | environment.systemPackages = with pkgs; [
211 | neovim-custom
212 | ];
213 | }
214 | @end
215 |
216 | Another possible workaround is to tell luarocks.nvim where in the nix store
217 | you're luajit is installed. This path will vary by system, and will of course
218 | break when you update, so it's not recommended.
219 | @code lua
220 | {
221 | "vhyrro/luarocks.nvim",
222 | opts = {
223 | luarocks_build_args = {
224 | -- NOTE: This path will be different for you.
225 | -- Find it with `nix-store --query $(which luajit)` Don't forget to add the `/include`
226 | "--with-lua-include=/nix/store/98blcb69q9qy0k279xjk10lcmfwnd4rg-luajit-2.1.1693350652/include",
227 | },
228 | },
229 | }
230 | @end
231 |
232 | *** Performing luarocks `make` if Unix systems
233 |
234 | Umm, you probably did something wrong. Ask it on {https://discord.gg/T6EgTAX7ht}[Discord].
235 |
236 | *** Performing luarocks `make install` if Unix systems
237 |
238 | Umm, you probably did something wrong. Ask it on {https://discord.gg/T6EgTAX7ht}[Discord].
239 |
240 | ** Update Dependencies
241 |
242 | With your favorite package manager, uninstall `wget` and reinstall.
243 |
244 | `sudo apt uninstall wget && sudo apt update && sudo apt install wget`.
245 |
246 | ** `nvim-treesitter` Does Not Load
247 |
248 | @code lua
249 | {
250 | "nvim-neorg/neorg",
251 | dependencies = { "luarocks.nvim", "nvim-treesitter" }, -- Add nvim-treesitter here
252 | config = function()
253 | ...
254 | }
255 | @end
256 |
257 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Norg-Tutorial
2 |
3 | > Norg tutorial with kickstart configuration.
4 |
5 | ```bash
6 | git clone https://github.com/pysan3/Norg-Tutorial.git
7 | cd Norg-Tutorial/
8 | ```
9 |
10 | I'd suggest reading [`./norg_tutorial.norg`](./norg_tutorial.norg)
11 | first to do the installation and then clone the repo locally
12 | to read `norg_tutorial.norg` in your neovim with the neorg plugin :)
13 |
14 | ## Before You Start
15 |
16 | I recommend installing these documents.
17 |
18 | - `specifications.norg`:
19 | - Complete document about the specifications of `norg` format.
20 | - `wget https://raw.githubusercontent.com/nvim-neorg/norg-specs/main/1.0-specification.norg`
21 | - No LICENSE
22 | - `neorg.norg`:
23 | - Document about how to manipulate text. e.g. **bold**, _italisize_ etc.
24 | - `wget https://raw.githubusercontent.com/nvim-neorg/neorg/main/doc/neorg.norg`
25 | - GPL v3.0
26 |
27 | ## [`norg` Tutorial](./norg_tutorial.md)
28 |
29 | - [`./norg_tutorial.norg`](./norg_tutorial.norg)
30 | - [`./norg_tutorial.md`](./norg_tutorial.md)
31 | - Generated from `./norg_tutorial.norg`. Might be inaccurate.
32 |
33 | I'd suggest reading `norg_tutorial.md` first to do the installation
34 | and then clone the repo locally to read `norg_tutorial.norg` in your neovim
35 | with the neorg plugin :)
36 |
37 | ## Watch for Updates
38 |
39 | ### RSS Feeds
40 |
41 | - `./norg_tutorial.norg`:
42 | - `./norg_tutorial.md`:
43 |
44 | ### GitHub Watch
45 |
46 | [](https://github.com/pysan3/Norg-Tutorial/)
47 |
48 | Watch the whole repo and get notifications from GitHub.
49 |
--------------------------------------------------------------------------------
/doc/tags:
--------------------------------------------------------------------------------
1 | norg-tutorial--norg-tutorial ../norg_tutorial.norg /* Norg Tutorial
2 | norg-tutorial--useful-videos ../norg_tutorial.norg /** Useful Videos
3 | norg-tutorial--how-to-get-started ../norg_tutorial.norg /* How to Get Started
4 | norg-tutorial--installation-guide ../norg_tutorial.norg /** Installation Guide
5 | norg-tutorial--kickstart-config ../norg_tutorial.norg /** Kickstart Config
6 | norg-tutorial--core.dirman ../norg_tutorial.norg /*** `core.dirman`
7 | norg-tutorial--how-to-write-your-notes ../norg_tutorial.norg /* How to Write Your Notes
8 | norg-tutorial--basics-of-modules ../norg_tutorial.norg /** Basics of Modules
9 | norg-tutorial--how-to-write-notes ../norg_tutorial.norg /** How to Write Notes
10 | norg-tutorial--heading-1 ../norg_tutorial.norg /* Heading 1
11 | norg-tutorial--heading-2 ../norg_tutorial.norg /** Heading 2
12 | norg-tutorial--links ../norg_tutorial.norg /* Links
13 | norg-tutorial--links-examples ../norg_tutorial.norg /** Links Examples
14 | norg-tutorial--attached-modifiers ../norg_tutorial.norg /* Attached Modifiers
15 | norg-tutorial--modules ../norg_tutorial.norg /* Modules
16 | norg-tutorial--notes-for-important-modules ../norg_tutorial.norg /** Notes for Important Modules
17 | norg-tutorial--core.journal ../norg_tutorial.norg /*** `core.journal`
18 | norg-tutorial--core.keybinds ../norg_tutorial.norg /*** `core.keybinds`
19 | norg-tutorial--core.export ../norg_tutorial.norg /*** `core.export`
20 | norg-tutorial--core.summary ../norg_tutorial.norg /*** `core.summary`
21 | norg-tutorial--core.tangle ../norg_tutorial.norg /*** `core.tangle`
22 | norg-tutorial--tangle-each-code-block. ../norg_tutorial.norg /**** Tangle each code block.
23 | norg-tutorial--tangle-entire-document. ../norg_tutorial.norg /**** Tangle entire document.
24 | norg-tutorial--automatically-tangle-current-file-on-save-using-autocmd. ../norg_tutorial.norg /**** Automatically tangle current file on save using `autocmd`.
25 | norg-tutorial--core.looking-glass ../norg_tutorial.norg /*** `core.looking-glass`
26 | norg-tutorial--export-/-import ../norg_tutorial.norg /** Export / Import
27 | norg-tutorial--builtin-export-module ../norg_tutorial.norg /*** Builtin Export Module
28 | norg-tutorial--export:-norganic-+-pandoc-+-norg.jl ../norg_tutorial.norg /*** Export: `norganic + pandoc + Norg.jl`
29 | norg-tutorial--export:-norg-pandoc ../norg_tutorial.norg /*** Export: `norg-pandoc`
30 | norg-tutorial--import:-pandoc-+-minorg ../norg_tutorial.norg /*** Import: `pandoc + minorg`
31 | norg-tutorial--future:-tree-sitter-v3-parser ../norg_tutorial.norg /*** Future: tree-sitter v3 parser
32 | norg-tutorial--image-support ../norg_tutorial.norg /** Image Support
33 | norg-tutorial--visualization ../norg_tutorial.norg /*** Visualization
34 | norg-tutorial--table-syntax ../norg_tutorial.norg /** Table Syntax
35 | norg-tutorial--markdown-wrapper ../norg_tutorial.norg /*** Markdown Wrapper
36 | norg-tutorial--rich-table-format ../norg_tutorial.norg /*** Rich Table Format
37 | norg-tutorial--alignments ../norg_tutorial.norg /**** Alignments
38 | norg-tutorial--table-format-examples ../norg_tutorial.norg /*** Table Format Examples
39 | norg-tutorial--macros ../norg_tutorial.norg /** Macros
40 | norg-tutorial--attached-modifier-extensions-(wip) ../norg_tutorial.norg /*** Attached Modifier Extensions (WIP)
41 | norg-tutorial--detached-modifier-extensions-(wip) ../norg_tutorial.norg /*** Detached Modifier Extensions (WIP)
42 | norg-tutorial--your-own-module ../norg_tutorial.norg /** Your Own Module
43 | norg-tutorial--explore-more-norg ../norg_tutorial.norg /* Explore More Norg
44 | norg-tutorial--github-tags ../norg_tutorial.norg /** GitHub Tags
45 | norg-tutorial--discord ../norg_tutorial.norg /** Discord
46 | norg-tutorial--tips ../norg_tutorial.norg /* Tips
47 | norg-tutorial--embed-images ../norg_tutorial.norg /** Embed Images
48 | norg-tutorial--old:-discussions ../norg_tutorial.norg /*** OLD: Discussions
49 | norg-tutorial--old:-workaround ../norg_tutorial.norg /*** OLD: Workaround
50 | norg-tutorial--sync-with-git ../norg_tutorial.norg /** Sync with Git
51 | norg-tutorial--nextcloud ../norg_tutorial.norg /*** Nextcloud
52 | norg-tutorial--after-logging-in ../norg_tutorial.norg /**** After Logging In
53 | norg-tutorial--on-your-phone ../norg_tutorial.norg /**** On Your Phone
54 | norg-tutorial--notes ../norg_tutorial.norg /**** Notes
55 |
--------------------------------------------------------------------------------
/docgen.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | # TODO: gendoc CI on push?
3 | import re
4 |
5 | def strip_head(s):
6 | return s.strip().lower().replace("`", "").replace("*", "").replace(" ", "-")
7 |
8 | with open('./norg_tutorial.norg') as file:
9 | lines = file.read().strip()
10 |
11 | headings = re.findall(r"^\s*(\*+ [a-zA-Z0-9_\-\.\ :`\/\+\(\)]+)", lines, re.MULTILINE)
12 |
13 | res = ""
14 | for head in headings:
15 | res += f"norg-tutorial-{strip_head(head)}\t../norg_tutorial.norg\t/{head}\n"
16 |
17 |
18 | with open('./doc/tags', 'w') as f:
19 | f.write(res)
20 |
--------------------------------------------------------------------------------
/norg_tutorial-v7.0.md:
--------------------------------------------------------------------------------
1 | # Norg Tutorial
2 |
3 | \*This page is generated from [`./norg_tutorial.norg`](./norg_tutorial.norg)
4 |
5 | I'd suggest reading [`./norg_tutorial.md`](https://github.com/pysan3/Norg-Tutorial/blob/main/norg_tutorial.md) first to do the installation and then clone the repo locally to read [How to Write Notes](norg_tutorial.norg#how-to-write-notes) in your neovim with the neorg plugin :)
6 |
7 | ## Useful Videos
8 |
9 | - [From No Org to Neorg - Playlist](https://www.youtube.com/watch?v=NnmRVY22Lq8&list=PLx2ksyallYzVI8CN1JMXhEf62j2AijeDa)
10 | - [From No Org to Neorg - The Basics \| \#1](https://youtu.be/NnmRVY22Lq8)
11 | - [From No Org to Neorg - Workflow, Links \| \#2](https://youtu.be/Bi9JiW5nSig)
12 | - ...
13 |
14 | I highly recommend you watch these videos by `Vhyrro`, the main contributor of [Neorg](https://github.com/nvim-neorg/neorg/) plugin. He says he'll start a devlog series soon as well.
15 |
16 | # How to Get Started
17 |
18 | The current implementations of `norg` format is mostly done with the [Neorg](https://github.com/nvim-neorg/neorg/) plugin.
19 |
20 | ## Installation Guide
21 |
22 | Read this section. [Installation / Quickstart](https://github.com/nvim-neorg/neorg/#-installationquickstart)
23 |
24 | - I'd recommend following the `Treesitter` section as well to install `tree-sitter-norg` spec.
25 | - `run = ":Neorg sync-parsers",`
26 | - **Mac Users**: ensure that the CC environment variable points to a compiler that has C++14 support.
27 | - Details written in github README.
28 | - [Issue and How to solve](https://github.com/nvim-neorg/tree-sitter-norg/issues/7#issuecomment-1291508121)
29 |
30 | ## Kickstart Config
31 |
32 | Here is my basic config. I'll explain about `modules` in [Modules](#modules).
33 |
34 | ``` lua
35 | -- lazy.nvim spec
36 | local M = {
37 | "nvim-neorg/neorg",
38 | ft = "norg",
39 | dependencies = {
40 | "nvim-treesitter/nvim-treesitter",
41 | "nvim-treesitter/nvim-treesitter-textobjects",
42 | "nvim-cmp",
43 | "nvim-lua/plenary.nvim",
44 | },
45 | build = ":Neorg sync-parsers",
46 | cmd = "Neorg",
47 | }
48 | local modules = {
49 | ["core.defaults"] = {},
50 | ["core.completion"] = { config = { engine = "nvim-cmp", name = "[Norg]" } },
51 | ["core.integrations.nvim-cmp"] = {},
52 | ["core.concealer"] = { config = { icon_preset = "diamond" } },
53 | ["core.keybinds"] = {
54 | -- https://github.com/nvim-neorg/neorg/blob/main/lua/neorg/modules/core/keybinds/keybinds.lua
55 | config = {
56 | default_keybinds = true,
57 | neorg_leader = "",
58 | },
59 | },
60 | ["core.dirman"] = {
61 | config = {
62 | workspaces = {
63 | Notes = "~/Nextcloud/Notes",
64 | Work = "~/Nextcloud/Work",
65 | }
66 | }
67 | },
68 | }
69 | M.opts = {
70 | load = modules,
71 | }
72 | return M
73 | ```
74 |
75 | If you still have problems setting up `neorg`, `@d-r-a-b` explains more thoroughly in [Understanding Neorg dependencies](https://gist.github.com/d-r-a-b/3af7083a018be15e6c1d1d2c5317e9c7). I'd really recommend this as well.
76 |
77 | ### `core.dirman`
78 |
79 | This module manages what are called *workspaces*.
80 |
81 | You can define multiple workspaces at `config["core.dirman"].config.workspaces`, and open with command `:Neorg workspace `. This command opens `/path/to/workspace/index.norg` which is like the entry point file.
82 |
83 | Norg files inside a workspace can be linked with `{:$/path/to/file:}`. So for example, inside workspace `Notes = "~/Nextcloud/Notes"`, `~/Nextcloud/Notes/journal/2023-04-16.norg` would be `{:$Notes/journal/2023-04-16:}`. Or, it can be abbreviated to `$/` when referring from files in the same workspace. More info in [Links](#links) section.
84 |
85 | # How to Write Your Notes
86 |
87 | ## Basics of Modules
88 |
89 | There is a config option `config.load = {}` to define modules you want to use.
90 |
91 | I decomposed that into a local var `modules` in above code for simplicity tho.
92 |
93 | More information about modules in [Modules](#modules) section. I'd recommend just simply adding the ones already stated in [Kickstart Config](#kickstart-config).
94 |
95 | ## How to Write Notes
96 |
97 | Below text is a sample note which explains about the norg syntax.
98 |
99 | Run `:Neorg toggle-concealer` to see the raw text.
100 |
101 | # Heading 1
102 |
103 | - Spec: [Structural Detached Modifiers](1.0-specification.norg#structural-detached-modifiers)
104 | - This links to a local copy of .
105 | - Read [Before you start](https://github.com/pysan3/Norg-Tutorial#before-you-start) and download these files.
106 |
107 | Normal text here. Single new line will be ignored.
108 |
109 | Double new lines mean a new paragraph.
110 |
111 | ## Heading 2
112 |
113 | Indentation of normal text is advised to align with the start of the heading name. See? The indentation of this text is different from the ones in [Heading 1](#heading-1).
114 |
115 | Oh, BTW that's how you create in-document links. Literal heading name wrapped in `{}`. Press `` on the link to jump to the definition. (case, space **in**-sensitive, punctuation **sensitive**). More about links in [links](#links)
116 |
117 | With `---`, you can decrease the heading level. This text is inside [Heading 1](#heading-1) again.
118 |
119 | - Bullet List
120 | - Spec: [Unordered Lists](1.0-specification.norg#unordered-lists)
121 | - Second level bullet is with `--` and not an indented `-`.
122 | - Third level
123 | - Second level
124 | - In insert mode, press `` to create a new bullet.
125 | - Press ``, `` to increase, decrease the level.
126 | - More info can be found [Wiki - Indent](https://github.com/nvim-neorg/neorg/wiki/Indent) or [Raw code](https://github.com/nvim-neorg/neorg/blob/main/lua/neorg/modules/core/keybinds/keybinds.lua).
127 |
128 | 1. Numbered List
129 | 1. Spec: [Ordered Lists](1.0-specification.norg#ordered-lists)
130 | 2. It's `~`, not `1.` (Tho the conceal makes it look like that)
131 |
132 | - Can be mixed with bullets as well (not in markdown tho).
133 |
134 | 1. Second
135 |
136 | > Quotes
137 | >
138 | > > Spec: [Quotes](1.0-specification.norg#quotes)
139 | > >
140 | > > Quote level 2
141 |
142 | - You can use [TODO lists](1.0-specification.norg#todo-status-extension) in combination with these lists.
143 | - I highly suggest reading this section as well.
144 |
145 | # Links
146 |
147 | - Spec: [Link Location](1.0-specification.norg#link-location)
148 |
149 | There are so so many types of useful links in `norg`. You can also press `` on all links to open the appropriate application. (e.g. urls are opened in the browser.)
150 |
151 | Again, `Vhyrro` does a great job explaining about links in his video, [From No Org to Neorg \#2: 17:44~](https://youtu.be/Bi9JiW5nSig?t=17m44s) so go ahead and watch that video.
152 |
153 | ## Links Examples
154 |
155 | - URL: `{https://xxx.example.com}`
156 | - URL with name: [Neorg GitHub](https://github.com/nvim-neorg/neorg/)
157 | - Norg files
158 | - Relative to current file: `{:foo/bar:}` -\> `foo/bar.norg`
159 | - Absolute path: `{:/tmp/foo/bar:}` -\> `/tmp/foo/bar.norg`. (Also works with `~/` = `$HOME/`)
160 | - Relative to current workspace: `{:$/foo/bar:}` -\> `~/Norg/Notes/foo/bar.norg`
161 | - Relative to different workspace: `{:$work/foo/bar:}` -\> `~/Norg/work/foo/bar.norg`
162 | - Usual files: `{/ /path/to/file}`
163 | - Headings: [Heading 1](#heading-1)
164 | - Any level heading: [Heading 2](#heading-2)
165 |
166 | **AND YOU CAN COMBINE THEM**
167 |
168 | - `Heading 1` of `foo/bar.norg`: [Heading 1](foo/bar.norg#heading-1)
169 | - Line numbers: [foo/bar](foo/bar.norg)
170 |
171 | # Attached Modifiers
172 |
173 | - \*bold\*: **bold**
174 | - /italic/: *italic*
175 | - \_underline\_: underline
176 | - \-strike-through-: ~~strike-through~~
177 | - !spoiler!: spoiler
178 | - ^superscript^: superscript (cannot be nested into `subscript`)
179 | - ,subscript,: subscript (cannot be nested into `superscript`)
180 | - \`inline code\`: `inline code` (disables any nested markup - verbatim)
181 | - %[null modifier](#null-modifier)%:
182 | - \$inline math\$: $f(x) = y$ (verbatim)
183 | - &variable&: variable (verbatim)
184 |
185 | # Modules
186 |
187 | Keys passed to `config.load` are name of modules. Their documents can be found in [Neorg - Wiki](https://github.com/nvim-neorg/neorg/wiki) -\> Pages.
188 |
189 | I already mentioned the necessary ones in [Kickstart Config](#kickstart-config), but here are ones I personally use on top of them.
190 |
191 | ``` lua
192 | local modules = {
193 | ... -- ones mentioned in {** Kickstart Config}
194 | ["core.esupports.metagen"] = { config = { type = "auto", update_date = true } },
195 | ["core.qol.toc"] = {},
196 | ["core.qol.todo_items"] = {},
197 | ["core.looking-glass"] = {},
198 | ["core.presenter"] = { config = { zen_mode = "zen-mode" } },
199 | ["core.export"] = {},
200 | ["core.export.markdown"] = { config = { extensions = "all" } },
201 | ["core.summary"] = {},
202 | ["core.tangle"] = { config = { report_on_empty = false } },
203 | ["core.ui.calendar"] = {},
204 | ["core.journal"] = {
205 | config = {
206 | strategy = "flat",
207 | workspace = "Notes",
208 | },
209 | },
210 | }
211 | ```
212 |
213 | ## Notes for Important Modules
214 |
215 | ### `core.journal`
216 |
217 | -
218 |
219 | This adds commands `:Neorg journal {today,tomorrow,yesterday}`, which opens norg file with the appropriate date as name. Also, take a look at [`core.ui.calendar`](https://github.com/nvim-neorg/neorg/wiki/Calendar) to add `:Neorg journal custom` command to choose a date with a calendar UI.
220 |
221 | Great for diary :)
222 |
223 | ### `core.keybinds`
224 |
225 | -
226 |
227 | To register `norg` file specific keybinds, read this section: [Neorg - Wiki - User-Keybinds - Setting Up a Keybind Hook](https://github.com/nvim-neorg/neorg/wiki/User-Keybinds#setting-up-a-keybind-hook).
228 |
229 | The default keybinds are listed [here](https://github.com/nvim-neorg/neorg/blob/main/lua/neorg/modules/core/keybinds/keybinds.lua).
230 |
231 | ### `core.export`
232 |
233 | -
234 |
235 | You will want [`core.export.markdown`](https://github.com/nvim-neorg/neorg/wiki/Markdown-Export) as well to export your files to markdown format.
236 |
237 | Read [Export / Import](#export--import) section for instructions for other filetypes in detail.
238 |
239 | ### `core.summary`
240 |
241 | -
242 |
243 | Use `:Neorg generate-workspace-summary` to generate a summary of the entire workspace with links to each respective entry.
244 |
245 | It seems that it has some bugs that are being worked on.
246 |
247 | - ✅ ~~~~
248 | -
249 |
250 | ### `core.tangle`
251 |
252 | -
253 |
254 | Use `:Neorg tangle current-file` to export the code blocks in the current file into another file.
255 |
256 | Basics are listed below, but you've got more options to control the output. See the [official wiki](https://github.com/nvim-neorg/neorg/wiki/Tangling#usage-tutorial) for more information.
257 |
258 | #### Tangle each code block.
259 |
260 | ``` norg
261 | #tangle init.lua
262 | @code lua
263 | -- This will be tangled to init.lua
264 | print("Hello from init.lua!")
265 | @end
266 | ```
267 |
268 | #### Tangle entire document.
269 |
270 | Specify output file inside `@document.meta`.
271 |
272 | - Want to export to multiple files? =\> [More complex options.](https://github.com/nvim-neorg/neorg/wiki/Tangling#global-tangling-for-multiple-files)
273 |
274 | ``` norg
275 | @document.meta
276 | tangle: ./init.lua
277 | @end
278 |
279 | @code lua
280 | -- This will be tangled to init.lua
281 | print("Hello from init.lua!")
282 | @end
283 |
284 | #tangle.none
285 | @code lua
286 | -- Ignore this code block
287 | print("Not tangled.")
288 | @end
289 | ```
290 |
291 | #### Automatically tangle current file on save using `autocmd`.
292 |
293 | ``` lua
294 | vim.api.nvim_create_autocmd("BufWritePost", {
295 | pattern = "*.norg",
296 | command = "Neorg tangle current-file",
297 | })
298 | ```
299 |
300 | ### `core.looking-glass`
301 |
302 | -
303 |
304 | Use `:Neorg keybind all core.looking-glass.magnify-code-block` to edit code blocks in an external buffer, which allows LSPs and other language-specific tools to kick in.
305 |
306 | 
307 |
308 | ## Export / Import
309 |
310 | You can convert your `norg` notes from / to different formats. You've got mainly three options to export and one to import. For exporting, I find [Export: `norg-pandoc`](#export-norgpandoc) the most stable at the moment (2023-11-05) but [Export: `norganic + pandoc + Norg.jl`](#export-norganic--pandoc--norgjl) works pretty well as well.
311 |
312 | ### Builtin Export Module
313 |
314 | `:Neorg export to-file foo.md` -\> Exports to `foo.md` in markdown format.
315 |
316 | This only supports markdown and the conversion is not very reliable. However, you can use this as a neovim command, so it's the easiest among others.
317 |
318 | This is a function to export to `suffix` with the same dir and name of current file.
319 |
320 | ``` lua
321 | local export_file = function(suffix, open_preview)
322 | local dst = vim.fn.fnamemodify(vim.fn.expand("%"), ":~:.:r") .. suffix -- same name but with suffix
323 | vim.cmd(string.format([[Neorg export to-file %s]], string.gsub(dst, " ", [[\ ]])))
324 | vim.schedule(function()
325 | vim.cmd.edit(dst)
326 | if suffix == ".md" and open_preview then
327 | vim.cmd([[MarkdownPreview]]) -- https://github.com/iamcco/markdown-preview.nvim
328 | end
329 | end)
330 | end
331 | -- export_file(".md", true)
332 | ```
333 |
334 | ### Export: `norganic + pandoc + Norg.jl`
335 |
336 | [`Norg.jl`](https://github.com/Klafyvel/Norg.jl/) is a project to parse norg format file written in julia. [`norganic`](https://github.com/klafyvel/norganic) is a frontend of `Norg.jl` to use the tool from command line.
337 |
338 | For installation document, please read norganic's [README](https://github.com/klafyvel/norganic).
339 |
340 | - Example usage:
341 | - Convert norg file to html file.
342 |
343 | ``` bash
344 | $ norganic html --input /path/to/file.norg --output /path/to/file.html
345 | ```
346 |
347 | - Convert norg file to arbitrary file using `pandoc`.
348 | - norganic can output specific json format that pandoc understands and can convert to any format of file.
349 | - Note that things might not work here and there.
350 |
351 | ``` bash
352 | $ norganic json --input /path/to/file.norg | pandoc -f json -t /path/to/output.xxx
353 | ```
354 |
355 | ### Export: `norg-pandoc`
356 |
357 | [`norg-pandoc`](https://github.com/boltlessengineer/norg-pandoc) is a plugin for pandoc to parse norg format written in lua. A parser in directly added to pandoc, but you have to git clone and run pandoc inside `norg-pandoc`'s directory (or add this dir to lua's runtime path I guess?), so it is kinda cumbersome to run.
358 |
359 | ``` bash
360 | $ git clone https://github.com/boltlessengineer/norg-pandoc.git
361 | $ cd norg-pandoc
362 | $ pandoc -f init.lua -t gfm /path/to/file.norg -o /path/to/output.md
363 | # gfm (GitHub flavored markdown)
364 | ```
365 |
366 | [./norg_tutorial.md](./norg_tutorial.md) is generated using this tool with a combination of [my custom script](https://github.com/pysan3/dotfiles/blob/main/static/remove_empty_lines_in_lists.py) to remove unnecessary newlines when exporting to markdown at the moment.
367 |
368 | ``` bash
369 | $ pandoc -f init.lua -t gfm /path/to/norg_tutorial.norg | python remove_empty_lines_in_lists.py > /path/to/norg_tutorial.md
370 | ```
371 |
372 | ### Import: `pandoc + minorg`
373 |
374 | [`minorg`](https://github.com/pysan3/minorg) is a tool to convert pandoc json format to norg file. Theoretically, it should be able to convert from all file formats that pandoc supports (and it's extensions).
375 |
376 | Please install the tool via [minorg - Releases](https://github.com/pysan3/minorg/releases)
377 |
378 | - Example usage:
379 | - Convert from markdown.
380 |
381 | ``` bash
382 | $ pandoc -f markdown -t json /path/to/input/file.md | minorg generate -o /path/to/output.norg
383 | ```
384 |
385 | - Convert Obsidian files.
386 | - Obsidian markdown flavor is a bit out of the standards and pandoc fails to parse it correctly.
387 | - I've implemented some workarounds specifically for obsidian style markdowns.
388 |
389 | ``` bash
390 | $ pandoc -f markdown -f json /path/to/obsidian/file.md | minorg generate -o /path/to/output.norg --isObsidian --workRootDir=/path/to/workspace
391 | ```
392 |
393 | - For more usage examples (for example convert whole dir recursively), please read the [README](https://github.com/pysan3/minorg).
394 | - BTW, I'm the author of this cli tool, so if you have any problem, don't hesitate to send me an issue or feature request.
395 |
396 | ### Future: tree-sitter v3 parser
397 |
398 | The tree-sitter parser for norg format version 3 is being worked at the moment. I've not been able to follow the development closely but I heard that it might work if you compile locally at the moment (2023-11-06).
399 |
400 | After this parser is complete, we should be able to write a working importer / exporter with the output of the parser to plug into pandoc to have a reliable result.
401 |
402 | ## Image Support
403 |
404 | Image support in norg file is partially done, partially not.
405 |
406 | The syntax is like below and the second format is currently discussed for inline images.
407 |
408 | ``` norg
409 | %preferred image syntax, image.nvim supports this out of the box%
410 | .image /path/to/image.png
411 |
412 | %inline image syntax being discussed. No real implementation or parser supports this yet%
413 | {url}[alt text](image)
414 | {/ /path/to/img.png}[alt text](image)
415 | ```
416 |
417 | Parser or especially the [Builtin Export Module](#builtin-export-module) does not fully support this. Read [Embed Images](#embed-images) if you want a workaround to have a working markdown export now.
418 |
419 | ### Visualization
420 |
421 | [`image.nvim`](https://github.com/3rd/image.nvim) is an awesome plugin that can inject the images inside the neovim buffer if you use *kitty-graphics-protocol* compatible terminal.
422 |
423 | [Working example GIF](https://github.com/nvim-neorg/neorg/issues/971#issuecomment-1620775558).
424 |
425 | ## Table Syntax
426 |
427 | The table syntax is one of the most powerfull, but really tricky thing in norg's specification. I will try my best to explain. Even if it's hard to comprehend, skim through til the [Table Format Examples](#table-format-examples) section and you might get the hang of it.
428 |
429 | There are two syntax to define a table, one easy but limited and one that is very extensible.
430 |
431 | ### Markdown Wrapper
432 |
433 | This format is very easy. It is basically the same as markdown table format wrapped in `@table - @end`.
434 |
435 | One pro is that it should work with some markdown exporter at the momemt.
436 |
437 | ``` norg
438 | @table
439 | | Head a | Head b | Head c |
440 | | - | - | - |
441 | | Cell 1 | Cell 2 | Cell 3 |
442 | | Cell 4 | Cell 5 | Cell 6 |
443 | @end
444 | ```
445 |
446 | ### Rich Table Format
447 |
448 | This table format has infinite size table and you can specify the cell positions with movement (relative) commands.
449 |
450 | Here are the three ways to write a cell. It consists of `: : cell content`.
451 |
452 | ``` norg
453 | %basic format%
454 | : .
455 | cell content
456 |
457 | %shorthand syntax when content fits in single line%
458 | : . : cell content
459 |
460 | %multi line content syntax. you also need the closing :: below%
461 | :: .
462 | - cell
463 | - content
464 | ::
465 | ```
466 |
467 | Now let's talk about the movements. These should go into the `.` part in the above example. In this example, `A1` means first row, first column, `C2` means **second row (2)**, **third column (C)**. Look at `MS Excel` for more visual explanation.
468 |
469 | - `.`: Top left (A1) of the table.
470 | - `>` / `<`: Go one left / right.
471 | - You can prefix number to move multiple times. `3>` moves three right.
472 | - `^` / `v`: Go one up / down. Also combine with numbers.
473 | - `_`: Move to leftmost column on the next row. (If on `D1` and `_` will go to `A2`)
474 | - `/`: Like `_` but vertically. Move one right and to the top. Imagine an upper-right arrow (↗️).
475 |
476 | One special case is that when you go `<` on `A?` (left most column), it will wrap around and go to the cell one row above and all the way to the right (that has content). (`A2` -\> `<` -\> `X1`)
477 |
478 | Another option other than relative movement is to specify absolute cell position.
479 |
480 | - `: A1 : cell content`: Position `A1`.
481 | - `: B1 : second cell`: Obviously cell next to `A1`.
482 | - `: A1-A4 : multi row cell`: You can specify a multi row / column cell with this format.
483 |
484 | #### Alignments
485 |
486 | You can align the cell content with `+align right` above the cell row. Note that these are still **very work in progress** and neither the exporter nor the parser understand it, and *might even change in the future*. Other variances are...
487 |
488 | - `+align left`: align a single cell
489 | - `#align center`: align all cells to the center after this line
490 | - `#align.columns A right`: align all cells in `A` column
491 |
492 | ### Table Format Examples
493 |
494 | Let's wrap our heads around with some examples. The following tables represent the same thing.
495 |
496 | ``` norg
497 | @table
498 | (This is not a valid table, just added the wrapper to avoid parser errors)
499 | | Head a | Head b | Head c |
500 | | --------- | --------- | --------- |
501 | | multi | multi col cell |
502 | | row | --------- | --------- |
503 | | cell | Cell 5 | Cell 6 |
504 | | --------- | --------- | --------- |
505 | @end
506 |
507 | #align left
508 | : . : Head a
509 | +align right
510 | : > : Head b
511 | +align center
512 | : > : Head c
513 | : A2-A3 : multi row cell
514 | : B2-C2 : multi col cell
515 | #align right
516 | : _> : Cell 5
517 | : > : Cell 6
518 | ```
519 |
520 | The following mimics table in [Markdown Wrapper](#markdown-wrapper). Although you can totally express this table with only `. > _`, I purposely used different notations as well. BTW, there are no ways to express `` cells at the moment. The format is being discussed at [Discord](#discord) right now (2023-11-06).
521 |
522 | ``` norg
523 | : . : Head a
524 | : B1 : Head b
525 | : C1
526 | Head c
527 | : _ : Cell 1
528 | : 5>4<
529 | Cell 2
530 | :: >
531 | Cell 3
532 | ::
533 | : >>>_ : Cell 4
534 | : /2v : Cell 5
535 | : _2>^ : Cell 6
536 | ```
537 |
538 | ## Macros
539 |
540 | Macros in norg format starts with one of (`#`, `@`, `.`, `|`) and can invoke a function written in [Janet Langauge](https://janet-lang.org/). You've already seen this with `#align`, `@table`, `.image`, `|example` and so on. The spec hasn't matured yet but we are working on it steadily. We will see things like `+color:red` and many more interesting ones that connects to database soon ~~I mean pretty in long term...~~.
541 |
542 | ### Attached Modifier Extensions (WIP)
543 |
544 | Macros or labels attached on attached modifiers.
545 |
546 | Best example is the below where `(lang:norg)` extends the inline code block (backticks).
547 |
548 | ``` norg
549 | - `* Heading`(lang:norg)
550 | ```
551 |
552 | ### Detached Modifier Extensions (WIP)
553 |
554 | Kind of like a tag attached to headings, bullet points and some other stuffs.
555 |
556 | Best example is the todo items where `- (x) item` means that this bullet point has attribute *TODO item* and *IS DONE*. These modifiers can be chained together with a pipe (`|`). Below example means a heading that is *TODO item* and *PENDING* and *PRIORITY A (A is highest)*.
557 |
558 | ``` norg
559 | * (-|# A) Heading 1
560 | ```
561 |
562 | ## Your Own Module
563 |
564 | If you want to create your own module for neorg, this video is very useful. [YouTube - Neorg Custom Modules](https://www.youtube.com/watch?v=j4lTvIGRhmw&list=PLxpY86LRR3B0rtOBjXAsq1XnsOt4m4owu)
565 |
566 | Here's one external module I implemented: [neorg-templates](https://github.com/pysan3/neorg-templates), which adds support for template files with the power of `LuaSnip`.
567 |
568 | Feel free to explorer the code.
569 |
570 | # Explore More Norg
571 |
572 | ## [Awesome Neorg](https://github.com/NTBBloodbath/awesome-neorg)
573 |
574 | > A collection of awesome Neorg notes, software and resources.
575 |
576 | - You might find more useful neorg external modules to integrate to your workflow.
577 |
578 | ## [Other Official Projects](https://github.com/orgs/nvim-neorg/repositories)
579 |
580 | There are many other projects going on around the `norg` format.
581 |
582 | ## GitHub Tags
583 |
584 | Of course you can search through GitHub with tags.
585 |
586 | - `norg`:
587 | - More likely to find external modules.
588 | - `neorg`
589 | - More likely to find personal dotfiles and other configs.
590 |
591 | ## Discord
592 |
593 | More, alpha stage concepts are discussed in the Discord channel.
594 |
595 | Feel free to join:
596 |
597 | # Tips
598 |
599 | ## Embed Images
600 |
601 | **This section is old.** Read [Image Support](#image-support) for new information. ~~As far as I know, there are **NO** specifications about how to embed / link to an image.~~
602 |
603 | Update: 2023-10-19.
604 |
605 | - Spec for image added: .
606 |
607 | ``` norg
608 | .image /path/to/image.png
609 | ```
610 |
611 | - There are also some attempts to add image preview support thanks to [image.nvim](https://github.com/3rd/image.nvim).
612 | -
613 | - Markdown export and treesitter parsing is not yet *fully* implemented, so I'd suggest using the old workaround described below for now.
614 |
615 | ### OLD: Discussions
616 |
617 | - [Is there any way to insert a image just like kitty icat does \#768](https://github.com/nvim-neorg/neorg/discussions/768)
618 | - [render.nvim \#791](https://github.com/nvim-neorg/neorg/discussions/791)
619 |
620 | ### OLD: Workaround
621 |
622 | As a workaround, funny enough, you can prepend a link with `!` like `!{path}[name]` to link to an image, which will be correctly converted to image tag when exported to markdown files. (Of course this only works with markdown and I hope this will not become the correct way.)
623 |
624 | ``` norg
625 | !{https://user-images.githubusercontent.com/76052559/150838408-1a021d7b-1891-4cab-b16e-6b755e741e87.png}[Norg format]
626 | ```
627 |
628 | Example: 
629 |
630 | ## Sync with Git, Nextcloud, etc
631 |
632 | **BACKUP YOUR NOTES**
633 |
634 | ### Nextcloud, Edit on Your Phone
635 |
636 | If you use selfhosted Nextcloud, you can edit your `norg` notes from your phone.
637 |
638 | #### After Logging In
639 |
640 | 1. Install [Notes app](https://apps.nextcloud.com/apps/notes)
641 | 2. Go to
642 | 3. Go down to `Notes settings`
643 | 4. Change `File extension for new notes`
644 | 1. `User defined` -\> `.norg`
645 |
646 | #### On Your Phone
647 |
648 | 1. Access page with safari. I'm sorry but I use iPhone...
649 | 1. Shoud work on other phones as well tho.
650 | 2. Go to
651 | 3. Press `share` to `Add page to home`.
652 | 4. You have a new app that jumps directly to notes
653 |
654 | #### Notes
655 |
656 | - Might not work if you have [Text](https://github.com/nextcloud/text) app installed
657 |
--------------------------------------------------------------------------------
/norg_tutorial-v7.0.norg:
--------------------------------------------------------------------------------
1 | @document.meta
2 | title: Norg Tutorial
3 | description:
4 | authors: takuto
5 | categories:
6 | created: 2023-11-05T15:01:09+0900
7 | updated: 2024-02-14T12:18:13+0900
8 | version: 1.1.1
9 | @end
10 |
11 | * Norg Tutorial
12 | *This page is generated from {./norg_tutorial.norg}[`./norg_tutorial.norg`]
13 |
14 | I'd suggest reading {https://github.com/pysan3/Norg-Tutorial/blob/main/norg_tutorial.md}[`./norg_tutorial.md`]
15 | first to do the installation and then clone the repo locally to read {:norg_tutorial:** How to Write Notes}
16 | in your neovim with the neorg plugin :)
17 |
18 | ** Useful Videos
19 | - {https://www.youtube.com/watch?v=NnmRVY22Lq8&list=PLx2ksyallYzVI8CN1JMXhEf62j2AijeDa}[From No Org to Neorg - Playlist]
20 | -- {https://youtu.be/NnmRVY22Lq8}[From No Org to Neorg - The Basics | #1]
21 | -- {https://youtu.be/Bi9JiW5nSig}[From No Org to Neorg - Workflow, Links | #2]
22 | -- ...
23 |
24 | I highly recommend you watch these videos by `Vhyrro`, the main contributor of {https://github.com/nvim-neorg/neorg/}[Neorg] plugin.
25 | He says he'll start a devlog series soon as well.
26 |
27 | * How to Get Started
28 | The current implementations of `norg` format is mostly done with the {https://github.com/nvim-neorg/neorg/}[Neorg] plugin.
29 |
30 | ** Installation Guide
31 | Read this section. {https://github.com/nvim-neorg/neorg/#-installationquickstart}[Installation / Quickstart]
32 |
33 | - I'd recommend following the `Treesitter` section as well to install `tree-sitter-norg` spec.
34 | -- `run = ":Neorg sync-parsers",`
35 | - *Mac Users*: ensure that the CC environment variable points to a compiler that has C++14 support.
36 | -- Details written in github README.
37 | -- {https://github.com/nvim-neorg/tree-sitter-norg/issues/7#issuecomment-1291508121}[Issue and How to solve]
38 |
39 | ** Kickstart Config
40 | Here is my basic config. I'll explain about `modules` in {* Modules}.
41 |
42 | @code lua
43 | -- lazy.nvim spec
44 | local M = {
45 | "nvim-neorg/neorg",
46 | ft = "norg",
47 | dependencies = {
48 | "nvim-treesitter/nvim-treesitter",
49 | "nvim-treesitter/nvim-treesitter-textobjects",
50 | "nvim-cmp",
51 | "nvim-lua/plenary.nvim",
52 | },
53 | build = ":Neorg sync-parsers",
54 | cmd = "Neorg",
55 | }
56 | local modules = {
57 | ["core.defaults"] = {},
58 | ["core.completion"] = { config = { engine = "nvim-cmp", name = "[Norg]" } },
59 | ["core.integrations.nvim-cmp"] = {},
60 | ["core.concealer"] = { config = { icon_preset = "diamond" } },
61 | ["core.keybinds"] = {
62 | -- https://github.com/nvim-neorg/neorg/blob/main/lua/neorg/modules/core/keybinds/keybinds.lua
63 | config = {
64 | default_keybinds = true,
65 | neorg_leader = "",
66 | },
67 | },
68 | ["core.dirman"] = {
69 | config = {
70 | workspaces = {
71 | Notes = "~/Nextcloud/Notes",
72 | Work = "~/Nextcloud/Work",
73 | }
74 | }
75 | },
76 | }
77 | M.opts = {
78 | load = modules,
79 | }
80 | return M
81 | @end
82 |
83 | If you still have problems setting up `neorg`, `@d-r-a-b` explains more thoroughly in
84 | {https://gist.github.com/d-r-a-b/3af7083a018be15e6c1d1d2c5317e9c7}[Understanding Neorg dependencies].
85 | I'd really recommend this as well.
86 |
87 | *** `core.dirman`
88 | This module manages what are called /workspaces/.
89 |
90 | You can define multiple workspaces at `config["core.dirman"].config.workspaces`, and open with
91 | command `:Neorg workspace `.
92 | This command opens `/path/to/workspace/index.norg` which is like the entry point file.
93 |
94 | Norg files inside a workspace can be linked with `{:$/path/to/file:}`.
95 | So for example, inside workspace `Notes = "~/Nextcloud/Notes"`,
96 | `~/Nextcloud/Notes/journal/2023-04-16.norg` would be `{:$Notes/journal/2023-04-16:}`.
97 | Or, it can be abbreviated to `$/` when referring from files in the same workspace. More info in {* Links} section.
98 |
99 | * How to Write Your Notes
100 | ** Basics of Modules
101 | There is a config option `config.load = {}` to define modules you want to use.
102 |
103 | ,I decomposed that into a local var `modules` in above code for simplicity tho.,
104 |
105 | More information about modules in {* Modules} section.
106 | I'd recommend just simply adding the ones already stated in {** Kickstart Config}.
107 |
108 | ** How to Write Notes
109 | Below text is a sample note which explains about the norg syntax.
110 |
111 | Run `:Neorg toggle-concealer` to see the raw text.
112 |
113 | * Heading 1
114 | - Spec: {:1.0-specification:** Structural Detached Modifiers}
115 | -- This links to a local copy of {https://github.com/nvim-neorg/norg-specs/blob/main/1.0-specification.norg}.
116 | -- Read {https://github.com/pysan3/Norg-Tutorial#before-you-start}[Before you start] and download these files.
117 |
118 | Normal text here.
119 | Single new line will be ignored.
120 |
121 | Double new lines mean a new paragraph.
122 |
123 | ** Heading 2
124 | Indentation of normal text is advised to align with the start of the heading name.
125 | See? The indentation of this text is different from the ones in {* Heading 1}.
126 |
127 | Oh, BTW that's how you create in-document links. Literal heading name wrapped in `{}`.
128 | Press `` on the link to jump to the definition.
129 | (case, space *in*-sensitive, punctuation *sensitive*).
130 | More about links in {* links}
131 | ---
132 |
133 | With `---`, you can decrease the heading level. This text is inside {* Heading 1} again.
134 |
135 | - Bullet List
136 | -- Spec: {:1.0-specification:*** Unordered Lists}
137 | -- Second level bullet is with `--` and not an indented `-`.
138 | --- Third level
139 | -- Second level
140 | - In insert mode, press `` to create a new bullet.
141 | -- Press ``, `` to increase, decrease the level.
142 | -- More info can be found {https://github.com/nvim-neorg/neorg/wiki/Indent}[Wiki - Indent] or {https://github.com/nvim-neorg/neorg/blob/main/lua/neorg/modules/core/keybinds/keybinds.lua}[Raw code].
143 |
144 | ~ Numbered List
145 | ~~ Spec: {:1.0-specification:*** Ordered Lists}
146 | ~~ It's `~`, not `1.` (Tho the conceal makes it look like that)
147 | -- Can be mixed with bullets as well (not in markdown tho).
148 | ~ Second
149 |
150 | > Quotes
151 | >> Spec: {:1.0-specification:*** Quotes}
152 | >> Quote level 2
153 |
154 | - You can use {:1.0-specification:*** TODO Status Extension}[TODO lists] in combination with these lists.
155 | -- I highly suggest reading this section as well.
156 |
157 | * Links
158 | - Spec: {:1.0-specification:** Link Location}
159 |
160 | There are so so many types of useful links in `norg`.
161 | You can also press `` on all links to open the appropriate application.
162 | (e.g. urls are opened in the browser.)
163 |
164 | Again, `Vhyrro` does a great job explaining about links in his video,
165 | {https://youtu.be/Bi9JiW5nSig?t=17m44s}[From No Org to Neorg #2: 17:44~] so go ahead and watch that video.
166 |
167 | ** Links Examples
168 | - URL: `{https://xxx.example.com}`
169 | -- URL with name: {https://github.com/nvim-neorg/neorg/}[Neorg GitHub]
170 | - Norg files
171 | -- Relative to current file: `{:foo/bar:}` -> `foo/bar.norg`
172 | -- Absolute path: `{:/tmp/foo/bar:}` -> `/tmp/foo/bar.norg`. (Also works with `~/` = `$HOME/`)
173 | -- Relative to current workspace: `{:$/foo/bar:}` -> `~/Norg/Notes/foo/bar.norg`
174 | -- Relative to different workspace: `{:$work/foo/bar:}` -> `~/Norg/work/foo/bar.norg`
175 | - Usual files: `{/ /path/to/file}`
176 | - Headings: {* Heading 1}
177 | -- Any level heading: {# Heading 2}
178 |
179 | *AND YOU CAN COMBINE THEM*
180 | - `Heading 1` of `foo/bar.norg`: {:foo/bar:* Heading 1}
181 | - Line numbers: {:foo/bar:4}
182 |
183 | * Attached Modifiers
184 | - \*bold\*: *bold*
185 | - \/italic\/: /italic/
186 | - \_underline\_: _underline_
187 | - \-strike-through\-: -strike-through-
188 | - \!spoiler\!: !spoiler!
189 | - \^superscript\^: ^superscript^ (cannot be nested into `subscript`)
190 | - \,subscript\,: ,subscript, (cannot be nested into `superscript`)
191 | - \`inline code\`: `inline code` (disables any nested markup - verbatim)
192 | - \%{** Null Modifier}[null modifier]\%: %null modifier%
193 | - \$inline math\$: $f(x) = y$ (verbatim)
194 | - \&variable\&: &variable& (verbatim)
195 |
196 | * Modules
197 | Keys passed to `config.load` are name of modules. Their documents can be found in
198 | {https://github.com/nvim-neorg/neorg/wiki}[Neorg - Wiki] -> Pages.
199 |
200 | I already mentioned the necessary ones in {** Kickstart Config}, but here are ones I personally use on top of them.
201 | @code lua
202 | local modules = {
203 | ... -- ones mentioned in {** Kickstart Config}
204 | ["core.esupports.metagen"] = { config = { type = "auto", update_date = true } },
205 | ["core.qol.toc"] = {},
206 | ["core.qol.todo_items"] = {},
207 | ["core.looking-glass"] = {},
208 | ["core.presenter"] = { config = { zen_mode = "zen-mode" } },
209 | ["core.export"] = {},
210 | ["core.export.markdown"] = { config = { extensions = "all" } },
211 | ["core.summary"] = {},
212 | ["core.tangle"] = { config = { report_on_empty = false } },
213 | ["core.ui.calendar"] = {},
214 | ["core.journal"] = {
215 | config = {
216 | strategy = "flat",
217 | workspace = "Notes",
218 | },
219 | },
220 | }
221 | @end
222 |
223 | ** Notes for Important Modules
224 | *** `core.journal`
225 | - {https://github.com/nvim-neorg/neorg/wiki/Journal}
226 |
227 | This adds commands `:Neorg journal {today,tomorrow,yesterday}`,
228 | which opens norg file with the appropriate date as name.
229 | Also, take a look at {https://github.com/nvim-neorg/neorg/wiki/Calendar}[`core.ui.calendar`]
230 | to add `:Neorg journal custom` command to choose a date with a calendar UI.
231 |
232 | Great for diary :)
233 |
234 | *** `core.keybinds`
235 | - {https://github.com/nvim-neorg/neorg/wiki/User-Keybinds}
236 |
237 | To register `norg` file specific keybinds, read this section:
238 | {https://github.com/nvim-neorg/neorg/wiki/User-Keybinds#setting-up-a-keybind-hook}[Neorg - Wiki - User-Keybinds - Setting Up a Keybind Hook].
239 |
240 | The default keybinds are listed {https://github.com/nvim-neorg/neorg/blob/main/lua/neorg/modules/core/keybinds/keybinds.lua}[here].
241 |
242 | *** `core.export`
243 | - {https://github.com/nvim-neorg/neorg/wiki/Exporting-Files}
244 |
245 | You will want {https://github.com/nvim-neorg/neorg/wiki/Markdown-Export}[`core.export.markdown`] as well
246 | to export your files to markdown format.
247 |
248 | Read {** Export / Import} section for instructions for other filetypes in detail.
249 |
250 | *** `core.summary`
251 | - {https://github.com/nvim-neorg/neorg/wiki/Summary}
252 |
253 | Use `:Neorg generate-workspace-summary` to generate a summary of the entire
254 | workspace with links to each respective entry.
255 |
256 | It seems that it has some bugs that are being worked on.
257 | - ✅ -{https://github.com/nvim-neorg/neorg/issues/1108}-
258 | - {https://github.com/nvim-neorg/neorg/issues/1071}
259 |
260 | *** `core.tangle`
261 | - {https://github.com/nvim-neorg/neorg/wiki/Tangling}
262 |
263 | Use `:Neorg tangle current-file` to export the code blocks in the current file into another file.
264 |
265 | Basics are listed below, but you've got more options to control the output.
266 | See the {https://github.com/nvim-neorg/neorg/wiki/Tangling#usage-tutorial}[official wiki] for more information.
267 |
268 | **** Tangle each code block.
269 | |example
270 | #tangle init.lua
271 | @code lua
272 | -- This will be tangled to init.lua
273 | print("Hello from init.lua!")
274 | @end
275 | |end
276 |
277 | **** Tangle entire document.
278 | Specify output file inside `@document.meta`.
279 | - Want to export to multiple files? => {https://github.com/nvim-neorg/neorg/wiki/Tangling#global-tangling-for-multiple-files}[More complex options.]
280 | |example
281 | @document.meta
282 | tangle: ./init.lua
283 | @end
284 |
285 | @code lua
286 | -- This will be tangled to init.lua
287 | print("Hello from init.lua!")
288 | @end
289 |
290 | #tangle.none
291 | @code lua
292 | -- Ignore this code block
293 | print("Not tangled.")
294 | @end
295 | |end
296 |
297 | **** Automatically tangle current file on save using `autocmd`.
298 | @code lua
299 | vim.api.nvim_create_autocmd("BufWritePost", {
300 | pattern = "*.norg",
301 | command = "Neorg tangle current-file",
302 | })
303 | @end
304 |
305 | *** `core.looking-glass`
306 | - {https://github.com/nvim-neorg/neorg/wiki/Looking-Glass}
307 |
308 | Use `:Neorg keybind all core.looking-glass.magnify-code-block` to edit code blocks in an external buffer,
309 | which allows LSPs and other language-specific tools to kick in.
310 |
311 | !{https://user-images.githubusercontent.com/76052559/216782314-5d82907f-ea6c-44f9-9bd8-1675f1849358.gif}[looking-glass]
312 |
313 | ** Export / Import
314 | You can convert your `norg` notes from / to different formats.
315 | You've got mainly three options to export and one to import.
316 | For exporting, I find {*** Export: `norg-pandoc`} the most stable at the moment (2023-11-05)
317 | but {*** Export: `norganic + pandoc + Norg.jl`} works pretty well as well.
318 |
319 | *** Builtin Export Module
320 | `:Neorg export to-file foo.md` -> Exports to `foo.md` in markdown format.
321 |
322 | This only supports markdown and the conversion is not very reliable.
323 | However, you can use this as a neovim command, so it's the easiest among others.
324 |
325 | This is a function to export to `suffix` with the same dir and name of current file.
326 | @code lua
327 | local export_file = function(suffix, open_preview)
328 | local dst = vim.fn.fnamemodify(vim.fn.expand("%"), ":~:.:r") .. suffix -- same name but with suffix
329 | vim.cmd(string.format([[Neorg export to-file %s]], string.gsub(dst, " ", [[\ ]])))
330 | vim.schedule(function()
331 | vim.cmd.edit(dst)
332 | if suffix == ".md" and open_preview then
333 | vim.cmd([[MarkdownPreview]]) -- https://github.com/iamcco/markdown-preview.nvim
334 | end
335 | end)
336 | end
337 | -- export_file(".md", true)
338 | @end
339 |
340 | *** Export: `norganic + pandoc + Norg.jl`
341 | {https://github.com/Klafyvel/Norg.jl/}[`Norg.jl`] is a project to parse norg format file written in julia.
342 | {https://github.com/klafyvel/norganic}[`norganic`] is a frontend of `Norg.jl` to use the tool from command line.
343 |
344 | For installation document, please read norganic's {https://github.com/klafyvel/norganic}[README].
345 |
346 | - Example usage:
347 | -- Convert norg file to html file.
348 | @code bash
349 | $ norganic html --input /path/to/file.norg --output /path/to/file.html
350 | @end
351 | -- Convert norg file to arbitrary file using `pandoc`.
352 | --- norganic can output specific json format that pandoc understands and can convert to any format of file.
353 | --- Note that things might not work here and there.
354 | @code bash
355 | $ norganic json --input /path/to/file.norg | pandoc -f json -t /path/to/output.xxx
356 | @end
357 |
358 | *** Export: `norg-pandoc`
359 | {https://github.com/boltlessengineer/norg-pandoc}[`norg-pandoc`] is a plugin for pandoc to parse norg format written in lua.
360 | A parser in directly added to pandoc, but you have to git clone and run pandoc inside `norg-pandoc`'s directory
361 | (or add this dir to lua's runtime path I guess?), so it is kinda cumbersome to run.
362 | @code bash
363 | $ git clone https://github.com/boltlessengineer/norg-pandoc.git
364 | $ cd norg-pandoc
365 | $ pandoc -f init.lua -t gfm /path/to/file.norg -o /path/to/output.md
366 | # gfm (GitHub flavored markdown)
367 | @end
368 |
369 | {/ ./norg_tutorial.md} is generated using this tool with a combination of
370 | {https://github.com/pysan3/dotfiles/blob/main/static/remove_empty_lines_in_lists.py}[my custom script]
371 | to remove unnecessary newlines when exporting to markdown at the moment.
372 | @code bash
373 | $ pandoc -f init.lua -t gfm /path/to/norg_tutorial.norg | python remove_empty_lines_in_lists.py > /path/to/norg_tutorial.md
374 | @end
375 |
376 | *** Import: `pandoc + minorg`
377 | {https://github.com/pysan3/minorg}[`minorg`] is a tool to convert pandoc json format to norg file.
378 | Theoretically, it should be able to convert from all file formats that pandoc supports (and it's extensions).
379 |
380 | Please install the tool via {https://github.com/pysan3/minorg/releases}[minorg - Releases]
381 |
382 | - Example usage:
383 | -- Convert from markdown.
384 | @code bash
385 | $ pandoc -f markdown -t json /path/to/input/file.md | minorg generate -o /path/to/output.norg
386 | @end
387 | -- Convert Obsidian files.
388 | --- Obsidian markdown flavor is a bit out of the standards and pandoc fails to parse it correctly.
389 | --- I've implemented some workarounds specifically for obsidian style markdowns.
390 | @code bash
391 | $ pandoc -f markdown -f json /path/to/obsidian/file.md | minorg generate -o /path/to/output.norg --isObsidian --workRootDir=/path/to/workspace
392 | @end
393 | - For more usage examples (for example convert whole dir recursively), please read the {https://github.com/pysan3/minorg}[README].
394 | - BTW, I'm the author of this cli tool, so if you have any problem, don't hesitate to send me an issue or feature request.
395 |
396 | *** Future: tree-sitter v3 parser
397 | The tree-sitter parser for norg format version 3 is being worked at the moment.
398 | I've not been able to follow the development closely but I heard that it might work if you compile locally at the moment (2023-11-06).
399 |
400 | After this parser is complete, we should be able to write a working importer / exporter with the output of the parser
401 | to plug into pandoc to have a reliable result.
402 |
403 | ** Image Support
404 | Image support in norg file is partially done, partially not.
405 |
406 | The syntax is like below and the second format is currently discussed for inline images.
407 | |example
408 | %preferred image syntax, image.nvim supports this out of the box%
409 | .image /path/to/image.png
410 |
411 | %inline image syntax being discussed. No real implementation or parser supports this yet%
412 | {url}[alt text](image)
413 | {/ /path/to/img.png}[alt text](image)
414 | |end
415 |
416 | Parser or especially the {*** Builtin Export Module} does not fully support this.
417 | Read {** Embed Images} if you want a workaround to have a working markdown export now.
418 |
419 | *** Visualization
420 | {https://github.com/3rd/image.nvim}[`image.nvim`] is an awesome plugin that can inject the images inside the neovim buffer
421 | if you use /kitty-graphics-protocol/ compatible terminal.
422 |
423 | {https://github.com/nvim-neorg/neorg/issues/971#issuecomment-1620775558}[Working example GIF].
424 |
425 | ** Table Syntax
426 | The table syntax is one of the most powerfull, but really tricky thing in norg's specification.
427 | I will try my best to explain.
428 | Even if it's hard to comprehend, skim through til the {*** Table Format Examples} section and you might get the hang of it.
429 |
430 | There are two syntax to define a table, one easy but limited and one that is very extensible.
431 |
432 | *** Markdown Wrapper
433 | This format is very easy. It is basically the same as markdown table format wrapped in `@table - @end`.
434 |
435 | One pro is that it should work with some markdown exporter at the momemt.
436 | |example
437 | @table
438 | | Head a | Head b | Head c |
439 | | - | - | - |
440 | | Cell 1 | Cell 2 | Cell 3 |
441 | | Cell 4 | Cell 5 | Cell 6 |
442 | @end
443 | |end
444 |
445 | *** Rich Table Format
446 | This table format has infinite size table and you can specify the cell positions with movement (relative) commands.
447 |
448 | Here are the three ways to write a cell. It consists of `: : cell content`.
449 | |example
450 | %basic format%
451 | : .
452 | cell content
453 |
454 | %shorthand syntax when content fits in single line%
455 | : . : cell content
456 |
457 | %multi line content syntax. you also need the closing :: below%
458 | :: .
459 | - cell
460 | - content
461 | ::
462 | |end
463 |
464 | Now let's talk about the movements. These should go into the `.` part in the above example.
465 | In this example, `A1` means first row, first column, `C2` means *second row (2)*, *third column (C)*.
466 | Look at `MS Excel` for more visual explanation.
467 | - `.`: Top left (A1) of the table.
468 | - `>` / `<`: Go one left / right.
469 | -- You can prefix number to move multiple times. `3>` moves three right.
470 | - `^` / `v`: Go one up / down. Also combine with numbers.
471 | - `_`: Move to leftmost column on the next row. (If on `D1` and `_` will go to `A2`)
472 | - `/`: Like `_` but vertically. Move one right and to the top. Imagine an upper-right arrow (↗️).
473 |
474 | One special case is that when you go `<` on `A?` (left most column), it will wrap around and go to
475 | the cell one row above and all the way to the right (that has content). (`A2` -> `<` -> `X1`)
476 |
477 | Another option other than relative movement is to specify absolute cell position.
478 | - `: A1 : cell content`: Position `A1`.
479 | - `: B1 : second cell`: Obviously cell next to `A1`.
480 | - `: A1-A4 : multi row cell`: You can specify a multi row / column cell with this format.
481 |
482 | %Norg also has the concept of `&variable&` which holds some value, controllable with {# macros}%
483 |
484 | **** Alignments
485 | You can align the cell content with `+align right` above the cell row.
486 | Note that these are still *very work in progress* and neither the exporter nor the parser understand it,
487 | and /might even change in the future/.
488 | Other variances are...
489 | - `+align left`: align a single cell
490 | - `#align center`: align all cells to the center after this line
491 | - `#align.columns A right`: align all cells in `A` column
492 |
493 | *** Table Format Examples
494 | Let's wrap our heads around with some examples. The following tables represent the same thing.
495 |
496 | |example
497 | @table
498 | (This is not a valid table, just added the wrapper to avoid parser errors)
499 | | Head a | Head b | Head c |
500 | | --------- | --------- | --------- |
501 | | multi | multi col cell |
502 | | row | --------- | --------- |
503 | | cell | Cell 5 | Cell 6 |
504 | | --------- | --------- | --------- |
505 | @end
506 |
507 | #align left
508 | : . : Head a
509 | +align right
510 | : > : Head b
511 | +align center
512 | : > : Head c
513 | : A2-A3 : multi row cell
514 | : B2-C2 : multi col cell
515 | #align right
516 | : _> : Cell 5
517 | : > : Cell 6
518 | |end
519 |
520 | The following mimics table in {*** Markdown Wrapper}.
521 | Although you can totally express this table with only `. > _`, I purposely used different notations as well.
522 | BTW, there are no ways to express `` cells at the moment. The format is being discussed at {** Discord} right now (2023-11-06).
523 | |example
524 | : . : Head a
525 | : B1 : Head b
526 | : C1
527 | Head c
528 | : _ : Cell 1
529 | : 5>4<
530 | Cell 2
531 | :: >
532 | Cell 3
533 | ::
534 | : >>>_ : Cell 4
535 | : /2v : Cell 5
536 | : _2>^ : Cell 6
537 | |end
538 |
539 | ** Macros
540 | Macros in norg format starts with one of (`#`, `@`, `.`, `|`) and can invoke a function written in
541 | {https://janet-lang.org/}[Janet Langauge].
542 | You've already seen this with `#align`, `@table`, `.image`, `|example` and so on.
543 | The spec hasn't matured yet but we are working on it steadily.
544 | We will see things like `+color:red` and many more interesting ones that connects to database soon -I mean pretty in long term...-.
545 |
546 | *** Attached Modifier Extensions (WIP)
547 | Macros or labels attached on attached modifiers.
548 |
549 | Best example is the below where `(lang:norg)` extends the inline code block (backticks).
550 | |example
551 | - `* Heading`(lang:norg)
552 | |end
553 |
554 | *** Detached Modifier Extensions (WIP)
555 | Kind of like a tag attached to headings, bullet points and some other stuffs.
556 |
557 | Best example is the todo items where `- (x) item` means that this bullet point has attribute /TODO item/ and /IS DONE/.
558 | These modifiers can be chained together with a pipe (`|`).
559 | Below example means a heading that is /TODO item/ and /PENDING/ and /PRIORITY A (A is highest)/.
560 | |example
561 | * (-|# A) Heading 1
562 | |end
563 |
564 | ** Your Own Module
565 | If you want to create your own module for neorg, this video is very useful.
566 | {https://www.youtube.com/watch?v=j4lTvIGRhmw&list=PLxpY86LRR3B0rtOBjXAsq1XnsOt4m4owu}[YouTube - Neorg Custom Modules]
567 |
568 | Here's one external module I implemented: {https://github.com/pysan3/neorg-templates}[neorg-templates],
569 | which adds support for template files with the power of `LuaSnip`.
570 |
571 | Feel free to explorer the code.
572 |
573 | * Explore More Norg
574 | ** {https://github.com/NTBBloodbath/awesome-neorg}[Awesome Neorg]
575 | > A collection of awesome Neorg notes, software and resources.
576 |
577 | - You might find more useful neorg external modules to integrate to your workflow.
578 |
579 | ** {https://github.com/orgs/nvim-neorg/repositories}[Other Official Projects]
580 | There are many other projects going on around the `norg` format.
581 |
582 | ** GitHub Tags
583 | Of course you can search through GitHub with tags.
584 | - `norg`: {https://github.com/topics/norg}
585 | -- More likely to find external modules.
586 | - `neorg` {https://github.com/topics/neorg}
587 | -- More likely to find personal dotfiles and other configs.
588 |
589 | ** Discord
590 | More, alpha stage concepts are discussed in the Discord channel.
591 |
592 | Feel free to join: {https://discord.gg/T6EgTAX7ht}
593 |
594 | * Tips
595 | ** Embed Images
596 | *This section is old.* Read {** Image Support} for new information.
597 | -As far as I know, there are *NO* specifications about how to embed / link to an image.-
598 |
599 | Update: 2023-10-19.
600 | - Spec for image added: {https://github.com/nvim-neorg/norg-specs/issues/14}.
601 | |example
602 | .image /path/to/image.png
603 | |end
604 |
605 | - There are also some attempts to add image preview support thanks to {https://github.com/3rd/image.nvim}[image.nvim].
606 | -- {https://github.com/nvim-neorg/neorg/issues/971}
607 | - Markdown export and treesitter parsing is not yet /fully/ implemented,
608 | so I'd suggest using the old workaround described below for now.
609 |
610 | *** OLD: Discussions
611 | - {https://github.com/nvim-neorg/neorg/discussions/768}[Is there any way to insert a image just like kitty icat does #768]
612 | - {https://github.com/nvim-neorg/neorg/discussions/791}[render.nvim #791]
613 | ---
614 |
615 | *** OLD: Workaround
616 |
617 | As a workaround, funny enough, you can prepend a link with `!` like `!{path}[name]` to link to an image,
618 | which will be correctly converted to image tag when exported to markdown files.
619 | (Of course this only works with markdown and I hope this will not become the correct way.)
620 | |example
621 | !{https://user-images.githubusercontent.com/76052559/150838408-1a021d7b-1891-4cab-b16e-6b755e741e87.png}[Norg format]
622 | |end
623 | Example:
624 | !{https://user-images.githubusercontent.com/76052559/150838408-1a021d7b-1891-4cab-b16e-6b755e741e87.png}[Norg format]
625 |
626 | ** Sync with Git, Nextcloud, etc
627 | *BACKUP YOUR NOTES*
628 |
629 | *** Nextcloud, Edit on Your Phone
630 | If you use selfhosted Nextcloud, you can edit your `norg` notes from your phone.
631 |
632 | **** After Logging In
633 | ~ Install {https://apps.nextcloud.com/apps/notes}[Notes app]
634 | ~ Go to {https://nextcloud.your.domain/apps/notes}
635 | ~ Go down to `Notes settings`
636 | ~ Change `File extension for new notes`
637 | ~~ `User defined` -> `.norg`
638 |
639 | **** On Your Phone
640 | ~ Access page with safari. ,I'm sorry but I use iPhone...,
641 | ~~ Shoud work on other phones as well tho.
642 | ~ Go to {https://nextcloud.your.domain/apps/notes}
643 | ~ Press `share` to `Add page to home`.
644 | ~ You have a new app that jumps directly to notes
645 |
646 | **** Notes
647 | - Might not work if you have {https://github.com/nextcloud/text}[Text] app installed
648 |
--------------------------------------------------------------------------------
/norg_tutorial.md:
--------------------------------------------------------------------------------
1 | # Norg Tutorial
2 |
3 | \*This page is generated from [`./norg_tutorial.norg`](./norg_tutorial.norg)
4 |
5 | I'd suggest reading [`./norg_tutorial.md`](https://github.com/pysan3/Norg-Tutorial/blob/main/norg_tutorial.md) first to do the installation and then clone the repo locally to read [How to Write Notes](norg_tutorial.norg#how-to-write-notes) in your neovim with the neorg plugin :)
6 |
7 | ## Useful Videos
8 |
9 | - [From No Org to Neorg - Playlist](https://www.youtube.com/watch?v=NnmRVY22Lq8&list=PLx2ksyallYzVI8CN1JMXhEf62j2AijeDa)
10 | - [From No Org to Neorg - The Basics \| \#1](https://youtu.be/NnmRVY22Lq8)
11 | - [From No Org to Neorg - Workflow, Links \| \#2](https://youtu.be/Bi9JiW5nSig)
12 | - ...
13 |
14 | I highly recommend you watch these videos by `Vhyrro`, the main contributor of [Neorg](https://github.com/nvim-neorg/neorg/) plugin. He says he'll start a devlog series soon as well.
15 |
16 | # How to Get Started
17 |
18 | The current implementations of `norg` format is mostly done with the [Neorg](https://github.com/nvim-neorg/neorg/) plugin.
19 |
20 | ## Installation Guide
21 |
22 | Read this section. [Installation / Quickstart](https://github.com/nvim-neorg/neorg/#-installationquickstart)
23 |
24 | - I'd recommend following the `Treesitter` section as well to install `tree-sitter-norg` spec.
25 | - `run = ":Neorg sync-parsers",`
26 | - **Mac Users**: ensure that the CC environment variable points to a compiler that has C++14 support.
27 | - Details written in github README.
28 | - [Issue and How to solve](https://github.com/nvim-neorg/tree-sitter-norg/issues/7#issuecomment-1291508121)
29 |
30 | ## v8.0 Luarocks Dependency
31 |
32 | From neorg v8.0, dependencies are managed by [luarocks.nvim]()(https://github.com/vhyrro/luarocks.nvim), which uses luarocks under the hood to manage **versioned** dependencies.
33 |
34 | This change brings a lot of benefits to both developers and users, but the biggest is that end users do no need to manage dependencies at all.
35 |
36 | Let's start by installing the plugin.
37 |
38 | ``` lua
39 | return {
40 | "vhyrro/luarocks.nvim",
41 | priority = 1000,
42 | config = true,
43 | }
44 | ```
45 |
46 | This is the only required dependency. As you can see in the kickstart config below, delete all the lines except for luarocks and everything will be installed on its own from v8.0.
47 |
48 | However, if you define other dependencies such as [external modules](#your-own-module), you still need to install those via lazy.nvim and add them to the dependencies list.
49 |
50 | **Delete `build = ":Neorg sync-parsers` line from the kickstart config.**
51 |
52 | Read [vhyrro's blog - Neorg 8.0.0](https://vhyrro.github.io/posts/neorg-and-luarocks/#the-fix) for more details. If you encounter a bug, please report it to [Luarocks Issues Thread](https://github.com/nvim-neorg/neorg/issues/1342). That'll definitely help the developers!
53 |
54 | ## Kickstart Config
55 |
56 | Here is my basic config. I'll explain about `modules` in [Modules](#modules).
57 |
58 | ``` lua
59 | -- lazy.nvim spec
60 | local M = {
61 | "nvim-neorg/neorg",
62 | ft = "norg",
63 | dependencies = {
64 | "luarocks.nvim", -- this is it.
65 | -- "nvim-treesitter/nvim-treesitter",
66 | -- "nvim-treesitter/nvim-treesitter-textobjects",
67 | -- "nvim-cmp",
68 | -- "nvim-lua/plenary.nvim",
69 | },
70 | -- build = ":Neorg sync-parsers", -- and delete this line.
71 | cmd = "Neorg",
72 | }
73 | local modules = {
74 | ["core.defaults"] = {},
75 | ["core.completion"] = { config = { engine = "nvim-cmp", name = "[Norg]" } },
76 | ["core.integrations.nvim-cmp"] = {},
77 | ["core.concealer"] = { config = { icon_preset = "diamond" } },
78 | ["core.keybinds"] = {
79 | -- https://github.com/nvim-neorg/neorg/blob/main/lua/neorg/modules/core/keybinds/keybinds.lua
80 | config = {
81 | default_keybinds = true,
82 | neorg_leader = "",
83 | },
84 | },
85 | ["core.dirman"] = {
86 | config = {
87 | workspaces = {
88 | Notes = "~/Nextcloud/Notes",
89 | Work = "~/Nextcloud/Work",
90 | }
91 | }
92 | },
93 | }
94 | M.opts = {
95 | load = modules,
96 | }
97 | return M
98 | ```
99 |
100 | If you still have problems setting up `neorg`, `@d-r-a-b` explains more thoroughly in [Understanding Neorg dependencies](https://gist.github.com/d-r-a-b/3af7083a018be15e6c1d1d2c5317e9c7). I'd really recommend this as well.
101 |
102 | ### `core.dirman`
103 |
104 | This module manages what are called *workspaces*.
105 |
106 | You can define multiple workspaces at `config["core.dirman"].config.workspaces`, and open with command `:Neorg workspace `. This command opens `/path/to/workspace/index.norg` which is like the entry point file.
107 |
108 | Norg files inside a workspace can be linked with `{:$/path/to/file:}`. So for example, inside workspace `Notes = "~/Nextcloud/Notes"`, `~/Nextcloud/Notes/journal/2023-04-16.norg` would be `{:$Notes/journal/2023-04-16:}`. Or, it can be abbreviated to `$/` when referring from files in the same workspace. More info in [Links](#links) section.
109 |
110 | # How to Write Your Notes
111 |
112 | ## Basics of Modules
113 |
114 | There is a config option `config.load = {}` to define modules you want to use.
115 |
116 | I decomposed that into a local var `modules` in above code for simplicity tho.
117 |
118 | More information about modules in [Modules](#modules) section. I'd recommend just simply adding the ones already stated in [Kickstart Config](#kickstart-config).
119 |
120 | ## How to Write Notes
121 |
122 | Below text is a sample note which explains about the norg syntax.
123 |
124 | Run `:Neorg toggle-concealer` to see the raw text.
125 |
126 | # Heading 1
127 |
128 | - Spec: [Structural Detached Modifiers](1.0-specification.norg#structural-detached-modifiers)
129 | - This links to a local copy of .
130 | - Read [Before you start](https://github.com/pysan3/Norg-Tutorial#before-you-start) and download these files.
131 |
132 | Normal text here. Single new line will be ignored.
133 |
134 | Double new lines mean a new paragraph.
135 |
136 | ## Heading 2
137 |
138 | Indentation of normal text is advised to align with the start of the heading name. See? The indentation of this text is different from the ones in [Heading 1](#heading-1).
139 |
140 | Oh, BTW that's how you create in-document links. Literal heading name wrapped in `{}`. Press `` on the link to jump to the definition. (case, space **in**-sensitive, punctuation **sensitive**). More about links in [links](#links)
141 |
142 | With `---`, you can decrease the heading level. This text is inside [Heading 1](#heading-1) again.
143 |
144 | - Bullet List
145 | - Spec: [Unordered Lists](1.0-specification.norg#unordered-lists)
146 | - Second level bullet is with `--` and not an indented `-`.
147 | - Third level
148 | - Second level
149 | - In insert mode, press `` to create a new bullet.
150 | - Press ``, `` to increase, decrease the level.
151 | - More info can be found [Wiki - Indent](https://github.com/nvim-neorg/neorg/wiki/Indent) or [Raw code](https://github.com/nvim-neorg/neorg/blob/main/lua/neorg/modules/core/keybinds/keybinds.lua).
152 |
153 | 1. Numbered List
154 | 1. Spec: [Ordered Lists](1.0-specification.norg#ordered-lists)
155 | 2. It's `~`, not `1.` (Tho the conceal makes it look like that)
156 |
157 | - Can be mixed with bullets as well (not in markdown tho).
158 |
159 | 1. Second
160 |
161 | > Quotes
162 | >
163 | > > Spec: [Quotes](1.0-specification.norg#quotes)
164 | > >
165 | > > Quote level 2
166 |
167 | - You can use [TODO lists](1.0-specification.norg#todo-status-extension) in combination with these lists.
168 | - I highly suggest reading this section as well.
169 |
170 | # Links
171 |
172 | - Spec: [Link Location](1.0-specification.norg#link-location)
173 |
174 | There are so so many types of useful links in `norg`. You can also press `` on all links to open the appropriate application. (e.g. urls are opened in the browser.)
175 |
176 | Again, `Vhyrro` does a great job explaining about links in his video, [From No Org to Neorg \#2: 17:44~](https://youtu.be/Bi9JiW5nSig?t=17m44s) so go ahead and watch that video.
177 |
178 | ## Links Examples
179 |
180 | - URL: `{https://xxx.example.com}`
181 | - URL with name: [Neorg GitHub](https://github.com/nvim-neorg/neorg/)
182 | - Norg files
183 | - Relative to current file: `{:foo/bar:}` -\> `foo/bar.norg`
184 | - Absolute path: `{:/tmp/foo/bar:}` -\> `/tmp/foo/bar.norg`. (Also works with `~/` = `$HOME/`)
185 | - Relative to current workspace: `{:$/foo/bar:}` -\> `~/Norg/Notes/foo/bar.norg`
186 | - Relative to different workspace: `{:$work/foo/bar:}` -\> `~/Norg/work/foo/bar.norg`
187 | - Usual files: `{/ /path/to/file}`
188 | - Headings: [Heading 1](#heading-1)
189 | - Any level heading: [Heading 2](#heading-2)
190 |
191 | **AND YOU CAN COMBINE THEM**
192 |
193 | - `Heading 1` of `foo/bar.norg`: [Heading 1](foo/bar.norg#heading-1)
194 | - Line numbers: [foo/bar](foo/bar.norg)
195 |
196 | # Attached Modifiers
197 |
198 | - \*bold\*: **bold**
199 | - /italic/: *italic*
200 | - \_underline\_: underline
201 | - \-strike-through-: ~~strike-through~~
202 | - !spoiler!: spoiler
203 | - ^superscript^: superscript (cannot be nested into `subscript`)
204 | - ,subscript,: subscript (cannot be nested into `superscript`)
205 | - \`inline code\`: `inline code` (disables any nested markup - verbatim)
206 | - %[null modifier](#null-modifier)%:
207 | - \$inline math\$: $f(x) = y$ (verbatim)
208 | - &variable&: variable (verbatim)
209 |
210 | # Modules
211 |
212 | Keys passed to `config.load` are name of modules. Their documents can be found in [Neorg - Wiki](https://github.com/nvim-neorg/neorg/wiki) -\> Pages.
213 |
214 | I already mentioned the necessary ones in [Kickstart Config](#kickstart-config), but here are ones I personally use on top of them.
215 |
216 | ``` lua
217 | local modules = {
218 | ... -- ones mentioned in {** Kickstart Config}
219 | ["core.esupports.metagen"] = { config = { type = "auto", update_date = true } },
220 | ["core.qol.toc"] = {},
221 | ["core.qol.todo_items"] = {},
222 | ["core.looking-glass"] = {},
223 | ["core.presenter"] = { config = { zen_mode = "zen-mode" } },
224 | ["core.export"] = {},
225 | ["core.export.markdown"] = { config = { extensions = "all" } },
226 | ["core.summary"] = {},
227 | ["core.tangle"] = { config = { report_on_empty = false } },
228 | ["core.ui.calendar"] = {},
229 | ["core.journal"] = {
230 | config = {
231 | strategy = "flat",
232 | workspace = "Notes",
233 | },
234 | },
235 | }
236 | ```
237 |
238 | ## Notes for Important Modules
239 |
240 | ### `core.journal`
241 |
242 | -
243 |
244 | This adds commands `:Neorg journal {today,tomorrow,yesterday}`, which opens norg file with the appropriate date as name. Also, take a look at [`core.ui.calendar`](https://github.com/nvim-neorg/neorg/wiki/Calendar) to add `:Neorg journal custom` command to choose a date with a calendar UI.
245 |
246 | Great for diary :)
247 |
248 | ### `core.keybinds`
249 |
250 | -
251 |
252 | To register `norg` file specific keybinds, read this section: [Neorg - Wiki - User-Keybinds - Setting Up a Keybind Hook](https://github.com/nvim-neorg/neorg/wiki/User-Keybinds#setting-up-a-keybind-hook).
253 |
254 | The default keybinds are listed [here](https://github.com/nvim-neorg/neorg/blob/main/lua/neorg/modules/core/keybinds/keybinds.lua).
255 |
256 | ### `core.export`
257 |
258 | -
259 |
260 | You will want [`core.export.markdown`](https://github.com/nvim-neorg/neorg/wiki/Markdown-Export) as well to export your files to markdown format.
261 |
262 | Read [Export / Import](#export--import) section for instructions for other filetypes in detail.
263 |
264 | ### `core.summary`
265 |
266 | -
267 |
268 | Use `:Neorg generate-workspace-summary` to generate a summary of the entire workspace with links to each respective entry.
269 |
270 | It seems that it has some bugs that are being worked on.
271 |
272 | - ✅ ~~~~
273 | -
274 |
275 | ### `core.tangle`
276 |
277 | -
278 |
279 | Use `:Neorg tangle current-file` to export the code blocks in the current file into another file.
280 |
281 | Basics are listed below, but you've got more options to control the output. See the [official wiki](https://github.com/nvim-neorg/neorg/wiki/Tangling#usage-tutorial) for more information.
282 |
283 | #### Tangle each code block.
284 |
285 | ``` norg
286 | #tangle init.lua
287 | @code lua
288 | -- This will be tangled to init.lua
289 | print("Hello from init.lua!")
290 | @end
291 | ```
292 |
293 | #### Tangle entire document.
294 |
295 | Specify output file inside `@document.meta`.
296 |
297 | - Want to export to multiple files? =\> [More complex options.](https://github.com/nvim-neorg/neorg/wiki/Tangling#global-tangling-for-multiple-files)
298 |
299 | ``` norg
300 | @document.meta
301 | tangle: ./init.lua
302 | @end
303 |
304 | @code lua
305 | -- This will be tangled to init.lua
306 | print("Hello from init.lua!")
307 | @end
308 |
309 | #tangle.none
310 | @code lua
311 | -- Ignore this code block
312 | print("Not tangled.")
313 | @end
314 | ```
315 |
316 | #### Automatically tangle current file on save using `autocmd`.
317 |
318 | ``` lua
319 | vim.api.nvim_create_autocmd("BufWritePost", {
320 | pattern = "*.norg",
321 | command = "Neorg tangle current-file",
322 | })
323 | ```
324 |
325 | ### `core.looking-glass`
326 |
327 | -
328 |
329 | Use `:Neorg keybind all core.looking-glass.magnify-code-block` to edit code blocks in an external buffer, which allows LSPs and other language-specific tools to kick in.
330 |
331 | 
332 |
333 | ## Export / Import
334 |
335 | You can convert your `norg` notes from / to different formats. You've got mainly three options to export and one to import. For exporting, I find [Export: `norg-pandoc`](#export-norgpandoc) the most stable at the moment (2023-11-05) but [Export: `norganic + pandoc + Norg.jl`](#export-norganic--pandoc--norgjl) works pretty well as well.
336 |
337 | ### Builtin Export Module
338 |
339 | `:Neorg export to-file foo.md` -\> Exports to `foo.md` in markdown format.
340 |
341 | This only supports markdown and the conversion is not very reliable. However, you can use this as a neovim command, so it's the easiest among others.
342 |
343 | This is a function to export to `suffix` with the same dir and name of current file.
344 |
345 | ``` lua
346 | local export_file = function(suffix, open_preview)
347 | local dst = vim.fn.fnamemodify(vim.fn.expand("%"), ":~:.:r") .. suffix -- same name but with suffix
348 | vim.cmd(string.format([[Neorg export to-file %s]], string.gsub(dst, " ", [[\ ]])))
349 | vim.schedule(function()
350 | vim.cmd.edit(dst)
351 | if suffix == ".md" and open_preview then
352 | vim.cmd([[MarkdownPreview]]) -- https://github.com/iamcco/markdown-preview.nvim
353 | end
354 | end)
355 | end
356 | -- export_file(".md", true)
357 | ```
358 |
359 | ### Export: `norganic + pandoc + Norg.jl`
360 |
361 | [`Norg.jl`](https://github.com/Klafyvel/Norg.jl/) is a project to parse norg format file written in julia. [`norganic`](https://github.com/klafyvel/norganic) is a frontend of `Norg.jl` to use the tool from command line.
362 |
363 | For installation document, please read norganic's [README](https://github.com/klafyvel/norganic).
364 |
365 | - Example usage:
366 | - Convert norg file to html file.
367 |
368 | ``` bash
369 | $ norganic html --input /path/to/file.norg --output /path/to/file.html
370 | ```
371 |
372 | - Convert norg file to arbitrary file using `pandoc`.
373 | - norganic can output specific json format that pandoc understands and can convert to any format of file.
374 | - Note that things might not work here and there.
375 |
376 | ``` bash
377 | $ norganic json --input /path/to/file.norg | pandoc -f json -t /path/to/output.xxx
378 | ```
379 |
380 | ### Export: `norg-pandoc`
381 |
382 | [`norg-pandoc`](https://github.com/boltlessengineer/norg-pandoc) is a plugin for pandoc to parse norg format written in lua. A parser in directly added to pandoc, but you have to git clone and run pandoc inside `norg-pandoc`'s directory (or add this dir to lua's runtime path I guess?), so it is kinda cumbersome to run.
383 |
384 | ``` bash
385 | $ git clone https://github.com/boltlessengineer/norg-pandoc.git
386 | $ cd norg-pandoc
387 | $ pandoc -f init.lua -t gfm /path/to/file.norg -o /path/to/output.md
388 | # gfm (GitHub flavored markdown)
389 | ```
390 |
391 | [./norg_tutorial.md](./norg_tutorial.md) is generated using this tool with a combination of [my custom script](https://github.com/pysan3/dotfiles/blob/main/static/remove_empty_lines_in_lists.py) to remove unnecessary newlines when exporting to markdown at the moment.
392 |
393 | ``` bash
394 | $ pandoc -f init.lua -t gfm /path/to/norg_tutorial.norg | python remove_empty_lines_in_lists.py > /path/to/norg_tutorial.md
395 | ```
396 |
397 | ### Import: `pandoc + minorg`
398 |
399 | [`minorg`](https://github.com/pysan3/minorg) is a tool to convert pandoc json format to norg file. Theoretically, it should be able to convert from all file formats that pandoc supports (and it's extensions).
400 |
401 | Please install the tool via [minorg - Releases](https://github.com/pysan3/minorg/releases)
402 |
403 | - Example usage:
404 | - Convert from markdown.
405 |
406 | ``` bash
407 | $ pandoc -f markdown -t json /path/to/input/file.md | minorg generate -o /path/to/output.norg
408 | ```
409 |
410 | - Convert Obsidian files.
411 | - Obsidian markdown flavor is a bit out of the standards and pandoc fails to parse it correctly.
412 | - I've implemented some workarounds specifically for obsidian style markdowns.
413 |
414 | ``` bash
415 | $ pandoc -f markdown -f json /path/to/obsidian/file.md | minorg generate -o /path/to/output.norg --isObsidian --workRootDir=/path/to/workspace
416 | ```
417 |
418 | - For more usage examples (for example convert whole dir recursively), please read the [README](https://github.com/pysan3/minorg).
419 | - BTW, I'm the author of this cli tool, so if you have any problem, don't hesitate to send me an issue or feature request.
420 |
421 | ### Future: tree-sitter v3 parser
422 |
423 | The tree-sitter parser for norg format version 3 is being worked at the moment. I've not been able to follow the development closely but I heard that it might work if you compile locally at the moment (2023-11-06).
424 |
425 | After this parser is complete, we should be able to write a working importer / exporter with the output of the parser to plug into pandoc to have a reliable result.
426 |
427 | ## Image Support
428 |
429 | Image support in norg file is partially done, partially not.
430 |
431 | The syntax is like below and the second format is currently discussed for inline images.
432 |
433 | ``` norg
434 | %preferred image syntax, image.nvim supports this out of the box%
435 | .image /path/to/image.png
436 |
437 | %inline image syntax being discussed. No real implementation or parser supports this yet%
438 | {url}[alt text](image)
439 | {/ /path/to/img.png}[alt text](image)
440 | ```
441 |
442 | Parser or especially the [Builtin Export Module](#builtin-export-module) does not fully support this. Read [Embed Images](#embed-images) if you want a workaround to have a working markdown export now.
443 |
444 | ### Visualization
445 |
446 | [`image.nvim`](https://github.com/3rd/image.nvim) is an awesome plugin that can inject the images inside the neovim buffer if you use *kitty-graphics-protocol* compatible terminal.
447 |
448 | [Working example GIF](https://github.com/nvim-neorg/neorg/issues/971#issuecomment-1620775558).
449 |
450 | ## Table Syntax
451 |
452 | The table syntax is one of the most powerfull, but really tricky thing in norg's specification. I will try my best to explain. Even if it's hard to comprehend, skim through til the [Table Format Examples](#table-format-examples) section and you might get the hang of it.
453 |
454 | There are two syntax to define a table, one easy but limited and one that is very extensible.
455 |
456 | ### Markdown Wrapper
457 |
458 | This format is very easy. It is basically the same as markdown table format wrapped in `@table - @end`.
459 |
460 | One pro is that it should work with some markdown exporter at the momemt.
461 |
462 | ``` norg
463 | @table
464 | | Head a | Head b | Head c |
465 | | - | - | - |
466 | | Cell 1 | Cell 2 | Cell 3 |
467 | | Cell 4 | Cell 5 | Cell 6 |
468 | @end
469 | ```
470 |
471 | ### Rich Table Format
472 |
473 | This table format has infinite size table and you can specify the cell positions with movement (relative) commands.
474 |
475 | Here are the three ways to write a cell. It consists of `: : cell content`.
476 |
477 | ``` norg
478 | %basic format%
479 | : .
480 | cell content
481 |
482 | %shorthand syntax when content fits in single line%
483 | : . : cell content
484 |
485 | %multi line content syntax. you also need the closing :: below%
486 | :: .
487 | - cell
488 | - content
489 | ::
490 | ```
491 |
492 | Now let's talk about the movements. These should go into the `.` part in the above example. In this example, `A1` means first row, first column, `C2` means **second row (2)**, **third column (C)**. Look at `MS Excel` for more visual explanation.
493 |
494 | - `.`: Top left (A1) of the table.
495 | - `>` / `<`: Go one left / right.
496 | - You can prefix number to move multiple times. `3>` moves three right.
497 | - `^` / `v`: Go one up / down. Also combine with numbers.
498 | - `_`: Move to leftmost column on the next row. (If on `D1` and `_` will go to `A2`)
499 | - `/`: Like `_` but vertically. Move one right and to the top. Imagine an upper-right arrow (↗️).
500 |
501 | One special case is that when you go `<` on `A?` (left most column), it will wrap around and go to the cell one row above and all the way to the right (that has content). (`A2` -\> `<` -\> `X1`)
502 |
503 | Another option other than relative movement is to specify absolute cell position.
504 |
505 | - `: A1 : cell content`: Position `A1`.
506 | - `: B1 : second cell`: Obviously cell next to `A1`.
507 | - `: A1-A4 : multi row cell`: You can specify a multi row / column cell with this format.
508 |
509 | #### Alignments
510 |
511 | You can align the cell content with `+align right` above the cell row. Note that these are still **very work in progress** and neither the exporter nor the parser understand it, and *might even change in the future*. Other variances are...
512 |
513 | - `+align left`: align a single cell
514 | - `#align center`: align all cells to the center after this line
515 | - `#align.columns A right`: align all cells in `A` column
516 |
517 | ### Table Format Examples
518 |
519 | Let's wrap our heads around with some examples. The following tables represent the same thing.
520 |
521 | ``` norg
522 | @table
523 | (This is not a valid table, just added the wrapper to avoid parser errors)
524 | | Head a | Head b | Head c |
525 | | --------- | --------- | --------- |
526 | | multi | multi col cell |
527 | | row | --------- | --------- |
528 | | cell | Cell 5 | Cell 6 |
529 | | --------- | --------- | --------- |
530 | @end
531 |
532 | #align left
533 | : . : Head a
534 | +align right
535 | : > : Head b
536 | +align center
537 | : > : Head c
538 | : A2-A3 : multi row cell
539 | : B2-C2 : multi col cell
540 | #align right
541 | : _> : Cell 5
542 | : > : Cell 6
543 | ```
544 |
545 | The following mimics table in [Markdown Wrapper](#markdown-wrapper). Although you can totally express this table with only `. > _`, I purposely used different notations as well. BTW, there are no ways to express `` cells at the moment. The format is being discussed at [Discord](#discord) right now (2023-11-06).
546 |
547 | ``` norg
548 | : . : Head a
549 | : B1 : Head b
550 | : C1
551 | Head c
552 | : _ : Cell 1
553 | : 5>4<
554 | Cell 2
555 | :: >
556 | Cell 3
557 | ::
558 | : >>>_ : Cell 4
559 | : /2v : Cell 5
560 | : _2>^ : Cell 6
561 | ```
562 |
563 | ## Macros
564 |
565 | Macros in norg format starts with one of (`#`, `@`, `.`, `|`) and can invoke a function written in [Janet Langauge](https://janet-lang.org/). You've already seen this with `#align`, `@table`, `.image`, `|example` and so on. The spec hasn't matured yet but we are working on it steadily. We will see things like `+color:red` and many more interesting ones that connects to database soon ~~I mean pretty in long term...~~.
566 |
567 | ### Attached Modifier Extensions (WIP)
568 |
569 | Macros or labels attached on attached modifiers.
570 |
571 | Best example is the below where `(lang:norg)` extends the inline code block (backticks).
572 |
573 | ``` norg
574 | - `* Heading`(lang:norg)
575 | ```
576 |
577 | ### Detached Modifier Extensions (WIP)
578 |
579 | Kind of like a tag attached to headings, bullet points and some other stuffs.
580 |
581 | Best example is the todo items where `- (x) item` means that this bullet point has attribute *TODO item* and *IS DONE*. These modifiers can be chained together with a pipe (`|`). Below example means a heading that is *TODO item* and *PENDING* and *PRIORITY A (A is highest)*.
582 |
583 | ``` norg
584 | * (-|# A) Heading 1
585 | ```
586 |
587 | ## Your Own Module
588 |
589 | If you want to create your own module for neorg, this video is very useful. [YouTube - Neorg Custom Modules](https://www.youtube.com/watch?v=j4lTvIGRhmw&list=PLxpY86LRR3B0rtOBjXAsq1XnsOt4m4owu)
590 |
591 | Here's one external module I implemented: [neorg-templates](https://github.com/pysan3/neorg-templates), which adds support for template files with the power of `LuaSnip`.
592 |
593 | Feel free to explorer the code.
594 |
595 | # Explore More Norg
596 |
597 | ## [Awesome Neorg](https://github.com/NTBBloodbath/awesome-neorg)
598 |
599 | > A collection of awesome Neorg notes, software and resources.
600 |
601 | - You might find more useful neorg external modules to integrate to your workflow.
602 |
603 | ## [Other Official Projects](https://github.com/orgs/nvim-neorg/repositories)
604 |
605 | There are many other projects going on around the `norg` format.
606 |
607 | ## GitHub Tags
608 |
609 | Of course you can search through GitHub with tags.
610 |
611 | - `norg`:
612 | - More likely to find external modules.
613 | - `neorg`
614 | - More likely to find personal dotfiles and other configs.
615 |
616 | ## Discord
617 |
618 | More, alpha stage concepts are discussed in the Discord channel.
619 |
620 | Feel free to join:
621 |
622 | # Tips
623 |
624 | ## Embed Images
625 |
626 | **This section is old.** Read [Image Support](#image-support) for new information. ~~As far as I know, there are **NO** specifications about how to embed / link to an image.~~
627 |
628 | Update: 2023-10-19.
629 |
630 | - Spec for image added: .
631 |
632 | ``` norg
633 | .image /path/to/image.png
634 | ```
635 |
636 | - There are also some attempts to add image preview support thanks to [image.nvim](https://github.com/3rd/image.nvim).
637 | -
638 | - Markdown export and treesitter parsing is not yet *fully* implemented, so I'd suggest using the old workaround described below for now.
639 |
640 | ### OLD: Discussions
641 |
642 | - [Is there any way to insert a image just like kitty icat does \#768](https://github.com/nvim-neorg/neorg/discussions/768)
643 | - [render.nvim \#791](https://github.com/nvim-neorg/neorg/discussions/791)
644 |
645 | ### OLD: Workaround
646 |
647 | As a workaround, funny enough, you can prepend a link with `!` like `!{path}[name]` to link to an image, which will be correctly converted to image tag when exported to markdown files. (Of course this only works with markdown and I hope this will not become the correct way.)
648 |
649 | ``` norg
650 | !{https://user-images.githubusercontent.com/76052559/150838408-1a021d7b-1891-4cab-b16e-6b755e741e87.png}[Norg format]
651 | ```
652 |
653 | Example: 
654 |
655 | ## Sync with Git, Nextcloud, etc
656 |
657 | **BACKUP YOUR NOTES**
658 |
659 | ### Nextcloud, Edit on Your Phone
660 |
661 | If you use selfhosted Nextcloud, you can edit your `norg` notes from your phone.
662 |
663 | #### After Logging In
664 |
665 | 1. Install [Notes app](https://apps.nextcloud.com/apps/notes)
666 | 2. Go to
667 | 3. Go down to `Notes settings`
668 | 4. Change `File extension for new notes`
669 | 1. `User defined` -\> `.norg`
670 |
671 | #### On Your Phone
672 |
673 | 1. Access page with safari. I'm sorry but I use iPhone...
674 | 1. Shoud work on other phones as well tho.
675 | 2. Go to
676 | 3. Press `share` to `Add page to home`.
677 | 4. You have a new app that jumps directly to notes
678 |
679 | #### Notes
680 |
681 | - Might not work if you have [Text](https://github.com/nextcloud/text) app installed
682 |
--------------------------------------------------------------------------------
/norg_tutorial.norg:
--------------------------------------------------------------------------------
1 | @document.meta
2 | title: Norg Tutorial
3 | description:
4 | authors: takuto
5 | categories:
6 | created: 2023-11-05T15:01:09+0900
7 | updated: 2024-02-14T12:18:13+0900
8 | version: 1.1.1
9 | @end
10 |
11 | * Norg Tutorial
12 | *This page is generated from {./norg_tutorial.norg}[`./norg_tutorial.norg`]
13 |
14 | I'd suggest reading {https://github.com/pysan3/Norg-Tutorial/blob/main/norg_tutorial.md}[`./norg_tutorial.md`]
15 | first to do the installation and then clone the repo locally to read {:norg_tutorial:** How to Write Notes}
16 | in your neovim with the neorg plugin :)
17 |
18 | ** Useful Videos
19 | - {https://www.youtube.com/watch?v=NnmRVY22Lq8&list=PLx2ksyallYzVI8CN1JMXhEf62j2AijeDa}[From No Org to Neorg - Playlist]
20 | -- {https://youtu.be/NnmRVY22Lq8}[From No Org to Neorg - The Basics | #1]
21 | -- {https://youtu.be/Bi9JiW5nSig}[From No Org to Neorg - Workflow, Links | #2]
22 | -- ...
23 |
24 | I highly recommend you watch these videos by `Vhyrro`, the main contributor of {https://github.com/nvim-neorg/neorg/}[Neorg] plugin.
25 | He says he'll start a devlog series soon as well.
26 |
27 | * How to Get Started
28 | The current implementations of `norg` format is mostly done with the {https://github.com/nvim-neorg/neorg/}[Neorg] plugin.
29 |
30 | ** Installation Guide
31 | Read this section. {https://github.com/nvim-neorg/neorg/#-installationquickstart}[Installation / Quickstart]
32 |
33 | - I'd recommend following the `Treesitter` section as well to install `tree-sitter-norg` spec.
34 | -- `run = ":Neorg sync-parsers",`
35 | - *Mac Users*: ensure that the CC environment variable points to a compiler that has C++14 support.
36 | -- Details written in github README.
37 | -- {https://github.com/nvim-neorg/tree-sitter-norg/issues/7#issuecomment-1291508121}[Issue and How to solve]
38 |
39 | ** v8.0 Luarocks Dependency
40 |
41 | From neorg v8.0, dependencies are managed by [luarocks.nvim](https://github.com/vhyrro/luarocks.nvim),
42 | which uses luarocks under the hood to manage *versioned* dependencies.
43 |
44 | This change brings a lot of benefits to both developers and users, but the biggest is that
45 | end users do no need to manage dependencies at all.
46 |
47 | Let's start by installing the plugin.
48 | @code lua
49 | return {
50 | "vhyrro/luarocks.nvim",
51 | priority = 1000,
52 | config = true,
53 | }
54 | @end
55 |
56 | This is the only required dependency. As you can see in the kickstart config below,
57 | delete all the lines except for luarocks and everything will be installed on its own from v8.0.
58 |
59 | However, if you define other dependencies such as {** Your Own Module}[external modules],
60 | you still need to install those via lazy.nvim and add them to the dependencies list.
61 |
62 | *Delete `build = ":Neorg sync-parsers` line from the kickstart config.*
63 |
64 | Read {https://vhyrro.github.io/posts/neorg-and-luarocks/#the-fix}[vhyrro's blog - Neorg 8.0.0] for
65 | more details.
66 | If you encounter a bug, please report it to {https://github.com/nvim-neorg/neorg/issues/1342}[Luarocks Issues Thread].
67 | That'll definitely help the developers!
68 |
69 | ** Kickstart Config
70 | Here is my basic config. I'll explain about `modules` in {* Modules}.
71 |
72 | @code lua
73 | -- lazy.nvim spec
74 | local M = {
75 | "nvim-neorg/neorg",
76 | ft = "norg",
77 | dependencies = {
78 | "luarocks.nvim", -- this is it.
79 | -- "nvim-treesitter/nvim-treesitter",
80 | -- "nvim-treesitter/nvim-treesitter-textobjects",
81 | -- "nvim-cmp",
82 | -- "nvim-lua/plenary.nvim",
83 | },
84 | -- build = ":Neorg sync-parsers", -- and delete this line.
85 | cmd = "Neorg",
86 | }
87 | local modules = {
88 | ["core.defaults"] = {},
89 | ["core.completion"] = { config = { engine = "nvim-cmp", name = "[Norg]" } },
90 | ["core.integrations.nvim-cmp"] = {},
91 | ["core.concealer"] = { config = { icon_preset = "diamond" } },
92 | ["core.keybinds"] = {
93 | -- https://github.com/nvim-neorg/neorg/blob/main/lua/neorg/modules/core/keybinds/keybinds.lua
94 | config = {
95 | default_keybinds = true,
96 | neorg_leader = "",
97 | },
98 | },
99 | ["core.dirman"] = {
100 | config = {
101 | workspaces = {
102 | Notes = "~/Nextcloud/Notes",
103 | Work = "~/Nextcloud/Work",
104 | }
105 | }
106 | },
107 | }
108 | M.opts = {
109 | load = modules,
110 | }
111 | return M
112 | @end
113 |
114 | If you still have problems setting up `neorg`, `@d-r-a-b` explains more thoroughly in
115 | {https://gist.github.com/d-r-a-b/3af7083a018be15e6c1d1d2c5317e9c7}[Understanding Neorg dependencies].
116 | I'd really recommend this as well.
117 |
118 | *** `core.dirman`
119 | This module manages what are called /workspaces/.
120 |
121 | You can define multiple workspaces at `config["core.dirman"].config.workspaces`, and open with
122 | command `:Neorg workspace `.
123 | This command opens `/path/to/workspace/index.norg` which is like the entry point file.
124 |
125 | Norg files inside a workspace can be linked with `{:$/path/to/file:}`.
126 | So for example, inside workspace `Notes = "~/Nextcloud/Notes"`,
127 | `~/Nextcloud/Notes/journal/2023-04-16.norg` would be `{:$Notes/journal/2023-04-16:}`.
128 | Or, it can be abbreviated to `$/` when referring from files in the same workspace. More info in {* Links} section.
129 |
130 | * How to Write Your Notes
131 | ** Basics of Modules
132 | There is a config option `config.load = {}` to define modules you want to use.
133 |
134 | ,I decomposed that into a local var `modules` in above code for simplicity tho.,
135 |
136 | More information about modules in {* Modules} section.
137 | I'd recommend just simply adding the ones already stated in {** Kickstart Config}.
138 |
139 | ** How to Write Notes
140 | Below text is a sample note which explains about the norg syntax.
141 |
142 | Run `:Neorg toggle-concealer` to see the raw text.
143 |
144 | * Heading 1
145 | - Spec: {:1.0-specification:** Structural Detached Modifiers}
146 | -- This links to a local copy of {https://github.com/nvim-neorg/norg-specs/blob/main/1.0-specification.norg}.
147 | -- Read {https://github.com/pysan3/Norg-Tutorial#before-you-start}[Before you start] and download these files.
148 |
149 | Normal text here.
150 | Single new line will be ignored.
151 |
152 | Double new lines mean a new paragraph.
153 |
154 | ** Heading 2
155 | Indentation of normal text is advised to align with the start of the heading name.
156 | See? The indentation of this text is different from the ones in {* Heading 1}.
157 |
158 | Oh, BTW that's how you create in-document links. Literal heading name wrapped in `{}`.
159 | Press `` on the link to jump to the definition.
160 | (case, space *in*-sensitive, punctuation *sensitive*).
161 | More about links in {* links}
162 | ---
163 |
164 | With `---`, you can decrease the heading level. This text is inside {* Heading 1} again.
165 |
166 | - Bullet List
167 | -- Spec: {:1.0-specification:*** Unordered Lists}
168 | -- Second level bullet is with `--` and not an indented `-`.
169 | --- Third level
170 | -- Second level
171 | - In insert mode, press `` to create a new bullet.
172 | -- Press ``, `` to increase, decrease the level.
173 | -- More info can be found {https://github.com/nvim-neorg/neorg/wiki/Indent}[Wiki - Indent] or {https://github.com/nvim-neorg/neorg/blob/main/lua/neorg/modules/core/keybinds/keybinds.lua}[Raw code].
174 |
175 | ~ Numbered List
176 | ~~ Spec: {:1.0-specification:*** Ordered Lists}
177 | ~~ It's `~`, not `1.` (Tho the conceal makes it look like that)
178 | -- Can be mixed with bullets as well (not in markdown tho).
179 | ~ Second
180 |
181 | > Quotes
182 | >> Spec: {:1.0-specification:*** Quotes}
183 | >> Quote level 2
184 |
185 | - You can use {:1.0-specification:*** TODO Status Extension}[TODO lists] in combination with these lists.
186 | -- I highly suggest reading this section as well.
187 |
188 | * Links
189 | - Spec: {:1.0-specification:** Link Location}
190 |
191 | There are so so many types of useful links in `norg`.
192 | You can also press `` on all links to open the appropriate application.
193 | (e.g. urls are opened in the browser.)
194 |
195 | Again, `Vhyrro` does a great job explaining about links in his video,
196 | {https://youtu.be/Bi9JiW5nSig?t=17m44s}[From No Org to Neorg #2: 17:44~] so go ahead and watch that video.
197 |
198 | ** Links Examples
199 | - URL: `{https://xxx.example.com}`
200 | -- URL with name: {https://github.com/nvim-neorg/neorg/}[Neorg GitHub]
201 | - Norg files
202 | -- Relative to current file: `{:foo/bar:}` -> `foo/bar.norg`
203 | -- Absolute path: `{:/tmp/foo/bar:}` -> `/tmp/foo/bar.norg`. (Also works with `~/` = `$HOME/`)
204 | -- Relative to current workspace: `{:$/foo/bar:}` -> `~/Norg/Notes/foo/bar.norg`
205 | -- Relative to different workspace: `{:$work/foo/bar:}` -> `~/Norg/work/foo/bar.norg`
206 | - Usual files: `{/ /path/to/file}`
207 | - Headings: {* Heading 1}
208 | -- Any level heading: {# Heading 2}
209 |
210 | *AND YOU CAN COMBINE THEM*
211 | - `Heading 1` of `foo/bar.norg`: {:foo/bar:* Heading 1}
212 | - Line numbers: {:foo/bar:4}
213 |
214 | * Attached Modifiers
215 | - \*bold\*: *bold*
216 | - \/italic\/: /italic/
217 | - \_underline\_: _underline_
218 | - \-strike-through\-: -strike-through-
219 | - \!spoiler\!: !spoiler!
220 | - \^superscript\^: ^superscript^ (cannot be nested into `subscript`)
221 | - \,subscript\,: ,subscript, (cannot be nested into `superscript`)
222 | - \`inline code\`: `inline code` (disables any nested markup - verbatim)
223 | - \%{** Null Modifier}[null modifier]\%: %null modifier%
224 | - \$inline math\$: $f(x) = y$ (verbatim)
225 | - \&variable\&: &variable& (verbatim)
226 |
227 | * Modules
228 | Keys passed to `config.load` are name of modules. Their documents can be found in
229 | {https://github.com/nvim-neorg/neorg/wiki}[Neorg - Wiki] -> Pages.
230 |
231 | I already mentioned the necessary ones in {** Kickstart Config}, but here are ones I personally use on top of them.
232 | @code lua
233 | local modules = {
234 | ... -- ones mentioned in {** Kickstart Config}
235 | ["core.esupports.metagen"] = { config = { type = "auto", update_date = true } },
236 | ["core.qol.toc"] = {},
237 | ["core.qol.todo_items"] = {},
238 | ["core.looking-glass"] = {},
239 | ["core.presenter"] = { config = { zen_mode = "zen-mode" } },
240 | ["core.export"] = {},
241 | ["core.export.markdown"] = { config = { extensions = "all" } },
242 | ["core.summary"] = {},
243 | ["core.tangle"] = { config = { report_on_empty = false } },
244 | ["core.ui.calendar"] = {},
245 | ["core.journal"] = {
246 | config = {
247 | strategy = "flat",
248 | workspace = "Notes",
249 | },
250 | },
251 | }
252 | @end
253 |
254 | ** Notes for Important Modules
255 | *** `core.journal`
256 | - {https://github.com/nvim-neorg/neorg/wiki/Journal}
257 |
258 | This adds commands `:Neorg journal {today,tomorrow,yesterday}`,
259 | which opens norg file with the appropriate date as name.
260 | Also, take a look at {https://github.com/nvim-neorg/neorg/wiki/Calendar}[`core.ui.calendar`]
261 | to add `:Neorg journal custom` command to choose a date with a calendar UI.
262 |
263 | Great for diary :)
264 |
265 | *** `core.keybinds`
266 | - {https://github.com/nvim-neorg/neorg/wiki/User-Keybinds}
267 |
268 | To register `norg` file specific keybinds, read this section:
269 | {https://github.com/nvim-neorg/neorg/wiki/User-Keybinds#setting-up-a-keybind-hook}[Neorg - Wiki - User-Keybinds - Setting Up a Keybind Hook].
270 |
271 | The default keybinds are listed {https://github.com/nvim-neorg/neorg/blob/main/lua/neorg/modules/core/keybinds/keybinds.lua}[here].
272 |
273 | *** `core.export`
274 | - {https://github.com/nvim-neorg/neorg/wiki/Exporting-Files}
275 |
276 | You will want {https://github.com/nvim-neorg/neorg/wiki/Markdown-Export}[`core.export.markdown`] as well
277 | to export your files to markdown format.
278 |
279 | Read {** Export / Import} section for instructions for other filetypes in detail.
280 |
281 | *** `core.summary`
282 | - {https://github.com/nvim-neorg/neorg/wiki/Summary}
283 |
284 | Use `:Neorg generate-workspace-summary` to generate a summary of the entire
285 | workspace with links to each respective entry.
286 |
287 | It seems that it has some bugs that are being worked on.
288 | - ✅ -{https://github.com/nvim-neorg/neorg/issues/1108}-
289 | - {https://github.com/nvim-neorg/neorg/issues/1071}
290 |
291 | *** `core.tangle`
292 | - {https://github.com/nvim-neorg/neorg/wiki/Tangling}
293 |
294 | Use `:Neorg tangle current-file` to export the code blocks in the current file into another file.
295 |
296 | Basics are listed below, but you've got more options to control the output.
297 | See the {https://github.com/nvim-neorg/neorg/wiki/Tangling#usage-tutorial}[official wiki] for more information.
298 |
299 | **** Tangle each code block.
300 | |example
301 | #tangle init.lua
302 | @code lua
303 | -- This will be tangled to init.lua
304 | print("Hello from init.lua!")
305 | @end
306 | |end
307 |
308 | **** Tangle entire document.
309 | Specify output file inside `@document.meta`.
310 | - Want to export to multiple files? => {https://github.com/nvim-neorg/neorg/wiki/Tangling#global-tangling-for-multiple-files}[More complex options.]
311 | |example
312 | @document.meta
313 | tangle: ./init.lua
314 | @end
315 |
316 | @code lua
317 | -- This will be tangled to init.lua
318 | print("Hello from init.lua!")
319 | @end
320 |
321 | #tangle.none
322 | @code lua
323 | -- Ignore this code block
324 | print("Not tangled.")
325 | @end
326 | |end
327 |
328 | **** Automatically tangle current file on save using `autocmd`.
329 | @code lua
330 | vim.api.nvim_create_autocmd("BufWritePost", {
331 | pattern = "*.norg",
332 | command = "Neorg tangle current-file",
333 | })
334 | @end
335 |
336 | *** `core.looking-glass`
337 | - {https://github.com/nvim-neorg/neorg/wiki/Looking-Glass}
338 |
339 | Use `:Neorg keybind all core.looking-glass.magnify-code-block` to edit code blocks in an external buffer,
340 | which allows LSPs and other language-specific tools to kick in.
341 |
342 | !{https://user-images.githubusercontent.com/76052559/216782314-5d82907f-ea6c-44f9-9bd8-1675f1849358.gif}[looking-glass]
343 |
344 | ** Export / Import
345 | You can convert your `norg` notes from / to different formats.
346 | You've got mainly three options to export and one to import.
347 | For exporting, I find {*** Export: `norg-pandoc`} the most stable at the moment (2023-11-05)
348 | but {*** Export: `norganic + pandoc + Norg.jl`} works pretty well as well.
349 |
350 | *** Builtin Export Module
351 | `:Neorg export to-file foo.md` -> Exports to `foo.md` in markdown format.
352 |
353 | This only supports markdown and the conversion is not very reliable.
354 | However, you can use this as a neovim command, so it's the easiest among others.
355 |
356 | This is a function to export to `suffix` with the same dir and name of current file.
357 | @code lua
358 | local export_file = function(suffix, open_preview)
359 | local dst = vim.fn.fnamemodify(vim.fn.expand("%"), ":~:.:r") .. suffix -- same name but with suffix
360 | vim.cmd(string.format([[Neorg export to-file %s]], string.gsub(dst, " ", [[\ ]])))
361 | vim.schedule(function()
362 | vim.cmd.edit(dst)
363 | if suffix == ".md" and open_preview then
364 | vim.cmd([[MarkdownPreview]]) -- https://github.com/iamcco/markdown-preview.nvim
365 | end
366 | end)
367 | end
368 | -- export_file(".md", true)
369 | @end
370 |
371 | *** Export: `norganic + pandoc + Norg.jl`
372 | {https://github.com/Klafyvel/Norg.jl/}[`Norg.jl`] is a project to parse norg format file written in julia.
373 | {https://github.com/klafyvel/norganic}[`norganic`] is a frontend of `Norg.jl` to use the tool from command line.
374 |
375 | For installation document, please read norganic's {https://github.com/klafyvel/norganic}[README].
376 |
377 | - Example usage:
378 | -- Convert norg file to html file.
379 | @code bash
380 | $ norganic html --input /path/to/file.norg --output /path/to/file.html
381 | @end
382 | -- Convert norg file to arbitrary file using `pandoc`.
383 | --- norganic can output specific json format that pandoc understands and can convert to any format of file.
384 | --- Note that things might not work here and there.
385 | @code bash
386 | $ norganic json --input /path/to/file.norg | pandoc -f json -t /path/to/output.xxx
387 | @end
388 |
389 | *** Export: `norg-pandoc`
390 | {https://github.com/boltlessengineer/norg-pandoc}[`norg-pandoc`] is a plugin for pandoc to parse norg format written in lua.
391 | A parser in directly added to pandoc, but you have to git clone and run pandoc inside `norg-pandoc`'s directory
392 | (or add this dir to lua's runtime path I guess?), so it is kinda cumbersome to run.
393 | @code bash
394 | $ git clone https://github.com/boltlessengineer/norg-pandoc.git
395 | $ cd norg-pandoc
396 | $ pandoc -f init.lua -t gfm /path/to/file.norg -o /path/to/output.md
397 | # gfm (GitHub flavored markdown)
398 | @end
399 |
400 | {/ ./norg_tutorial.md} is generated using this tool with a combination of
401 | {https://github.com/pysan3/dotfiles/blob/main/static/remove_empty_lines_in_lists.py}[my custom script]
402 | to remove unnecessary newlines when exporting to markdown at the moment.
403 | @code bash
404 | $ pandoc -f init.lua -t gfm /path/to/norg_tutorial.norg | python remove_empty_lines_in_lists.py > /path/to/norg_tutorial.md
405 | @end
406 |
407 | *** Import: `pandoc + minorg`
408 | {https://github.com/pysan3/minorg}[`minorg`] is a tool to convert pandoc json format to norg file.
409 | Theoretically, it should be able to convert from all file formats that pandoc supports (and it's extensions).
410 |
411 | Please install the tool via {https://github.com/pysan3/minorg/releases}[minorg - Releases]
412 |
413 | - Example usage:
414 | -- Convert from markdown.
415 | @code bash
416 | $ pandoc -f markdown -t json /path/to/input/file.md | minorg generate -o /path/to/output.norg
417 | @end
418 | -- Convert Obsidian files.
419 | --- Obsidian markdown flavor is a bit out of the standards and pandoc fails to parse it correctly.
420 | --- I've implemented some workarounds specifically for obsidian style markdowns.
421 | @code bash
422 | $ pandoc -f markdown -f json /path/to/obsidian/file.md | minorg generate -o /path/to/output.norg --isObsidian --workRootDir=/path/to/workspace
423 | @end
424 | - For more usage examples (for example convert whole dir recursively), please read the {https://github.com/pysan3/minorg}[README].
425 | - BTW, I'm the author of this cli tool, so if you have any problem, don't hesitate to send me an issue or feature request.
426 |
427 | *** Future: tree-sitter v3 parser
428 | The tree-sitter parser for norg format version 3 is being worked at the moment.
429 | I've not been able to follow the development closely but I heard that it might work if you compile locally at the moment (2023-11-06).
430 |
431 | After this parser is complete, we should be able to write a working importer / exporter with the output of the parser
432 | to plug into pandoc to have a reliable result.
433 |
434 | ** Image Support
435 | Image support in norg file is partially done, partially not.
436 |
437 | The syntax is like below and the second format is currently discussed for inline images.
438 | |example
439 | %preferred image syntax, image.nvim supports this out of the box%
440 | .image /path/to/image.png
441 |
442 | %inline image syntax being discussed. No real implementation or parser supports this yet%
443 | {url}[alt text](image)
444 | {/ /path/to/img.png}[alt text](image)
445 | |end
446 |
447 | Parser or especially the {*** Builtin Export Module} does not fully support this.
448 | Read {** Embed Images} if you want a workaround to have a working markdown export now.
449 |
450 | *** Visualization
451 | {https://github.com/3rd/image.nvim}[`image.nvim`] is an awesome plugin that can inject the images inside the neovim buffer
452 | if you use /kitty-graphics-protocol/ compatible terminal.
453 |
454 | {https://github.com/nvim-neorg/neorg/issues/971#issuecomment-1620775558}[Working example GIF].
455 |
456 | ** Table Syntax
457 | The table syntax is one of the most powerfull, but really tricky thing in norg's specification.
458 | I will try my best to explain.
459 | Even if it's hard to comprehend, skim through til the {*** Table Format Examples} section and you might get the hang of it.
460 |
461 | There are two syntax to define a table, one easy but limited and one that is very extensible.
462 |
463 | *** Markdown Wrapper
464 | This format is very easy. It is basically the same as markdown table format wrapped in `@table - @end`.
465 |
466 | One pro is that it should work with some markdown exporter at the momemt.
467 | |example
468 | @table
469 | | Head a | Head b | Head c |
470 | | - | - | - |
471 | | Cell 1 | Cell 2 | Cell 3 |
472 | | Cell 4 | Cell 5 | Cell 6 |
473 | @end
474 | |end
475 |
476 | *** Rich Table Format
477 | This table format has infinite size table and you can specify the cell positions with movement (relative) commands.
478 |
479 | Here are the three ways to write a cell. It consists of `: : cell content`.
480 | |example
481 | %basic format%
482 | : .
483 | cell content
484 |
485 | %shorthand syntax when content fits in single line%
486 | : . : cell content
487 |
488 | %multi line content syntax. you also need the closing :: below%
489 | :: .
490 | - cell
491 | - content
492 | ::
493 | |end
494 |
495 | Now let's talk about the movements. These should go into the `.` part in the above example.
496 | In this example, `A1` means first row, first column, `C2` means *second row (2)*, *third column (C)*.
497 | Look at `MS Excel` for more visual explanation.
498 | - `.`: Top left (A1) of the table.
499 | - `>` / `<`: Go one left / right.
500 | -- You can prefix number to move multiple times. `3>` moves three right.
501 | - `^` / `v`: Go one up / down. Also combine with numbers.
502 | - `_`: Move to leftmost column on the next row. (If on `D1` and `_` will go to `A2`)
503 | - `/`: Like `_` but vertically. Move one right and to the top. Imagine an upper-right arrow (↗️).
504 |
505 | One special case is that when you go `<` on `A?` (left most column), it will wrap around and go to
506 | the cell one row above and all the way to the right (that has content). (`A2` -> `<` -> `X1`)
507 |
508 | Another option other than relative movement is to specify absolute cell position.
509 | - `: A1 : cell content`: Position `A1`.
510 | - `: B1 : second cell`: Obviously cell next to `A1`.
511 | - `: A1-A4 : multi row cell`: You can specify a multi row / column cell with this format.
512 |
513 | %Norg also has the concept of `&variable&` which holds some value, controllable with {# macros}%
514 |
515 | **** Alignments
516 | You can align the cell content with `+align right` above the cell row.
517 | Note that these are still *very work in progress* and neither the exporter nor the parser understand it,
518 | and /might even change in the future/.
519 | Other variances are...
520 | - `+align left`: align a single cell
521 | - `#align center`: align all cells to the center after this line
522 | - `#align.columns A right`: align all cells in `A` column
523 |
524 | *** Table Format Examples
525 | Let's wrap our heads around with some examples. The following tables represent the same thing.
526 |
527 | |example
528 | @table
529 | (This is not a valid table, just added the wrapper to avoid parser errors)
530 | | Head a | Head b | Head c |
531 | | --------- | --------- | --------- |
532 | | multi | multi col cell |
533 | | row | --------- | --------- |
534 | | cell | Cell 5 | Cell 6 |
535 | | --------- | --------- | --------- |
536 | @end
537 |
538 | #align left
539 | : . : Head a
540 | +align right
541 | : > : Head b
542 | +align center
543 | : > : Head c
544 | : A2-A3 : multi row cell
545 | : B2-C2 : multi col cell
546 | #align right
547 | : _> : Cell 5
548 | : > : Cell 6
549 | |end
550 |
551 | The following mimics table in {*** Markdown Wrapper}.
552 | Although you can totally express this table with only `. > _`, I purposely used different notations as well.
553 | BTW, there are no ways to express `` cells at the moment. The format is being discussed at {** Discord} right now (2023-11-06).
554 | |example
555 | : . : Head a
556 | : B1 : Head b
557 | : C1
558 | Head c
559 | : _ : Cell 1
560 | : 5>4<
561 | Cell 2
562 | :: >
563 | Cell 3
564 | ::
565 | : >>>_ : Cell 4
566 | : /2v : Cell 5
567 | : _2>^ : Cell 6
568 | |end
569 |
570 | ** Macros
571 | Macros in norg format starts with one of (`#`, `@`, `.`, `|`) and can invoke a function written in
572 | {https://janet-lang.org/}[Janet Langauge].
573 | You've already seen this with `#align`, `@table`, `.image`, `|example` and so on.
574 | The spec hasn't matured yet but we are working on it steadily.
575 | We will see things like `+color:red` and many more interesting ones that connects to database soon -I mean pretty in long term...-.
576 |
577 | *** Attached Modifier Extensions (WIP)
578 | Macros or labels attached on attached modifiers.
579 |
580 | Best example is the below where `(lang:norg)` extends the inline code block (backticks).
581 | |example
582 | - `* Heading`(lang:norg)
583 | |end
584 |
585 | *** Detached Modifier Extensions (WIP)
586 | Kind of like a tag attached to headings, bullet points and some other stuffs.
587 |
588 | Best example is the todo items where `- (x) item` means that this bullet point has attribute /TODO item/ and /IS DONE/.
589 | These modifiers can be chained together with a pipe (`|`).
590 | Below example means a heading that is /TODO item/ and /PENDING/ and /PRIORITY A (A is highest)/.
591 | |example
592 | * (-|# A) Heading 1
593 | |end
594 |
595 | ** Your Own Module
596 | If you want to create your own module for neorg, this video is very useful.
597 | {https://www.youtube.com/watch?v=j4lTvIGRhmw&list=PLxpY86LRR3B0rtOBjXAsq1XnsOt4m4owu}[YouTube - Neorg Custom Modules]
598 |
599 | Here's one external module I implemented: {https://github.com/pysan3/neorg-templates}[neorg-templates],
600 | which adds support for template files with the power of `LuaSnip`.
601 |
602 | Feel free to explorer the code.
603 |
604 | * Explore More Norg
605 | ** {https://github.com/NTBBloodbath/awesome-neorg}[Awesome Neorg]
606 | > A collection of awesome Neorg notes, software and resources.
607 |
608 | - You might find more useful neorg external modules to integrate to your workflow.
609 |
610 | ** {https://github.com/orgs/nvim-neorg/repositories}[Other Official Projects]
611 | There are many other projects going on around the `norg` format.
612 |
613 | ** GitHub Tags
614 | Of course you can search through GitHub with tags.
615 | - `norg`: {https://github.com/topics/norg}
616 | -- More likely to find external modules.
617 | - `neorg` {https://github.com/topics/neorg}
618 | -- More likely to find personal dotfiles and other configs.
619 |
620 | ** Discord
621 | More, alpha stage concepts are discussed in the Discord channel.
622 |
623 | Feel free to join: {https://discord.gg/T6EgTAX7ht}
624 |
625 | * Tips
626 | ** Embed Images
627 | *This section is old.* Read {** Image Support} for new information.
628 | -As far as I know, there are *NO* specifications about how to embed / link to an image.-
629 |
630 | Update: 2023-10-19.
631 | - Spec for image added: {https://github.com/nvim-neorg/norg-specs/issues/14}.
632 | |example
633 | .image /path/to/image.png
634 | |end
635 |
636 | - There are also some attempts to add image preview support thanks to {https://github.com/3rd/image.nvim}[image.nvim].
637 | -- {https://github.com/nvim-neorg/neorg/issues/971}
638 | - Markdown export and treesitter parsing is not yet /fully/ implemented,
639 | so I'd suggest using the old workaround described below for now.
640 |
641 | *** OLD: Discussions
642 | - {https://github.com/nvim-neorg/neorg/discussions/768}[Is there any way to insert a image just like kitty icat does #768]
643 | - {https://github.com/nvim-neorg/neorg/discussions/791}[render.nvim #791]
644 | ---
645 |
646 | *** OLD: Workaround
647 |
648 | As a workaround, funny enough, you can prepend a link with `!` like `!{path}[name]` to link to an image,
649 | which will be correctly converted to image tag when exported to markdown files.
650 | (Of course this only works with markdown and I hope this will not become the correct way.)
651 | |example
652 | !{https://user-images.githubusercontent.com/76052559/150838408-1a021d7b-1891-4cab-b16e-6b755e741e87.png}[Norg format]
653 | |end
654 | Example:
655 | !{https://user-images.githubusercontent.com/76052559/150838408-1a021d7b-1891-4cab-b16e-6b755e741e87.png}[Norg format]
656 |
657 | ** Sync with Git, Nextcloud, etc
658 | *BACKUP YOUR NOTES*
659 |
660 | *** Nextcloud, Edit on Your Phone
661 | If you use selfhosted Nextcloud, you can edit your `norg` notes from your phone.
662 |
663 | **** After Logging In
664 | ~ Install {https://apps.nextcloud.com/apps/notes}[Notes app]
665 | ~ Go to {https://nextcloud.your.domain/apps/notes}
666 | ~ Go down to `Notes settings`
667 | ~ Change `File extension for new notes`
668 | ~~ `User defined` -> `.norg`
669 |
670 | **** On Your Phone
671 | ~ Access page with safari. ,I'm sorry but I use iPhone...,
672 | ~~ Shoud work on other phones as well tho.
673 | ~ Go to {https://nextcloud.your.domain/apps/notes}
674 | ~ Press `share` to `Add page to home`.
675 | ~ You have a new app that jumps directly to notes
676 |
677 | **** Notes
678 | - Might not work if you have {https://github.com/nextcloud/text}[Text] app installed
679 |
--------------------------------------------------------------------------------
/static/build-done.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pysan3/Norg-Tutorial/d93852da5710bb322d1dc946db67704091364be1/static/build-done.png
--------------------------------------------------------------------------------
/static/lazy-uninstalled.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pysan3/Norg-Tutorial/d93852da5710bb322d1dc946db67704091364be1/static/lazy-uninstalled.png
--------------------------------------------------------------------------------
/static/luarocks-build.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pysan3/Norg-Tutorial/d93852da5710bb322d1dc946db67704091364be1/static/luarocks-build.png
--------------------------------------------------------------------------------
/static/neorg-build.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pysan3/Norg-Tutorial/d93852da5710bb322d1dc946db67704091364be1/static/neorg-build.png
--------------------------------------------------------------------------------
/static/plugin-dir.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pysan3/Norg-Tutorial/d93852da5710bb322d1dc946db67704091364be1/static/plugin-dir.png
--------------------------------------------------------------------------------
| | | |