Skip to content
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

[v2] unable to use theme-classic without remark-admonitions #2525

Closed
phated opened this issue Apr 4, 2020 · 8 comments · Fixed by #2642
Closed

[v2] unable to use theme-classic without remark-admonitions #2525

phated opened this issue Apr 4, 2020 · 8 comments · Fixed by #2642
Labels
bug An error in the Docusaurus core causing instability or issues with its execution help wanted Asking for outside help and/or contributions to this particular issue or PR.

Comments

@phated
Copy link
Contributor

phated commented Apr 4, 2020

🐛 Bug Report

Due to https://github.com/facebook/docusaurus/blob/master/packages/docusaurus-theme-classic/src/index.js#L56, you are unable to to use the @docusaurus/theme-classic theme without installing the remark-admonitions module. This shouldn't be a hard requirement.

Have you read the Contributing Guidelines on issues?

Yep

To Reproduce

  1. Create a V2 project with the following config
'use strict';

module.exports = {
  title: 'gulp.js',
  favicon: 'img/favicon.png',
  url: 'https://gulpjs.com/',
  baseUrl: '/',
  tagline: 'The streaming build system',
  // Used by the deployment
  organizationName: 'gulpjs',
  projectName: 'gulpjs.github.io',
  // The theme
  themeConfig: {},
  themes: ['@docusaurus/theme-classic'],
  plugins: [
    ['@docusaurus/plugin-content-docs', {
      path: '../converted-docs'
    }]
  ]
};
  1. Try to run the project
  2. See this error message

Screen Shot 2020-04-03 at 6 50 27 PM

Expected behavior

The theme should be usable without external dependencies unless I opt-in.

Actual Behavior

Doesn't compile and is unusable without installing the remark-admonitions module.

Your Environment

  • Docusaurus version used: ^2.0.0-alpha.50
  • Environment name and version (e.g. Chrome 78.0.3904.108, Node.js 10.17.0): 10.15.1
  • Operating system and version (desktop or mobile): desktop

Reproducible Demo

None currently because I'm trying to upgrade the gulp website...

@phated phated added bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers labels Apr 4, 2020
@lex111
Copy link
Contributor

lex111 commented Apr 4, 2020

This is weird, since we included admonitions in core (so there should be no errors with CSS file), how did you remove this module?

@phated
Copy link
Contributor Author

phated commented Apr 4, 2020

@lex111 you don't include admonitions in core (see https://github.com/facebook/docusaurus/blob/master/packages/docusaurus/package.json#L34-L88) but include it only in preset-classic (https://github.com/facebook/docusaurus/blob/master/packages/docusaurus-preset-classic/package.json#L19) which I'm not using because I always avoid the preset. I think this theme should check if admonitions is enabled before trying to include that file.

@lex111
Copy link
Contributor

lex111 commented Apr 5, 2020

@phated aah, I get it, we did not consider the case when someone can use the classic theme directly without using the preset (this is not a very popular use case).

@phated
Copy link
Contributor Author

phated commented Apr 5, 2020

@lex111 is there a reason that remark-admonitions isn't just providing that lifecycle hook for itself?

@yangshun yangshun added help wanted Asking for outside help and/or contributions to this particular issue or PR. and removed status: needs triage This issue has not been triaged by maintainers labels Apr 6, 2020
@yangshun
Copy link
Contributor

yangshun commented Apr 6, 2020

We should shift 'remark-admonitions/styles/infima.css' out of packages/docusaurus-theme-classic/src/index.js into the preset but unfortunately presets don't allow lifecycle hooks at the moment. We might need to change that or create a new API to modify themes within presets. The dependency is a bit tangled up at the moment :/

@lex111
Copy link
Contributor

lex111 commented Apr 19, 2020

@phated I see that the Gulp website is already using the latest version of D2, which is awesome!
I hope you were not disappointed with the new version 😜

Regarding this issue, why don't you use preset-classic? Even if you do not need a blog, this should not bring overhead.

@phated
Copy link
Contributor Author

phated commented Apr 19, 2020

Yeah, we pushed through any issues because I needed to get it released before a podcast appearance this week. Docusaurus has been amazing, as always!

I'm generally against presets for most tools I use because I end up needing to change a lot of things. For example, I see a world where the gulp team creates their own theme (we've done medium customization already and need more), so I wouldn't want to rip out the preset at that time.

I also think by understanding how the preset is working and reimplementing it myself, I can see things that aren't needed and find issues like this. I have more feedback on the plugin architecture, but I currently don't have the time to write up my thoughts 🙁

@lex111
Copy link
Contributor

lex111 commented Apr 20, 2020

@phated we really love the feedback from our users, thank you for that. We welcome any feedback, because we are still in the alpha stage.

I tend to include admonitions in every plugin (both for docs and blogs), instead of doing this in a preset. I think it was a predictable behavior.

BTW consider adding your project to our showcase at https://v2.docusaurus.io/showcase 😇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An error in the Docusaurus core causing instability or issues with its execution help wanted Asking for outside help and/or contributions to this particular issue or PR.
Projects
None yet
3 participants