-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🚀 Material for MkDocs 8 – Beta #3219
Comments
Would you be willing to consider implementing native support for other (open-source) discussion systems such as giscus? |
Ugh, https://github.com/facelessuser/mkdocs-material-extensions breaks with beta versioning 😢. I guess I need to fix that as it makes it hard to test the beta.
|
Never mind, I was on an old local version 🤦🏻 |
Testing seems to indicate everything is working as intended (at least for me). Interested in finally playing code annotations now they are coming to the public distribution (never got around to playing with them in insiders 🙃). |
I'm not sure. I'm thinking of leaving the discussion system implementation as an exercise to the author. I mean, it's absolutely trivial now that there is Update: the partial is now called |
Update: I've made some good progress today, but code annotations still suffer from the issues reported in #2475 on mobile. However, since after fixing #3145 we can now place code annotations anywhere in the comment and they're not eaten up, I had some other problems to solve, namely that code annotations are always exactly as wide as the references from which they're generated. I have a working copy, which still needs some polishing, but I'm quite happy with the result. The following screenshot shows that the text after the code annotation lines up perfectly with a non-code-annotation line: This is a minor, but pretty important detail, because it means that the code is formatted exactly as before. |
So, I want to try this out with my docs, because the annotation thing sure could be helpful with the API docs I have. |
It sounds like only Tabbed should be updated to use new alternate format. That is what I saw from my brief testing. |
Correct, Tabbed needs to be set to: markdown_extensions:
- pymdownx.tabbed:
alternate_style: true Other than that, if you have customization, some of those might break. I need to find the time to write an upgrade guide, but it's actually not that much for most users, because mostly new partials have been introduced. Some config settings were removed, though (see OP). Please feel free to document any roadblocks you're running into in this thread! |
So first, there doesn't seem to be a JSON5 lexer. Second, JSON doesn't support comments. For now, you can use the In the future, there will be an alternate syntax to add code annotations to any line, regardless of language. The limitation will be that they can only be added at the end, which should however work for most use cases.
Pygments is automatically installed and enabled when you use |
Missunderstood the sentence... Kinda sad |
|
Not sure if this deserves its own issue, since I don't remember it happening before the beta for version 8 started, but the mermaid.js diagram examples are showing up as normal code blocks on the documentation page for me. On a different note, and this is just a personal opinion, I think it might be more intuitive if code annotation bubbles acted as a toggle, where you could click to open and click to close, rather than having to click elsewhere on the page (although I think that should remain). |
Mermaid integration is still exclusively in Insiders 😉 It will be released here when the next funding goal is hit.
I'd be interested to hear other user's opinions on this. Personally I find it pretty intuitive, but I'm willing to discuss. |
Yes, and I am looking forward to that so I can use it! But when I visit your live documentation, for each diagram type, it has an Example block and a Result block. Isn't the Result supposed to show the actual diagram that would be rendered? |
Ah, interesting! Yes, that's definitely an error, but it's not related to version 8. I'll look into that. |
Sadly doesn't work... |
@corykinney fixed, that was just stale configuration! |
@Andre601 no, it should work despite the custom title. Could you provide the Markdown please? Also, did you enable the |
Here's a gist of the file: https://gist.github.com/Andre601/df9bbd4cf35247cee7cd051aff6414c9 |
The indentation is incorrect – the list is outside of the tab, you must indent the list so that it matches the code block indent. Your list is currently not coming next, after the code block, but after the tab. This:
Must be:
|
....that's a typical andre moment... 🤦 |
One other question. Will later sections require a continued nummeration or could I repeat 1, 2, etc.? Like would it need to be:
or would this work?
I'm not sure since the docs only use one text example which doesn't make it clear... |
The numbers are per-code block. The reason for this is that Markdown lists will always restart, so even though you may number your Markdown list 4., 5., 6., ... it will be converted to |
Just an idea, but would it be possible to make it so that when you press the "Copy to clipboard" button for a code block that used annotations that the The new annotations look great, but it seems like a downside is they clutter copied commands (e.g. when using with Consider a command \
--argument1 \ # (1)
--argument2 \ When the user copies this, the second |
@johnthagen the problem is that it's not really decidable what of a comment should be copied and what not, e.g.: const foo // this is a (1) comment I think it's better to replace annotations with their textual counter part, e.g. |
That sounds great to me. |
Tracking issue on upstream: squidfunk/mkdocs-material#3219 Signed-off-by: Andrei Jiroh Eugenio Halili <ajhalili2006@gmail.com>
Many thanks to all contributors for your great efforts! Everything turns out great. Just want to share my strugglling during the past hour: I'm not sure whether I will be the only silly, poor guy to do so. 🤣 I recoganized the important |
@Wen-Tao-Zhang hmm, the documentation states that it must be enabled in
Any idea how we could further improve this? |
I was not suggesting that. The documentation is good and I did find the statement at last. I just somehow got stuck because I skimmed through the documentation over and over carelessly. My post was just a reminder for someone like me (if there's any) 🤣. Thank you for your quick reply! |
Late response, but just wanted to clarify that I wasn't suggesting removing clicking outside of the annotation to close it, but that clicking the bubble should also close the annotation. |
Also interested in this. It would be consistent with other features that "augment" the block without having to touch the content, like syntax coloring and line highlight. And it would also open the door in having annotation working with snippets and, overall, blocks that do not easily supports comments. Since the list following the block already get a special treatment, I rather specify the line and column where I want the annotation to appear there, instead of inline in the block. |
Great work 💯 FYI, we are also extremely interested in code annotations not interfering with copying. |
FWIW, I recently came across a page (and its source) with code blocks like this, who seems to use AsciiDoc. Not sure how/whether they handle the issue mentioned here by the author. |
@ofek Thanks for the feedback! Code annotations do not interfere with copying – they are not marked with |
I'm very grateful for the feedback! Just to be clear what the rationale behind the current implementation is:
This is in fact exactly what code annotations do – they just replace markers in comments – nothing more. This means that a valid code snippet will remain valid, but invalid code snippets are not corrected to be valid. Let's take the example that was posted earlier again: command \
--argument1 \ # (1)
--argument2 \ This example is invalid, because comments are not allowed in this position. This means that it's (currently) not possible to add a code annotation on this line, same as it's not possible to add a comment in the underlying language. So yes, we could add an alternate syntax that says "strip the entire comment and inline the annotation", but this means that the code example would render as invalid code in the following cases:
Nonetheless, I'm considering adding the stripping mode, but I have to work out the details for that. I want to revisit this topic together with placing annotations in languages that don't support comments because both problems are closely related. This is, however, something that can't be part of the 8.x release, because it's a whole other rabbit hole to go down. For this reason, please understand that code annotations are currently only valid in comments, which is stated in the documentation. |
8.0.0b2 is out! This was really tough. Release notes:
Again, feedback appreciated. The current iteration plan is to fix some outstanding issues and do some refactoring in the coming weeks, and then push out a final RC. I'm sorry that the way to a stable release is a little longer this time, but it will be worth it. Smaller footprint, some long overdue refactorings, and awesome new features. |
Excited about this one! Would mkdocs-material/src/partials/source-date.html Lines 23 to 24 in 409d151
I'd need to fix a plugin as well (timvink/mkdocs-git-revision-date-localized-plugin#53) |
Yep, I've already removed the partial and everything that was linked to it. |
@squidfunk You might want to mention the new copyright partial on |
I've finished work on the v8 branch and just merged it into |
8.0.0 was just released. Please report any issues encountered as usual (and not here). |
Nice work. One thing tho: Looking at the Adding a comment system page, do I feel like it kinda favours Disqus a bit too much and goes more into "How to setup Disqus" rather than "How to setup any Javascript-based comment system". I feel like the page should be made a bit more generic and at most mention stuff you have to add alongside the basics to support Disqus. Like from my basic JS knowledge and stuff do solutions like Giscus not need that first time setup to function. I can offer to try and redo the page a bit, but currently thinking what the best wording would be to do this... |
I already said in another comment that I'm happy to switch to another comment system provider or provide docs for multiple providers. Happy to collaborate on a PR, as from my viewpoint this is not a priority. Any help is appreciated. Note that the generic part boils down to "extend the template and add what the provider gave you". |
Oh, an @corykinney – thanks for the idea for closing open annotations on a subsequent click on the index. This is also included in the latest release. It's really a great idea. |
@squidfunk of course! Thanks for implementing it and offering so many awesome features in the free version! |
As wished in #3219 (comment), the latest commit on the Insiders repository adds the ability to add an Markdown ``` sh
pip install \
mkdocs-material \
mkdocs-awesome-pages-plugin \ # (1)!
...
```
1. Complete replacement Result I'll wrap this up, add documentation and tie it to a funding goal when it will be released. |
The changes were released as part of 8.1.0+insiders-4.4.0, which also adds the ability to directly link to code annotations. See a demo here: https://twitter.com/squidfunk/status/1469245481255673857 |
With the help of my awesome sponsors, I'm happy to announce that the 'Ghost Pepper' funding goal has been reached, which means that code annotations, anchor tracking and versioning warnings are finding their way into this repository!
Since those are some pretty nifty features, it's a good time to wrap them up into a new major release and drop some long-standing deprecated features. This issue will track the progress on the road from the beta to the final release of version 8.
If you experience any problems, for now, please report them as a comment in this issue.
Installation
Note that this is a beta release.
Changes
Added
Code annotations: this is probably the most anticipated new feature. After finishing the merge and deprecations, I'll revisit the placement issues on mobile. Those need to get fixed before we push out the major release.
Version warning and Anchor tracking
Improved
Content partials: there's now a new partial, which allows fpr customizing the appearance of the Markdown content without overriding
base.html
. This makes it easy to add a further button to the top of a page or to add arbitrary content to the footer of a page:Copyright partial: the copyright has been moved into a separate partial, which lifts the need to override the
footer.html
template when changing the copyright information.Details: the open/closed state of
details
elements is now preserved when exiting print mode. Prior, details elements were always opened and left open when exiting print mode. Now, they will always return to their prior state.Fonts: The CSS variables for fonts which are set via
mkdocs.yml
have been renamed, and are amended with fallback fonts by the theme, so they can be set on arbitrary elements. Before, the fallback fonts had to be copied in order to override fonts on a nested element.Removed
Tabbed (legacy): from version 8, only thealternate_style
of the Tabbed extension is supported, and thus mandatory. The alternate implementation is superior in many ways, and there's no reason for us to keep the legacy implementation, as it just blows up the size of the CSS.Disqus: sadly, Disqus free version has become so horrible with advertisements before and after the comment section, which is why I don't want to endorse its usage anymore. Disqus was added at a point in time where its free version was pretty good. This is not the case anymore. However, there's a newpage-footer.html
partial that makes it pretty easy to add it back through customization. The new comment system guide still uses Disqus as an example for a custom integration until we found a new, better provider. Suggestions welcome.: the web app manifest configuration setting was removed because it is essentially just a singleextra.manifest
meta
tag that links to a file that must be provided by the author. Use theme extension and add it toextrahead
.: theextracopyright
extracopyright
variable allows to set a variable via customization that was added after the copyright information. Since the copyright information is now encapsulated in a separate partial, overriding the partial is more flexible. We don't want to provide redundant ways of achieving the same thing.: theseealso
seealso
qualifier was originally adapted from thereadthedocs
theme, in order to make it easier for authors to migrate to Material for MkDocs. However, when the title is omitted, the admonition extension will render it asSeealso
, which is incorrect English.: this was added in a PR and I failed to check if this was actually supported by MkDocs. It isn't. In fact, MkDocs will print a warning that this is an unsupported setting. For this reason, we'll remove it because it only leads to confusion.site_keywords
: previously deprecated, support was now removed. See linked issue (bottom).prebuild_index
TODO
p
elements before code annotation listThe text was updated successfully, but these errors were encountered: