Sublime Forum

MdPopups 2.0 Notification

#21

Can you provide me with the full command that is failing? I have numerous plugins that are still working that pass some kind of CSS to mdpopups, so it isn’t something that is fundamentally broken, but something specific, so I’ll need a specific example. Also provide Color Scheme as that may play into this.

0 Likes

#22

If you set "mdpopups.debug": 1, in your Preferences.sublime-settings file, do you get more error info?

0 Likes

#23

Never mind, it looks like you are using this package: https://github.com/unknownuser88/PackagesUI. It doesn’t even use mdpopups from what I can tell.

So definitely raise the debug level, post the extra error info here, and point me at the color scheme you are using.

0 Likes

#24

It’s PackagesUI but my version with phantoms. Other plugins where I use popups are the same, though. Changing the scheme to Mariana doesn’t change anything(getting default popup background, not injected css).

Setting debug to 3, I get this:

[Packages UI] render
mdpopups: Failed to convert/retrieve scheme to CSS!
mdpopups: Traceback (most recent call last):
  File "C:\Users\xxxxx\AppData\Roaming\SUBLIM~1\Packages\mdpopups\st3\mdpopups\__init__.py", line 187, in _get_scheme
    obj = SchemeTemplate(scheme)
  File "C:\Users\xxxxx\AppData\Roaming\SUBLIM~1\Packages\mdpopups\st3\mdpopups\st_scheme_template.py", line 72, in __init__
    self.setup()
  File "C:\Users\xxxxx\AppData\Roaming\SUBLIM~1\Packages\mdpopups\st3\mdpopups\st_scheme_template.py", line 209, in setup
    self.legacy_parse_global()
  File "C:\Users\xxxxx\AppData\Roaming\SUBLIM~1\Packages\mdpopups\st3\mdpopups\st_scheme_template.py", line 108, in legacy_parse_global
    for item in self.csm.plist_file["settings"]:
AttributeError: 'ColorSchemeMatcher' object has no attribute 'plist_file'

mdpopups: =====CSS=====
mdpopups: 
mdpopups: =====HTML OUTPUT=====
mdpopups: 
<h1>
 Packages UI
</h1>
1
mdpopups: Failed to convert/retrieve scheme to CSS!
mdpopups: Traceback (most recent call last):
  File "C:\Users\xxxxx\AppData\Roaming\SUBLIM~1\Packages\mdpopups\st3\mdpopups\__init__.py", line 187, in _get_scheme
    obj = SchemeTemplate(scheme)
  File "C:\Users\xxxxx\AppData\Roaming\SUBLIM~1\Packages\mdpopups\st3\mdpopups\st_scheme_template.py", line 72, in __init__
    self.setup()
  File "C:\Users\xxxxx\AppData\Roaming\SUBLIM~1\Packages\mdpopups\st3\mdpopups\st_scheme_template.py", line 209, in setup
    self.legacy_parse_global()
  File "C:\Users\xxxxx\AppData\Roaming\SUBLIM~1\Packages\mdpopups\st3\mdpopups\st_scheme_template.py", line 108, in legacy_parse_global
    for item in self.csm.plist_file["settings"]:
AttributeError: 'ColorSchemeMatcher' object has no attribute 'plist_file'

mdpopups: =====CSS=====
mdpopups: 
mdpopups: =====HTML OUTPUT=====
mdpopups: 
<h2>
 Installed with Package Control
</h2>
0 Likes

#25

Thanks! I know what the issue is and I’ll get a new release out this evening.

0 Likes

#26

Edit: ok thanks, waiting for the new version.

In that case I’m using this function and css to call the phantom.

CSS = """
div.mdpopups h1 {{
    font-size: 35px;
    font-weight: bold;
    font-style: italic;
    padding: {0}rem {1}rem {2}rem {3}rem;
    margin-bottom: 0.1rem;
    color:{4};
}}
div.mdpopups h2 {{
    font-size: 15px;
    font-weight: bold;
    padding: {0}rem {1}rem {2}rem {3}rem;
    margin-bottom: 0.1rem;
    color:{5};
}}
div.mdpopups h3 {{
    font-size: 15px;
    font-weight: bold;
    padding: {0}rem {1}rem {2}rem {3}rem;
    margin-bottom: 0.1rem;
    color:{6};
}}"""

