Files
herolib/lib/web/docusaurus
2025-07-30 18:58:11 +02:00
..
...
2025-07-11 20:41:50 +03:00
...
2025-07-30 15:00:20 +02:00
...
2025-07-19 15:54:23 +02:00
...
2025-07-19 15:54:23 +02:00
...
2025-07-30 18:58:11 +02:00
...
2025-07-25 11:05:30 +02:00
2025-07-25 13:25:48 +02:00
2025-07-25 13:25:48 +02:00
2025-05-20 07:00:00 +04:00
...
2025-07-22 09:04:42 +02:00
...
2025-07-21 11:42:19 +02:00

How to use Heroscript with Docusaurus

You can use Heroscript to define and add content to your Docusaurus site. Below is an example:

!!docusaurus.define
	path_build: "/tmp/docusaurus_build"
	path_publish: "/tmp/docusaurus_publish"

!!docusaurus.reset

!!docusaurus.add name:"my_local_docs" path:"./docs"

!!docusaurus.add name:"tfgrid_docs" 
    git_url:"https://git.threefold.info/tfgrid/docs_tfgrid4/src/branch/main/ebooks/tech"
    git_reset:true
    git_pull:true

docusaurus.define Arguments

  • path_build (string): Path where the Docusaurus site will be built. Default is os.home_dir()/hero/var/docusaurus/build.
  • path_publish (string): Path where the Docusaurus site will be published. Default is os.home_dir()/hero/var/docusaurus/publish.

docusaurus.reset

  • resets the full docusaurus build system

docusaurus.update

  • updates the docusaurus build system, e.g. pull the templates back in

docusaurus.generate Arguments

  • name (string): Name of the Docusaurus site. Default is "main".
  • path (string): Local path to the documentation content. Default is an empty string.
  • git_url (string): Git URL of the documentation repository. Default is an empty string.
  • git_reset (boolean): If set to true, the Git repository will be reset. Default is false.
  • git_pull (boolean): If set to true, the Git repository will be pulled. Default is false.
  • git_root (string): Root directory within the Git repository. Default is an empty string.
  • nameshort (string): Short name for the Docusaurus site. Default is the value of name.

called through code

with heroscript in code


import freeflowuniverse.herolib.web.docusaurus

mut ds:=docusaurus.new(heroscript:'

	//next is optional
	!!docusaurus.define
		path_build: "/tmp/docusaurus_build"
		path_publish: "/tmp/docusaurus_publish"

	!!docusaurus.generate name:"tfgrid_docs" 
		git_url:"https://git.threefold.info/tfgrid/docs_tfgrid4/src/branch/main/ebooks/tech"
		git_root:"/tmp/code"

	')!

mut site:=ds.site_get(name:"tfgrid_docs")!

site.dev()!

directly


import freeflowuniverse.herolib.web.docusaurus

// Create a new docusaurus factory
mut ds := docusaurus.new(
	path_build: '/tmp/docusaurus_build'
	path_publish: '/tmp/docusaurus_publish'
)!

// mut site:=ds.add(path:"${os.home_dir()}/code/git.threefold.info/tfgrid/docs_tfgrid4/ebooks/tech",name:"atest")!
mut site:=ds.add(git_url:"https://git.threefold.info/tfgrid/docs_tfgrid4/src/branch/main/ebooks/tech",name:"atest")!

// println(site)

//next generates but doesn't do anything beyond
// site.generate()!

site.dev()!