sotte / presenting.vim

A simple tool for presenting slides in vim based on text files.
MIT License
300 stars 50 forks source link

Conceal in md only conceals the first md element (md) #34

Open 21it opened 3 years ago

21it commented 3 years ago

This markdown

# Tables

| Last Name      | First Name | Born | Bacon Number |
|----------------|------------|------|--------------|
| Bacon          | Kevin      | 1958 | 0            |
| Chan           | Jackie     | 1954 | 2            |
| Reagan         | Ronald     | 1911 | 2            |
| Ryan           | Meg        | 1961 | 1            |
| Saldaña        | Zoë        | 1978 | 2            |
| Schwarzenegger | Arnold     | 1947 | 2            |
| Temple         | Shirley    | 1928 | 3            |

Renders as

                                                                          _____     _     _           
                                                                         |_   _|_ _| |__ | | ___  ___ 
                                                                           | |/ _` | '_ \| |/ _ \/ __|
                                                                           | | (_| | |_) | |  __/\__ \
                                                                           |_|\__,_|_.__/|_|\___||___/

«tr»                                                            ┏━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━┳━━━━━━━━━━━━━━┓
«th»                                                            ┃ Last Name      ┃ First Name ┃ Born ┃ Bacon Number ┃
«tr»                                                            ┣━━━━━━━━━━━━━━━━╋━━━━━━━━━━━━╋━━━━━━╋━━━━━━━━━━━━━━┫
«tr»                                                            ┃ Bacon          ┃ Kevin      ┃ 1958 ┃ 0            ┃
«tr»                                                            ┃ Chan           ┃ Jackie     ┃ 1954 ┃ 2            ┃
«tr»                                                            ┃ Reagan         ┃ Ronald     ┃ 1911 ┃ 2            ┃
«tr»                                                            ┃ Ryan           ┃ Meg        ┃ 1961 ┃ 1            ┃
«tr»                                                            ┃ Saldaña        ┃ Zoë        ┃ 1978 ┃ 2            ┃
«tr»                                                            ┃ Schwarzenegger ┃ Arnold     ┃ 1947 ┃ 2            ┃
«tr»                                                            ┃ Temple         ┃ Shirley    ┃ 1928 ┃ 3            ┃
«tr»                                                            ┗━━━━━━━━━━━━━━━━┻━━━━━━━━━━━━┻━━━━━━┻━━━━━━━━━━━━━━┛
ckangnz commented 3 years ago

I also see this issue :( image

rohitvvv commented 3 years ago

How to get rid of the tags that render on the left?

sotte commented 3 years ago

26 introduced the much nicer rendering of presentations (thanks again!), but it's not as robust as it should have been (my bad, I should have checked more).

I'll have some time this weekend and will check it out.

f1se4 commented 3 years ago

Hi,

I have cloned this respository to be able to be used in ‘ivim’ ios version of vim. By the way I have solved (or it works for me) tags issues with tables and headers.

Here you have the repository: https://github.com/f1se4/presenting_ivim.vim.git

And, really really love this. In an ipad-air where I’m using this it’s perfect way to have ‘geek’ presentation done in the best editor in less than any other tool I could imagine. Thank you,

ckangnz commented 3 years ago

hey @sotte , has this been resolved? I just tried out the latest version but it still has the same issue :(

sotte commented 3 years ago

@chris542 well, life happened :)

I did some investigation. The conceal feature does not work as intended.

The first conceal on a page/slide always works. It can be any heading or table! E.g. if you have a md file like this the rendering/concealing works.

| Last Name      | First Name | Born | Bacon Number |
|----------------|------------|------|--------------|
| Bacon          | Kevin      | 1958 | 0            |
| Chan           | Jackie     | 1954 | 2            |

Did some research on conceal, but did not see anything obvious wrong. I'll have to investigate further.

(I also found some inconsistencies how figlet and not figlet headings are handled. I'll address this separately.)

sotte commented 3 years ago

I checked out the version that is used in the animated gif d69d02b38832517836d0e8076883fdb4b63e9844 Even with this version the conceal does not work properly (i.e only the first conceal works).

❯ git co d69d02b38832517836d0e8076883fdb4b63e9844
❯ vim examples/PresentingDemo.markdown +PresentingStart

image

sotte commented 3 years ago

I checked out many versions and at least for my current setup (nvim v0.5) this feature never worked. I'm sure it did at some point though.

@PhilRunninger you implemented this feature. Can you check if conceal still works on your end? That would be great!

❯ nvim --version
NVIM v0.5.0-dev+1369-g64bdaef32
Build type: Release
LuaJIT 2.1.0-beta3
f1se4 commented 3 years ago

I don't know if it helps, but for me has worked by commenting line 26 from /autoload/markdown.vim

let l:text = s:Center(l:text, '<< tr >>')

and changing to

let l:text = s:Center(l:text, '')

thks

sotte commented 3 years ago

Thanks @f1se4. I assume you're using the non-figlet version?

@PhilRunninger introduced the markers (tr, h1, etc.) to, well, mark a given line and assign/link a normal syntax element to the newly marked one. Removing the <<tr>> does the trick (nothing to conceal when it does not exists), but it's only a workaround. I'll keep looking for a proper solution.

Thanks again!

f1se4 commented 3 years ago

yaps, well the python-figlet version hahahahhaa 😄

PhilRunninger commented 3 years ago

@sotte

I can confirm it is working as advertised on Windows 10 with these versions of nvim and nvim-qt

NVIM v0.5.0-828-g0a95549d6
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3

and

NVIM v0.5.0-dev+1372-g056c464e8
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3

On my Macbook with nvim version

NVIM v0.4.4
Build type: Release
LuaJIT 2.0.5

the tables are working correctly, but this issue may be showing up in the code block where the ```vim code fence is not being concealed. Never mind; this is caused by the older syntax/markdown.vim file that ships with the v0.4.4 version. This was fixed in this commit: https://github.com/tpope/vim-markdown/commit/c043a93c847dbaba96aac643df818baafa04a3e5.

