Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
* upstream/main:
  feat(keybinds.lua): add descriptions to all keybinds
  chore: format with stylua
  feat(keybinds.lua): add `desc` fields to task keybinds (nvim-neorg#926)
  fix(core.summary): bugs + flexibility around incomplete metadata (nvim-neorg#927)
  docs(concealer): add comments for generators an formatters
  feat: add extra nesting level, make icons specific to non-anticonceal usage
  feat(concealer): add more icon generators
  feat(concealer): add numeric anticonceal if supported
  fix(concealer): record cursor upon init to fix first line conceal (nvim-neorg#924)
  feat: conceal the `{* }` parts of links
  fix(concealer): fix concealing in anchors, don't error on broken config (nvim-neorg#923)
  docs(todo_items): old keybinds in wiki
  docs: update `breaking-changes.norg`
  refactor!: remove the `core.news` module
  docs(README): make lazy.nvim install instructions more standard (nvim-neorg#905)
  refactor(docgen): remove unused variable
  fix(docgen): fix incorrect markdown indentation in wiki
  fix(docgen): don't fail on mixed-type tables (lists and dictionaries at the same time)
  fix(docgen): propagate docgen error exit code (nvim-neorg#917)
  refactor(promo): remove notify concealer (nvim-neorg#919)
  fix(concealer): do not listen vimleavepre (nvim-neorg#920)
  fix(concealer): minor fixes, plus wiki error fix (nvim-neorg#916)
  feat(concealer)!: rewrite for performance and stability (nvim-neorg#834)
  docs(wiki/Home.md): incorrect formatting in first paragraph
  refactor(core.highlights): don't halt execution when highlights cannot be applied
  fix(core.highlights): wrongly placed bracket
  fix(core.highlights): fix disappearing highlights when opening up norg files
  fix(highlights): attempt to reenable highlighting when none is found
  fix(todo_items): don't look at child if parent is todo (nvim-neorg#909)
  perf(core.promo): don't check `v.count`, use `v.count1` instead
  feat(promo): promote/demote prefix without following text (nvim-neorg#912)
  chore(highlights): add error message to assert for easier user debugging
  fix(highlights): assert on treesitter being enabled (nvim-neorg#914)
  feat(itero): don't start newline on empty line (nvim-neorg#911)
  refactor!(todo-items): since 5.0 do not warn about deprecated keybinds
  refactor!: since 5.0 do not longer warn about deprecated `core.norg.*` modules
  feat!: move to new/improved metadata parser, change highlight queries
  refactor(hop): add nicer error messages, format with stylua
  feat(esupports.hop): link jump to line + fixes + refactoring (nvim-neorg#903)
  refactor: remove `core.syntax` from the default module list
  chore(config.lua): update version variable
  chore(main): release 4.6.0 (nvim-neorg#900)
  feat(todo-items): add missing "need input" icon and action (nvim-neorg#896)
  fix(esupports): use structured api to avoid injection (nvim-neorg#899)
  fix(tempus): supply unprovided parameters from the current date when converting to `osdate` (supercedes nvim-neorg#897)
  chore(config.lua): update version variable
  chore(main): release 4.5.0 (nvim-neorg#883)
  fix: TSInstall issues on macOS, hopefully once and for good (nvim-neorg#891)
  docs(README): add treesitter fix for macos (nvim-neorg#887)
  feat: add colouring to TODO items
  docs: update ROADMAP.md
  fix(metagen): update generation to use user config for `updated` tag (nvim-neorg#882)
  chore(config.lua): update version variable
  chore(main): release 4.4.1 (nvim-neorg#880)
  docs(concealer): mention nerd font dependency for concealer (nvim-neorg#875)
  fix(tempus): properly handle conversions w.r.t Sun-Sat/Mon-Sun
  refactor: add `number_wrap()` function to `neorg.lib`
  fix(tempus): paste correct weekday from calendar
  chore(config.lua): update version variable
  chore(main): release 4.4.0
  fix(tempus): don't use the `re` module if it doesn't exist (nvim-neorg#872)
  feat(journal): allow `custom` to take in no arguments, in which case spawn a calendar
  fix(promo): don't add whitespace to empty lines (nvim-neorg#852)
  chore(config.lua): update version variable
  chore(main): release 4.3.0
  feat(calendar): add `t` command for "today"
  fix(hop): assume <current-day> when some parameters to dates are not supplied
  feat(hop): allow users to jump to timestamps
  fix(tempus): days like `4th`/`2nd` would not get parsed properly
  refactor(calendar): allow a target date to be supplied to the view
  chore(config.lua): update version variable
  chore(main): release 4.2.0
  fix: don't allow tempus to load unless the Neovim ver is at least 0.10.0
  feat(tempus): add insert mode `<M-d>` keybind to insert a date
  fix(tempus): do not assume `osdate` has all fields set
  feat(tempus): add `,id` (insert date) keybinding
  feat(tempus): allow dates to be converted to norg-compatible dates with `tostring()`
  chore(config.lua): update version variable
  chore(main): release 4.1.1
  fix: remove calendar as a dependency of `core.ui`, fix errors for people not on nightly
  chore(config.lua): update version variable
  chore(main): release 4.1.0
  refactor: remove `core.tempus` from `core.defaults`
  docs(tempus): add top documentation comment
  docs(calendar): add top documentation comment
  fix(calendar): allow the view to be written to on rerender
  feat(calendar): add `?` help page for custom input
  feat(calendar): implement basic `i` functionality
  feat(tempus): add `to_lua_date` function
  feat: add `core.tempus` module for date management
  feat(calendar): allow many simultaneous calendars
  fix(calendar): if another calendar is open then close it instead of erroring
  feat(calendar): add basic help popup when `?` is invoked
  refactor(core.ui): do not autoclose splits made via `create_split`
  fix(calendar): prevent the buffer from being modifiable after it has been filled
  fix(calendar): fix incorrect movement with `H` across boundaries of months with different lengths
  feat(calendar): add `$` and `0`/`_` navigation keybinds
  feat(calendar): add `m`/`M`, `L`/`H` and `y`/`Y` keybinds for the monthly view
  ref(calendar): implemented distance (monthly view) and run make format (nvim-neorg#858)
  ref(calendar): refactored view outside of calendar module (nvim-neorg#815)
  Fixed style with stylua
  Added standalone mode
  Fixed style with stylua
  Converted calendar into its own module
  Select range highlight hook is now more concise
  Mode integration (WIP)
  fix(calendar): properly display "today's day" in the calendar view
  chore: format with stylua, fix LLS warnings
  ref(calendar): refactored extmark creation, fixed single month view and added month limit (nvim-neorg#796)
  ref(calendar): extract rendering logic, add and improve keybinds (nvim-neorg#790)
  ref(calendar): extract logic, fix bug with time reformatting (nvim-neorg#788)
  fix(calendar): overlapping month names in the calendar view
  chore(calendar): initial setup for the screen update functionality
  ref: use numbers instead of strings for internal date structures
  feat: correctly handle year boundaries
  feat: add left-right cursor movement
  feat: place cursor over current day when creating calendar
  fix(calendar): make distance between each month uniform and support modifying the distance between each month
  feat(calendar): render as many months as is possible on screen
  feat(calendar): generalize functions even further, allow for offsets
  fix(calendar): fix rest of highlight groups
  fix(calendar): make month rendering work again
  fix(calendar): reversed namespace names
  fix(core.ui.calendar): wrong extmark being queried in month render routine
  feat: implement `render_month` function
  ref(core.ui.calendar): extract even more logic to `module.private`
  ref(core.ui.calendar): continue small refactors
  fix(core.ui.calendar): logic error when parsing virt_text length for `set_logical_extmark`
  ref(core.calendar.ui): begin code refactor (make the codebase ready for calendar logic)
  ref(core.ui.calendar): put rendered month extmark in decorational namespace
  feat(core.ui.calendar): highlight the current day differently
  ref(core.ui.calendar): move decorational namespace out of the `do .. end` block
  feat(core.ui.calendar): add day of the month rendering
  feat(core.ui.calendar): make the calendar display full month names
  feat(core.ui.calendar): implement more of the barebones UI
  feat(core.ui): let `create_split` take in a `height` variable
  feat(core.ui.calendar): add static calendar ui
  feat: add skeleton for the calendar UI element
  • Loading branch information
normful committed Jun 4, 2023
2 parents 15be22a + bb50538 commit 51421be
Show file tree
Hide file tree
Showing 34 changed files with 3,558 additions and 1,797 deletions.
126 changes: 126 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,131 @@
# Changelog

## [4.6.0](https:/nvim-neorg/neorg/compare/v4.5.0...v4.6.0) (2023-05-25)


### Features

* **todo-items:** add missing "need input" icon and action ([#896](https:/nvim-neorg/neorg/issues/896)) ([4cb0fa9](https:/nvim-neorg/neorg/commit/4cb0fa9e56cf16672c258d1d97545d0526b506b5))


### Bug Fixes

* **esupports:** use structured api to avoid injection ([#899](https:/nvim-neorg/neorg/issues/899)) ([e50b8ae](https:/nvim-neorg/neorg/commit/e50b8aecb61dae1dd726fe00f40d3a554ba1b694))
* **tempus:** supply unprovided parameters from the current date when converting to `osdate` (supercedes [#897](https:/nvim-neorg/neorg/issues/897)) ([f367451](https:/nvim-neorg/neorg/commit/f36745161d82067e0f26865d93858fd3a15d8ad4))

## [4.5.0](https:/nvim-neorg/neorg/compare/v4.4.1...v4.5.0) (2023-05-24)


### Features

* add colouring to TODO items ([238152a](https:/nvim-neorg/neorg/commit/238152ab40ec1fb293fae75744942146876ed08f))


### Bug Fixes

* **metagen:** update generation to use user config for `updated` tag ([#882](https:/nvim-neorg/neorg/issues/882)) ([6ed0f3a](https:/nvim-neorg/neorg/commit/6ed0f3aa088e7b3141f01e3a82f3ec6517c34485)), closes [#865](https:/nvim-neorg/neorg/issues/865)
* TSInstall issues on macOS, hopefully once and for good ([#891](https:/nvim-neorg/neorg/issues/891)) ([4988a6f](https:/nvim-neorg/neorg/commit/4988a6f9166b6ac7b9ba5115e61dc3a2b13e820c))

## [4.4.1](https:/nvim-neorg/neorg/compare/v4.4.0...v4.4.1) (2023-05-17)


### Bug Fixes

* **tempus:** paste correct weekday from calendar ([ba54231](https:/nvim-neorg/neorg/commit/ba54231e14a31c0571ff7baa4828de121a5e3072))
* **tempus:** properly handle conversions w.r.t Sun-Sat/Mon-Sun ([e39fa1b](https:/nvim-neorg/neorg/commit/e39fa1b1626fc6f4bb9f4695b15d7065561c2567))

## [4.4.0](https:/nvim-neorg/neorg/compare/v4.3.0...v4.4.0) (2023-05-16)


### Features

* **journal:** allow `custom` to take in no arguments, in which case ([ea0497a](https:/nvim-neorg/neorg/commit/ea0497aea783507ce640e909b6764be4fcd5a388))


### Bug Fixes

* **promo:** don't add whitespace to empty lines ([#852](https:/nvim-neorg/neorg/issues/852)) ([a7291f4](https:/nvim-neorg/neorg/commit/a7291f4662664d0c3be3016adff6767dc52f907d))
* **tempus:** don't use the `re` module if it doesn't exist ([#872](https:/nvim-neorg/neorg/issues/872)) ([3c99638](https:/nvim-neorg/neorg/commit/3c99638db0ce4293e221216bdda03a55da6ad82b))

## [4.3.0](https:/nvim-neorg/neorg/compare/v4.2.0...v4.3.0) (2023-05-15)


### Features

* **calendar:** add `t` command for "today" ([e53a509](https:/nvim-neorg/neorg/commit/e53a5099b5725162c8f0a626823cac4819a9427d))
* **hop:** allow users to jump to timestamps ([22b12fb](https:/nvim-neorg/neorg/commit/22b12fb2301582fd9552ab10ac0c934cda4d0a14))


### Bug Fixes

* **hop:** assume &lt;current-day&gt; when some parameters to dates are not supplied ([65bf064](https:/nvim-neorg/neorg/commit/65bf06493ecb411b1589ad345771ae29aa17cd33))
* **tempus:** days like `4th`/`2nd` would not get parsed properly ([7368a8a](https:/nvim-neorg/neorg/commit/7368a8ae10a0bab32729bd00dcac6f24cb55a8ef))

## [4.2.0](https:/nvim-neorg/neorg/compare/v4.1.1...v4.2.0) (2023-05-15)


### Features

* **tempus:** add `,id` (insert date) keybinding ([34f13ba](https:/nvim-neorg/neorg/commit/34f13ba253c160e72ef7817a950508430ed050d1))
* **tempus:** add insert mode `&lt;M-d&gt;` keybind to insert a date ([b420f69](https:/nvim-neorg/neorg/commit/b420f69602b23fa8fc2f7f6526f49838f9521b10))
* **tempus:** allow dates to be converted to norg-compatible dates with `tostring()` ([3ec5f96](https:/nvim-neorg/neorg/commit/3ec5f96dfd673c2c2a34b09748518accf61ec677))


### Bug Fixes

* don't allow tempus to load unless the Neovim ver is at least 0.10.0 ([c4429fa](https:/nvim-neorg/neorg/commit/c4429fa1e1eb0c3c5652495b00aa4e1c56068914))
* **tempus:** do not assume `osdate` has all fields set ([c37a104](https:/nvim-neorg/neorg/commit/c37a104c992326f8924de783d667f7c4c34f92b7))

## [4.1.1](https:/nvim-neorg/neorg/compare/v4.1.0...v4.1.1) (2023-05-15)


### Bug Fixes

* remove calendar as a dependency of `core.ui`, fix errors for people not on nightly ([cd26a22](https:/nvim-neorg/neorg/commit/cd26a220e999cc9103a2502299d16ae8e6fab4d9))

## [4.1.0](https:/nvim-neorg/neorg/compare/v4.0.1...v4.1.0) (2023-05-14)


### Features

* add `core.tempus` module for date management ([b73ec2f](https:/nvim-neorg/neorg/commit/b73ec2f5e1b11864ca0628a842a53a617d5851ce))
* add left-right cursor movement ([ea588bb](https:/nvim-neorg/neorg/commit/ea588bbc2cabe37f90652a8cb49bf8b286498d2a))
* add skeleton for the calendar UI element ([3c99106](https:/nvim-neorg/neorg/commit/3c99106d64792533a3cf10ac6ef20a089e94c1ff))
* **calendar:** add `?` help page for custom input ([211b0ba](https:/nvim-neorg/neorg/commit/211b0ba61b5cf8f4520b5e03f5235f6de87e4417))
* **calendar:** add `$` and `0`/`_` navigation keybinds ([0061928](https:/nvim-neorg/neorg/commit/006192808d436c27f8ceca0fffcc4a238ec402a7))
* **calendar:** add `m`/`M`, `L`/`H` and `y`/`Y` keybinds for the monthly view ([9bf562d](https:/nvim-neorg/neorg/commit/9bf562d4633abac71b749ad7380cfe010a4c3bd7))
* **calendar:** add basic help popup when `?` is invoked ([779d089](https:/nvim-neorg/neorg/commit/779d089e17139acfdd2a4988c34eea892f29a475))
* **calendar:** allow many simultaneous calendars ([f816fe7](https:/nvim-neorg/neorg/commit/f816fe77ef2abecff9e98d8d35ff48a453317cf0))
* **calendar:** generalize functions even further, allow for offsets ([d857c34](https:/nvim-neorg/neorg/commit/d857c34fe7a4645501551f2b66dd7915b9575b4f))
* **calendar:** implement basic `i` functionality ([6713f40](https:/nvim-neorg/neorg/commit/6713f40d5d1f9e7a0e8b80ffdc82d4fff79c16c0))
* **calendar:** render as many months as is possible on screen ([fa23767](https:/nvim-neorg/neorg/commit/fa237674cf75bf2bbc62a438b1606b65cc277ebd))
* **core.ui.calendar:** add day of the month rendering ([8bc3364](https:/nvim-neorg/neorg/commit/8bc3364f306d5df528193a8ca68fa8b4a45701ef))
* **core.ui.calendar:** add static calendar ui ([adbb415](https:/nvim-neorg/neorg/commit/adbb4151677bf22c809f9b6dfd35de5e07da6c7a))
* **core.ui.calendar:** highlight the current day differently ([eada386](https:/nvim-neorg/neorg/commit/eada386cc79c122b648580de50b1f825b74a9627))
* **core.ui.calendar:** implement more of the barebones UI ([364f44a](https:/nvim-neorg/neorg/commit/364f44a7d1179d5aa98d1f4ff6b4b6b1b6078bd3))
* **core.ui.calendar:** make the calendar display full month names ([c6cc059](https:/nvim-neorg/neorg/commit/c6cc059992c812712c9a2bb4075b2d9b31f84f5c))
* **core.ui:** let `create_split` take in a `height` variable ([7dbbe9d](https:/nvim-neorg/neorg/commit/7dbbe9d236596d8990827e717ea892cd98e79b23))
* correctly handle year boundaries ([58b55e1](https:/nvim-neorg/neorg/commit/58b55e16366ecd431bece7ba4d42d512b21b972e))
* implement `render_month` function ([343fb8d](https:/nvim-neorg/neorg/commit/343fb8d02422fe2f2a3c791f2bdba0be95c3c96b))
* place cursor over current day when creating calendar ([3ce268b](https:/nvim-neorg/neorg/commit/3ce268b703d321561b86e546c7633326b39fa494))
* **tempus:** add `to_lua_date` function ([ef62e53](https:/nvim-neorg/neorg/commit/ef62e5308c684468a822684382d14de8f8f63193))


### Bug Fixes

* **calendar:** allow the view to be written to on rerender ([8e247d4](https:/nvim-neorg/neorg/commit/8e247d414bcb0d1123b2b12c7ff29bdf36c50cbd))
* **calendar:** fix incorrect movement with `H` across boundaries of months with different lengths ([48face2](https:/nvim-neorg/neorg/commit/48face25855d7844302b13a125363c30b8a6fe9a))
* **calendar:** fix rest of highlight groups ([ead4c4c](https:/nvim-neorg/neorg/commit/ead4c4c53769839b5063fab71ebb92d155d53676))
* **calendar:** if another calendar is open then close it instead of erroring ([9751e7d](https:/nvim-neorg/neorg/commit/9751e7d62af0b7e49ff788058154b966be205e2e))
* **calendar:** make distance between each month uniform and support modifying the distance between each month ([746354d](https:/nvim-neorg/neorg/commit/746354dea70e9657f61531375329e407e7f5a203))
* **calendar:** make month rendering work again ([164028f](https:/nvim-neorg/neorg/commit/164028fd621e3c5b56603d88d6d5e2ba5db51d42))
* **calendar:** overlapping month names in the calendar view ([709cf78](https:/nvim-neorg/neorg/commit/709cf78410b6ea631192ad004d3f2b83761f9953))
* **calendar:** prevent the buffer from being modifiable after it has been filled ([351e103](https:/nvim-neorg/neorg/commit/351e10326e0e2bb6166e165ddb6598e917e6d25c))
* **calendar:** properly display "today's day" in the calendar view ([74ee71a](https:/nvim-neorg/neorg/commit/74ee71a446662f92afa3cbd49f6c980bdf25ae92))
* **calendar:** reversed namespace names ([77b214c](https:/nvim-neorg/neorg/commit/77b214cef220580cdcf527265a15ef980e7bcaf3))
* **core.ui.calendar:** logic error when parsing virt_text length for `set_logical_extmark` ([d5b29ee](https:/nvim-neorg/neorg/commit/d5b29eea8e09d7bd0add778c6818539719914301))
* **core.ui.calendar:** wrong extmark being queried in month render routine ([46624b9](https:/nvim-neorg/neorg/commit/46624b9a02e0d0e928026a0fd4852c4dd3ca7e0d))

## [4.0.1](https:/nvim-neorg/neorg/compare/v4.0.0...v4.0.1) (2023-05-11)


Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
documentation:
nvim --headless -u docgen/minimal_init.vim -c "cd ./docgen" -c "source init.lua" -c 'qa'
! ( nvim --headless -u docgen/minimal_init.vim -c "cd ./docgen" -c "source init.lua" -c 'qa' 2>&1 | grep -q "stack traceback:" )

local-documentation:
nvim --headless -c "cd ./docgen" -c "source init.lua" -c 'qa'
Expand Down
38 changes: 21 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,24 +204,26 @@ You can install it through your favorite plugin manager:

```lua
require("lazy").setup({
{
"nvim-neorg/neorg",
build = ":Neorg sync-parsers",
opts = {
load = {
["core.defaults"] = {}, -- Loads default behaviour
["core.concealer"] = {}, -- Adds pretty icons to your documents
["core.dirman"] = { -- Manages Neorg workspaces
config = {
workspaces = {
notes = "~/notes",
},
},
},
{
"nvim-neorg/neorg",
build = ":Neorg sync-parsers",
dependencies = { "nvim-lua/plenary.nvim" },
config = function()
require("neorg").setup {
load = {
["core.defaults"] = {}, -- Loads default behaviour
["core.concealer"] = {}, -- Adds pretty icons to your documents
["core.dirman"] = { -- Manages Neorg workspaces
config = {
workspaces = {
notes = "~/notes",
},
},
},
},
dependencies = { { "nvim-lua/plenary.nvim" } },
}
}
end,
},
})
```

Expand Down Expand Up @@ -253,11 +255,13 @@ will also be updated to the correct revision.

### Troubleshooting Treesitter
- Not using packer? Make sure that Neorg's `setup()` gets called after `nvim-treesitter`'s setup.
- If on MacOS, ensure that the `CC` environment variable points to a compiler that has C++14 support.
- If on MacOS, ensure that the `CC` environment variable points to a compiler that has C++11 support.
You can run Neovim like so: `CC=/path/to/newer/compiler nvim -c
"TSInstallSync norg"` in your shell of choice
to install the Neorg parser with a newer compiler. You may also want to export the `CC` variable in general:
`export CC=/path/to/newer/compiler`.
See more information here: [#74 comment](https:/nvim-neorg/neorg/issues/74#issuecomment-906627223)
See also [#888 comment](https:/nvim-neorg/neorg/discussions/888#discussioncomment-5953479) for configuring `nvim-treesitter` to use a specific compiler.

## 📦 Setup

Expand Down
4 changes: 2 additions & 2 deletions ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ It will be switched to a `.norg` file when possible.

## Workflow

- [ ] [The Calendar UI](#calendar)
- [x] [The Calendar UI](#calendar)
- [ ] The GTD Methodology
- [ ] Zettelkasten
- [ ] The `sc-im`esque Table Editor
Expand Down Expand Up @@ -116,7 +116,7 @@ embeddable-anywhere tools. These include:
- [x] Directory Manager and File Aggregator - workspaces are a pretty fundamental concept within
Neorg, and writing a tool that can efficiently manage and manipulate enormous collections
of notes will be critical for any Neorg-like tool.
- [ ] Multithreaded parsing library - note collections can get big, like really big. Parsing
- [x] Multithreaded parsing library - note collections can get big, like really big. Parsing
all of these on a single thread could take even minutes. Having a good multithreaded
parsing library will help a lot.
- [ ] Sqlite - having an sqlite database as a centralized data store will be super
Expand Down
35 changes: 33 additions & 2 deletions doc/breaking-changes.norg
Original file line number Diff line number Diff line change
@@ -1,15 +1,46 @@
@document.meta
title: Breaking Changes
authors: vhyrro
authors: [
vhyrro
]
created: 2023-04-29
version: 1.1.1
@end

* `v4.0.0`
*NOTE:* See {/ CHANGELOG.md} for a full list of general changes.


* v5.0.0

This release features many performance and stability improvements.

** Removed `gt*` keybinds, `core.norg` deprecation warnings and more.

You'll no longer be told about deprecated content introduced since `3.0.0`, Neorg will now not
recognize it!

** New Concealer!

`@champignoom` completely refactored the concealer to be much more efficient and stable. It also
includes breaking changes to the configuration, so see
{https:/nvim-neorg/neorg/wiki/Concealer}[this wiki section] for new configuration
options.

** New `@document.meta` Parser

A rewritten parser was introduced for more stable parsing of contents of `@document.meta` tags.
Make sure to run `:Neorg sync-parsers`! The rest should be automatic.

___

* v4.0.0

** Removed `core.news`!

Please use `:help neorg-breaking-changes` instead.

** *Moved all `gt*` keybinds to `<LocalLeader>t*`*

Change made to prevent clashes with the inbuilt `gt` command present in Neovim.

#comment
Expand Down
26 changes: 11 additions & 15 deletions docgen/docgen.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ require("neorg.external.helpers")
local ts = neorg.modules.get_module("core.integrations.treesitter")
assert(ts, "treesitter not available")

local ts_utils = ts.get_ts_utils()

--- Aggregates all the available modules.
---@return table #A list of paths to every module's `module.lua` file
docgen.aggregate_module_files = function()
Expand Down Expand Up @@ -319,7 +317,8 @@ docgen.generators = {
"# Using Neorg",
"",
"Neorg depends on a number of other technologies, all of which have to be correctly configured to keep Neorg running smoothly.",
"For some help on understanding how your terminal, Neovim, coloschemes, tree-sitter and more come together to produce your Neorg experience (or Neorg problems), see [this document on understanding Neorg dependencies](Dependencies)",
"For some help on understanding how your terminal, Neovim, coloschemes, tree-sitter and more come together to produce your Neorg experience (or Neorg problems), see [this document on understanding Neorg dependencies](Dependencies).",
"",
"At first configuring Neorg might be rather scary. I have to define what modules I want to use in the `require('neorg').setup()` function?",
"I don't even know what the default available values are!",
"Don't worry, an installation guide is present [here](https:/nvim-neorg/neorg#-installationquickstart), so go ahead and read it!",
Expand Down Expand Up @@ -574,10 +573,10 @@ end

--- Converts a ConfigOptionData struct to a html node in the resulting HTML document
---@param configuration_option ConfigOptionArray #The config option to render
---@param indent number? #How far to indent the text by. Should not be set manually.
---@param open boolean? #Whether to auto-open the generated `<details>` tag. Defaults to false.
---@return string[] #A list of markdown tables corresponding to the rendered element.
docgen.render = function(configuration_option, indent)
indent = indent or 0
docgen.render = function(configuration_option, open)
open = open or false

local self = configuration_option.self

Expand All @@ -593,7 +592,7 @@ docgen.render = function(configuration_option, indent)
end)()

local basis = {
"* <details" .. (indent == 0 and " open>" or ">"),
"* <details" .. (open and " open>" or ">"),
"",
((self.data.name or ""):match("^%s*$") and "<summary>" or table.concat({
"<summary><code>",
Expand Down Expand Up @@ -626,26 +625,23 @@ docgen.render = function(configuration_option, indent)
})
end

vim.list_extend(basis, docgen.htmlify(configuration_option, indent))
vim.list_extend(basis, docgen.htmlify(configuration_option))
vim.list_extend(basis, {
"",
"</details>",
})

for i, str in ipairs(basis) do
basis[i] = string.rep(" ", indent + (i > 1 and 2 or 0)) .. str
basis[i] = string.rep(" ", 2 - (i == 1 and 2 or 0)) .. str
end

return basis
end

--- Converts an object directly into HTML, with no extra fluff.
---@param configuration_option ConfigOptionArray
---@param indent number? #How far to indent the text by. Should not be set manually
---@return string[] #An array of markdown strings with the rendered HTML inside
docgen.htmlify = function(configuration_option, indent)
indent = indent or 0

docgen.htmlify = function(configuration_option)
local self = configuration_option.self

local result = {}
Expand All @@ -661,7 +657,7 @@ docgen.htmlify = function(configuration_option, indent)
local unrolled = neorg.lib.unroll(self.object)

table.sort(unrolled, function(x, y)
return x[1] < y[1]
return tostring(x[1]) < tostring(y[1])
end)

for _, data in ipairs(unrolled) do
Expand All @@ -671,7 +667,7 @@ docgen.htmlify = function(configuration_option, indent)
local subitem = configuration_option[name_or_index]

if subitem then
vim.list_extend(result, docgen.render(subitem, indent + 1))
vim.list_extend(result, docgen.render(subitem))
end
end

Expand Down
10 changes: 9 additions & 1 deletion docgen/init.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
local docgen = require("docgen")
local fileio = require("fileio")

--- CONFIGURABLE DOCGEN BEHAVIOUR
--- Tweak as you see fit.
local config = {
--- When true, will auto-unfold the top-level <details>
--- tags generated when rendering module configuration options.
auto_open_first_level_tags = true,
}

---@type Modules
local modules = {
--[[
Expand All @@ -25,7 +33,7 @@ local function concat_configuration_options(configuration_options)
end)

for _, values in pairs(unrolled) do
vim.list_extend(result, docgen.render(values[2]))
vim.list_extend(result, docgen.render(values[2], config.auto_open_first_level_tags))
table.insert(result, "")
end

Expand Down
Loading

0 comments on commit 51421be

Please sign in to comment.