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

Content tagging for single-sourcing #3606

Closed
ArtFlag opened this issue Oct 18, 2020 · 2 comments
Closed

Content tagging for single-sourcing #3606

ArtFlag opened this issue Oct 18, 2020 · 2 comments
Labels
feature This is not a bug or issue with Docusausus, per se. It is a feature request for the future.

Comments

@ArtFlag
Copy link
Contributor

ArtFlag commented Oct 18, 2020

🚀 Feature

The idea of single-sourcing is to generate different outputs with one set of source files.
A typical example is for private and public docs, where the private docs are a superset of the public docs.

This is done by tagging content that can be included or excluded at build time.

Have you read the Contributing Guidelines on issues?

Yes

Motivation

Managing internal docs and public docs from one repo makes things a lot more easy, espcially when it comes to linking and information architecture.

Pitch

Flare, Sphinx and other docs-specific tools allow writers to tag content, very much like Docusaurus uses admonitions.

Sphinx example

non-tagged content
 
.. only:: my-admin-content-tag
 
   some tagged text

non-tagged content

And you can include this tag in the output with

sphinx-build -t my-admin-content-tag #this builds the admin docs

That's a great system to not limit the number of outputs.

Example with Docusaurus

Maybe 1 new admonition would do the trick as a first step, for instance, internal:

That's public text. It will be in the internal and public output.

:::internal
That bit is internal only and will not appear in the public output.
:::

Then we could build the internal docs with a flag:

yarn build --internal

Giving us:

That's public text. It will be in the internal and public output.

That bit is internal only and will not appear in the public output.

Would this be achievable?

@ArtFlag ArtFlag added feature This is not a bug or issue with Docusausus, per se. It is a feature request for the future. status: needs triage This issue has not been triaged by maintainers labels Oct 18, 2020
@slorber
Copy link
Collaborator

slorber commented Oct 19, 2020

@ArtFlag , we don't currently support this in core, but that may already be possible to build in userland

  • You can include/exclude docs from sidebars dynamically (see RFC: docs version configurations #3285 (comment)) (not ideal because it's per doc, and the doc would just be "hidden", still published without sidebar)

  • You can toggle a remark plugin for public deployments that would remove all content with ::: internal, similar to what admonition is doing except you remove the content instead of rendering an admonition

  • You can create a <TagProtected tag="internal> component that you'd use in MDX This component can use site config (like the customFields) to decide to render or not.

The 3rd solution is probably the simplest.

@Josh-Cena Josh-Cena removed the status: needs triage This issue has not been triaged by maintainers label Oct 30, 2021
@Josh-Cena
Copy link
Collaborator

This is probably too opinionated to be officially supported, and it can be easily implemented in the userland. Closing in favor of #5701

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature This is not a bug or issue with Docusausus, per se. It is a feature request for the future.
Projects
None yet
Development

No branches or pull requests

3 participants