tani / vim-glance

Preview document wrtting in YOUR markdown and asciidoc, POD.
39 stars 7 forks source link

Couldn't load a font configuration in `g:glance#stylesheet` #16

Closed peacock0803sz closed 2 weeks ago

peacock0803sz commented 3 weeks ago

Screenshot

https://github.com/user-attachments/assets/0b6236aa-bb6a-44d0-9fa6-44f8d9ab7bfa

Expected Behavior

Renders with sans-serif style fonts It works with other properties (margin and border), so is the wrong CSS selector for font-family ...?

Environment Versions

denops.vim: commit 3a38e08 vim-glance: commit e645073

$ nvim -V1 -v
NVIM v0.10.2
Build type: Release
LuaJIT 2.1.1713773202

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "
/nix/store/aqafkzaksbm4zk0343qi44xxlw6hvywn-neovim-unwrapped-0.10.2/share/nvim
"

Run :checkhealth for more info
$ deno --version
deno 2.0.2 (stable, release, aarch64-apple-darwin)
v8 12.9.202.13-rusty
typescript 5.6.2

Step to Reproduce

Create those tow files:

.vimrc:

set runtimepath+=/path/to/denops.vim
set runtimepath+=/path/to/vim-glance

let g:glance#server_open = v:false
let g:glance#stylesheet =<< END
html, body, #viewer {
  border: none;
  margin: 0.5rem;
  font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif !important;
}
END

example.md: (Escaped the Nested Code Block)

# Example Document

## This is a Heading 2

- list item1
- list item2
- list item3

### Code Sample

\```python
print("Hello World!!")
\```
peacock0803sz commented 2 weeks ago

UPDATE: Founded a typo g:glance#styleseet (correct: g:glance#stylesheet), but still not working the font configuration after fixing the typo...

tani commented 2 weeks ago

AH, there still is a typo. font-famiiy should be font-family.

peacock0803sz commented 2 weeks ago

@tani Oh, sorry! I fixed but not it isn't working well 😕

tani commented 2 weeks ago

I see. I will check it again.

peacock0803sz commented 2 weeks ago

humm... It looks the g:glance#stylesheet value was inside of the <iframe> tag 👀 image CleanShot 2024-11-07 at 12 51 06

tani commented 2 weeks ago
Screenshot 2024-11-07 at 12 50 07
tani commented 2 weeks ago

Your point is the expected behavior. It is not a problem.

tani commented 2 weeks ago

This issue is solved. You can use join() to concatenate all strings.

peacock0803sz commented 2 weeks ago

Thank you for chatting in vim-jp slack, It's my lack of understanding for Vim script...

With .vimrc like this, it works correctly ~~ Then I'll make a PR to share this tips :)

let s:stylesheet =<< trim END
html, body, #viewer, #root {
  border: none;
  margin: 0.5rem;
  font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif !important;
}
END
let g:glance#stylesheet = join(s:stylesheet, "\n")