|
| 1 | +# Troubleshooting |
| 2 | + |
| 3 | +The following guide goes from easy to complex operations that can help when this |
| 4 | +plugin is not functioning how you expect. As such it is recommended to go in order. |
| 5 | + |
| 6 | +## Run healthcheck |
| 7 | + |
| 8 | +```vim |
| 9 | +:checkhealth render-markdown |
| 10 | +``` |
| 11 | + |
| 12 | +If there are any `errors` these should be looked at closely, `warnings` can largely |
| 13 | +be ignored. They are generated to help debug issues for less critical components, |
| 14 | +i.e. `LaTeX` support. |
| 15 | + |
| 16 | +## Validate `filetype` |
| 17 | + |
| 18 | +This plugin only operates on `markdown` files by default, but can be expanded to |
| 19 | +run on any filetype with `markdown` injected by providing it in the config: |
| 20 | + |
| 21 | +```lua |
| 22 | +require('render-markdown').setup({ |
| 23 | + file_types = { 'markdown', <other_filetype> }, |
| 24 | +}) |
| 25 | +``` |
| 26 | + |
| 27 | +Once you confirm the list of `filetypes` you expect this plugin to work on get |
| 28 | +the `filetype` of the current buffer and make sure it is in that list: |
| 29 | + |
| 30 | +```vim |
| 31 | +:lua vim.print(vim.bo.filetype) |
| 32 | +``` |
| 33 | + |
| 34 | +## Provide debug logs |
| 35 | + |
| 36 | +If all else fails hopefully the logs can provide some insight. This plugin |
| 37 | +ships with logging, however it only includes errors by default. |
| 38 | + |
| 39 | +To help debug your issue you'll need to go through the following steps: |
| 40 | + |
| 41 | +1. Update the log level to `debug` |
| 42 | +2. Create a test file |
| 43 | +3. Generate logs from the test file |
| 44 | +4. Provide the logs in the issue |
| 45 | + |
| 46 | +### Update the log level to `debug` |
| 47 | + |
| 48 | +Change the plugin configuration to: |
| 49 | + |
| 50 | +```lua |
| 51 | +require('render-markdown').setup({ |
| 52 | + log_level = 'debug', |
| 53 | +}) |
| 54 | +``` |
| 55 | + |
| 56 | +### Create a test file |
| 57 | + |
| 58 | +Create a new `markdown` file locally with the following content: |
| 59 | + |
| 60 | +```text |
| 61 | +# Heading |
| 62 | +
|
| 63 | +- Item |
| 64 | + - Nested |
| 65 | +
|
| 66 | +> [!NOTE] |
| 67 | +> A note |
| 68 | +
|
| 69 | +- [ ] Unchecked |
| 70 | +- [x] Checked |
| 71 | +``` |
| 72 | + |
| 73 | +### Generate logs from the test file |
| 74 | + |
| 75 | +To do this restart Neovim and open the `markdown` file from the previous step. |
| 76 | + |
| 77 | +This should trigger the render function by default, then close Neovim. |
| 78 | + |
| 79 | +### Provide the logs in the issue |
| 80 | + |
| 81 | +Logs are written to a file typically located at: `~/.local/state/nvim/render-markdown.log`. |
| 82 | + |
| 83 | +Copy the contents of that file and paste it into the issue. |
0 commit comments