def inline_header_phantom(v, h, where, content, key="UiHandler", css=CSS,
                          padT=0.5, padR=0.5, padB=0.5, padL=0.5,
                          c1="#A24141", c2="#ffffc6", c3="#c6c6ae"
                          ):

    ACTIVE_PHANTOMS.append((v, key))

    content = "#" * h + content
    where = sublime.Region(where, where)
    if css == CSS:
        css = CSS.format(padT, padR, padB, padL, c1, c2, c3)

    mdpopups.add_phantom(
        v, key, where, content, layout=sublime.LAYOUT_INLINE, css=css)

In other cases I’m not using .format() and I can’t get the css injected either.

0 Likes

#27

A lot of the underlying libraries got changed, and so some things got missed in my testing. I assume you are on Sublime < 3150. I should have run this through a portable Python of the most recent official release before pushing the new version. Oh well.

0 Likes

#28

Edit: yes I’m on 3143

Also I have to say that with 3.0.0 ColorHelper didn’t show the color squares anymore while editing color schemes, rolling back mdpopups to two commits before fixed this too, so it also depended on the new version.

Debug says in this case:

mdpopups: Failed to convert/retrieve scheme to CSS!
mdpopups: Traceback (most recent call last):
  File "C:\Users\xxxxx\AppData\Roaming\SUBLIM~1\Packages\mdpopups\st3\mdpopups\__init__.py", line 187, in _get_scheme
    obj = SchemeTemplate(scheme)
  File "C:\Users\xxxxx\AppData\Roaming\SUBLIM~1\Packages\mdpopups\st3\mdpopups\st_scheme_template.py", line 72, in __init__
    self.setup()
  File "C:\Users\xxxxx\AppData\Roaming\SUBLIM~1\Packages\mdpopups\st3\mdpopups\st_scheme_template.py", line 209, in setup
    self.legacy_parse_global()
  File "C:\Users\xxxxx\AppData\Roaming\SUBLIM~1\Packages\mdpopups\st3\mdpopups\st_scheme_template.py", line 108, in legacy_parse_global
    for item in self.csm.plist_file["settings"]:
AttributeError: 'ColorSchemeMatcher' object has no attribute 'plist_file'

ColorHelper: 
Traceback (most recent call last):
  File "color_helper in C:\Users\xxxxx\AppData\Roaming\Sublime Text 3\Installed Packages\ColorHelper.sublime-package", line 1334, in payload
  File "color_helper in C:\Users\xxxxx\AppData\Roaming\Sublime Text 3\Installed Packages\ColorHelper.sublime-package", line 1200, in do_search
  File "C:\Users\xxxxx\AppData\Roaming\SUBLIM~1\Packages\mdpopups\st3\mdpopups\__init__.py", line 546, in scope2style
    style_obj = obj.guess_style(view, scope, selected, explicit_background)
AttributeError: 'NoneType' object has no attribute 'guess_style'
0 Likes

#29

Yeah, I broke the stable channel basically. I was so focused on the color schemes on the dev branch, that I forgot to validate the current “legacy” methodology.

0 Likes

#30

Ok thanks for now I rolled back to previous version, that was fine on 3143, I’ll check with the new version when it comes out.

0 Likes

#31

Cool, it will be in a couple hours probably. I’ll make sure to test it on the stable release before pushing.

0 Likes

#32

Issue tracker:

0 Likes

#33

Should be fixed now: https://github.com/facelessuser/sublime-markdown-popups/releases/tag/3.0.1

0 Likes

#34

Thanks, all fixed.

0 Likes

#35

3.0.2

Oct 21, 2017

  • FIX: Improved color scheme parsing logic.
  • FIX: Fix code background not being correct.
1 Like

#36

3.2.0

Nov 21, 2017

  • NEW: pymdownx and pyyaml are now required for use of mdpopups (#51).
  • NEW: Add support for .hidden-color-scheme (#50).

It was mentioned back in June that packages that depend on mdpopups need to update dependencies accordingly, so if you haven’t already done so, you make get issues filed on your repo about pyyaml or pymdownx not being found.

Thinking about it now, probably should have called this 4.0.0 due to the breaking change, but too late now.

1 Like

#37

This looks pretty cool, but I can’t figure out how do I install mdpopups? It isn’t listed in package control list for some reason.

0 Likes

#38

It is not listed because it is not a package, it is a package dependency:

  1. https://packagecontrol.io/docs/dependencies

You need to create a Sublime Text package, which requires this as a dependency, then you can you these features on your Sublime Text package.

1 Like