In summary, I'd say it's working as intended, and as it always has for me. There could be some obscure setting that I have in my config that makes it all work, so feel free to look around in it.

I'll be AFK for a while, but I'll check in when I can.

sotte commented 3 years ago

@PhilRunninger thanks, that is super helpful!

I'm using https://github.com/plasticboy/vim-markdown, not tpope/markdown-vim (but I did in the past). I just tested with tpope's version and it looks much better:

Raw md:

# presenting.vim
### maintainer: Stefan Otte

#### a presentation tool for vim

<!--
  Comments are removed. They must be
  in the form of an HTML comment tag.
-->

\```python
def foo(a: str) -> None:
    return a.upper()
\```

| Last Name      | First Name | Born | Bacon Number |
|----------------|------------|------|--------------|
| Bacon          | Kevin      | 1958 | 0            |

- [ ] Not done yet
  - [ ] Task 1
- [x] Done
  - [x] Task 1

Rendered in vim with tpope/markdown-vim: image

Rendered with presenting: image

I get syntax hl in the raw md, but not in presenting.vim (I had to enable fenced code blocks let g:markdown_fenced_languages = ["python"]).

If this behavior is due to incompatibility between these two md plugins I'm not quite sure how to guarantee that presenting.vim works with both (without too much effort at least).

sotte commented 3 years ago

Another try with no specific md plugin installed...and it woks :) fooo... image

sotte commented 3 years ago

@chris542 @rohitvvv @tkachuk-labs

PhilRunninger commented 3 years ago

tpope's markdown plugin is what ships with vim/neovim. And I have let g:markdown_fenced_languages = ["vim"].

rohitvvv commented 3 years ago

NVIM v0.5.0-dev+1087-g5ad32885d Build type: Release LuaJIT 2.1.0-beta3 I deleted my plugged directory and removed the vim-markdown from tpope. I am using the following figlet fadein/vim-FIGlet

It has started to work as expected.

ckangnz commented 3 years ago

@chris542 @rohitvvv @tkachuk-labs

  • What is your vim version?

  • What markdown plugin are you using (if any)?

  • What are your settings for the markdown plugin?

I'm using the latest vim8

These are the only configs i have for markdown

"sotte/presenting.vim let g:presenting_figlets = 1

"gabrielelana/vim-markdown let g:markdown_enable_mappings = 1 let g:markdown_enable_spell_checking = 0 let g:markdown_enable_conceal = 1 let g:markdown_enable_folding = 1 let g:vim_markdown_conceal_code_blocks = 0 let g:vim_markdown_fenced_languages = ['csharp=cs', 'js=javascript', 'sh=bash']

igbanam commented 10 months ago

https://github.com/sotte/presenting.vim/assets/390059/bbe0b3f4-6ca4-4a55-a81e-6a5d5a2a5583

:version
VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Sep 28 2023 20:46:37)
macOS version - arm64
Included patches: 1-1950
Compiled by Homebrew