Skip to content

Commit

Permalink
feat(renderer): Added hybrid-mode support to the plugin
Browse files Browse the repository at this point in the history
Hybrid mode finally is complete & stable. You can set it up using the
new `hybrid_modes` option.

Example:

    modes = { "n", "i", "c" },
    hybrid_modes = { "i" },

Preview failure no longer crashes the plugin.

Renderer now has the following set of features,
  - Partial rendering of files(doesn't render things within a specific
    range)
  - Partial clearing. Now the renderer can clear only parts of the
    buffer.
  - Methods for finding node ranges. This is used to prevent nodes being
    unconcealed halfway.

Parser now has the following set of features,
  - Partial parsing. Only parses a specific range in the buffer.

See: #58
------------------------------------------------------------------------
feat(colors): Distinct highlight groups.

Highlight groups now have distinct names. Added highlight groups,

  - MarkviewHeading<1-6>      For the different heading levels.
  - MarkviewHeading<1-6>Sign  For the signs used by the headings.

  - MarkviewHeadingCodeBlock  For code blocks.

  - MarkviewHeadingBlockQuoteDefault
    For the default `block quotes`.

  - MarkviewHeadingBlockQuoteOk
    For `success`-type block quotes.
  - MarkviewHeadingBlockQuoteWarn
    For `warning`-type block quotes.
  - MarkviewHeadingBlockQuoteError
    For `error`-type block quotes.
  - MarkviewHeadingBlockQuoteNote
    For `notes`-related block quotes.
  - MarkviewHeadingBlockQuoteSpecial
    For `special` block quotes. E.g. Important, Example.

  - MarkviewCheckboxChecked   For checked checkboxes.
  - MarkviewCheckboxUnhecked  For unchecked checkboxes.
  - MarkviewCheckboxPending   For pending checkboxes.

  - MarkviewTableBorder       For the borders in the table.
  - MarkviewTableAlignLeft    For left alignment indicator.
  - MarkviewTableAlignRight   For right alignment indicator.
  - MarkviewTableAlignCenter  For center alignment indicator.

  - MarkviewListItemPlus      For list items starting with +.
  - MarkviewListItemMinus     For list items starting with -.
  - MarkviewListItemStar      For list items starting with *.

  [Note: Ordered list items(starting with .) don't use highlights]

  - MarkviewHyperlink         For regular links.
  - MarkviewImageLink         For images.
  - MarkviewEmail             For email addresses.

  - MarkviewGradient<1-10>    For horizontal rules.

See: #61
------------------------------------------------------------------------
bug(renderer): Incorrect start column of code blocks

Fixes a bug where `block_continuation` caused code blocks without
`info_string` to render incorrectly.

Lua patterns are now used to extract language strings.

See: #64
  • Loading branch information
OXY2DEV committed Jul 31, 2024
1 parent d0a2a7a commit 4a93e15
Show file tree
Hide file tree
Showing 7 changed files with 1,494 additions and 332 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# vim:nospell:

on:
push:
branches:
- dev

permissions:
contents: write
pull-requests: write

name: release-please

jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: googleapis/release-please-action@v4
with:
# this assumes that you have created a personal access token
# (PAT) and configured it as a GitHub action secret named
# `MY_RELEASE_PLEASE_TOKEN` (this secret name is not important).
token: ${{ secrets.RELEASE_PLEASE_TOKEN }}
# this is a built-in strategy in release-please, see "Action Inputs"
# for more options
release-type: simple
8 changes: 4 additions & 4 deletions ftplugin/markdown.lua
Original file line number Diff line number Diff line change
Expand Up @@ -135,17 +135,16 @@ vim.api.nvim_create_autocmd({ "ModeChanged", "TextChanged" }, {
local partial_contents = markview.parser.parse_range(event.buf, markview.configuration, parse_start, parse_stop);
local current_range = markview.renderer.get_content_range(partial_contents);

-- vim.print(current_range)
-- Update the range first or it gets messed up later
markview.renderer.update_range(buffer, current_range);

if markview.configuration.hybrid_modes and vim.list_contains(markview.configuration.hybrid_modes, mode) then
markview.renderer.render(buffer, parsed_content, markview.configuration, parse_start, parse_stop);
markview.renderer.clear_content_range(event.buf, partial_contents)
else
markview.renderer.render(buffer, parsed_content, markview.configuration);
end

-- Or else things won't render on first redraw from the other autocmd
markview.renderer.update_range(buffer, current_range);

for _, window in ipairs(windows) do
markview.keymaps.init(buffer, window, parsed_content, markview.configuration);
end
Expand Down Expand Up @@ -206,6 +205,7 @@ vim.api.nvim_create_autocmd(events, {

local current_range = markview.renderer.get_content_range(partial_contents);

vim.print(_G.__markview_render_ranges[event.buf])
-- Don't draw new things
if _G.__markview_render_ranges[event.buf] and vim.deep_equal(_G.__markview_render_ranges[event.buf], current_range) then
markview.renderer.clear_content_range(event.buf, partial_contents)
Expand Down
Loading

0 comments on commit 4a93e15

Please sign in to comment.