Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ We provide several development shells tailored for different tasks. You can ente
+ [`pandoc`][pandoc] (the document conversion tool)
+ [`latex`][latex] (the typesetting language)
+ [`mkdocs`][mkdocs] (with Python dependencies)
+ [`mdbook`][mdbook] (with Rust dependencies)


---
Expand Down Expand Up @@ -852,9 +851,6 @@ Here is the complete annotated subtree of the `build-tools` directory.
│ │ └── src/ # Source assets (CSS, JS, images, etc.)
│ │ ├── css/custom.css # Custom stylesheet for documentation sites
│ │ └── js/custom.js # Custom JavaScript for documentation sites
│ ├── mdbook/ # Configuration and templates for MdBook
│ │ ├── book.toml # Main configuration file for MdBook
│ │ └── src/SUMMARY.md # Defines the navigation for the MdBook site
│ └── mkdocs/ # Configuration and templates for MkDocs
│ ├── docs/index.md # Homepage/landing page for the MkDocs site
│ ├── includes/links.md # Common Markdown link references
Expand Down Expand Up @@ -904,7 +900,6 @@ This repository is maintained by [@carlostome][], [@WhatisRT][], and [@williamde
[latexmk]: https://ctan.org/pkg/latexmk
[literate]: https://en.wikipedia.org/wiki/Literate_programming
[Main.hs]: https://github.com/IntersectMBO/formal-ledger-specifications/blob/master/build-tools/shake/src/Main.hs
[mdbook]: https://rust-lang.github.io/mdBook/
[mkdocs]: https://www.mkdocs.org/
[New Issue]: https://github.com/IntersectMBO/formal-ledger-specifications/issues/new/choose
[niv]: https://github.com/nmattia/niv
Expand Down
44 changes: 4 additions & 40 deletions build-tools/scripts/md/config/build_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,11 @@ class SourcePaths:
# Static content directories
latex_dir: Path
md_dir: Path
md_common_dir: Path
md_common_src_dir: Path

# MkDocs static structure
mkdocs_dir: Path
mkdocs_docs_dir: Path

# MdBook static structure
mdbook_dir: Path
mdbook_src_dir: Path

# Key input files
macros_sty_path: Path
references_bib_path: Path
Expand All @@ -67,7 +61,6 @@ class SourcePaths:

# Navigation templates
mkdocs_nav_yml_path: Path
mdbook_summary_md_path: Path

@classmethod
def from_project_root(cls, project_root: Path) -> SourcePaths:
Expand All @@ -92,31 +85,24 @@ def from_project_root(cls, project_root: Path) -> SourcePaths:
# Static content
latex_dir = static_dir / "latex"
md_dir = static_dir / "md"
md_common_dir = md_dir / "common"
md_common_src_dir = md_common_dir / "src"

# MkDocs static
mkdocs_dir = md_dir / "mkdocs"
mkdocs_docs_dir = mkdocs_dir / "docs"

# MdBook static
mdbook_dir = md_dir / "mdbook"
mdbook_src_dir = mdbook_dir / "src"

# Key files
macros_sty_path = latex_dir / "macros.sty"
references_bib_path = latex_dir / "references.bib"

# Assets
md_css_dir = md_common_src_dir / "css"
md_js_dir = md_common_src_dir / "js"
md_css_dir = mkdocs_docs_dir / "css"
md_js_dir = mkdocs_docs_dir / "js"
custom_css_path = md_css_dir / "custom.css"
custom_js_path = md_js_dir / "custom.js"
katex_js_path = md_js_dir / "katex-config.js"

# Navigation
mkdocs_nav_yml_path = md_common_dir / "nav.yml"
mdbook_summary_md_path = mdbook_src_dir / "SUMMARY.md"
mkdocs_nav_yml_path = md_dir / "nav.yml"

return cls(
project_root=project_root,
Expand All @@ -130,12 +116,8 @@ def from_project_root(cls, project_root: Path) -> SourcePaths:
static_dir=static_dir,
latex_dir=latex_dir,
md_dir=md_dir,
md_common_dir=md_common_dir,
md_common_src_dir=md_common_src_dir,
mkdocs_dir=mkdocs_dir,
mkdocs_docs_dir=mkdocs_docs_dir,
mdbook_dir=mdbook_dir,
mdbook_src_dir=mdbook_src_dir,
macros_sty_path=macros_sty_path,
references_bib_path=references_bib_path,
md_css_dir=md_css_dir,
Expand All @@ -144,7 +126,6 @@ def from_project_root(cls, project_root: Path) -> SourcePaths:
custom_js_path=custom_js_path,
katex_js_path=katex_js_path,
mkdocs_nav_yml_path=mkdocs_nav_yml_path,
mdbook_summary_md_path=mdbook_summary_md_path,
)


Expand Down Expand Up @@ -178,11 +159,6 @@ class BuildPaths:
mkdocs_js_dir: Path
mkdocs_includes_dir: Path

mdbook_dir: Path
mdbook_src_dir: Path
mdbook_css_dir: Path
mdbook_js_dir: Path

# Key intermediate files
macros_json_path: Path
agda_css_path: Path
Expand Down Expand Up @@ -218,12 +194,6 @@ def from_project_root(cls, project_root: Path) -> BuildPaths:
mkdocs_js_dir = mkdocs_docs_dir / "js"
mkdocs_includes_dir = mkdocs_dir / "includes"

# MdBook site
mdbook_dir = build_md_dir / "mdbook"
mdbook_src_dir = mdbook_dir / "src"
mdbook_css_dir = mdbook_src_dir / "css"
mdbook_js_dir = mdbook_src_dir / "js"

# Key files
macros_json_path = build_md_aux_dir / "macros.json"
agda_css_path = build_md_aux_dir / "Agda.css"
Expand All @@ -246,10 +216,6 @@ def from_project_root(cls, project_root: Path) -> BuildPaths:
mkdocs_css_dir=mkdocs_css_dir,
mkdocs_js_dir=mkdocs_js_dir,
mkdocs_includes_dir=mkdocs_includes_dir,
mdbook_dir=mdbook_dir,
mdbook_src_dir=mdbook_src_dir,
mdbook_css_dir=mdbook_css_dir,
mdbook_js_dir=mdbook_js_dir,
macros_json_path=macros_json_path,
agda_css_path=agda_css_path,
log_file_path=log_file_path,
Expand Down Expand Up @@ -318,7 +284,7 @@ def default(cls) -> BibTeXConfig:

@dataclass(frozen=True)
class SiteConfig:
"""Configuration for site generation (MkDocs/MdBook)."""
"""Configuration for site generation (MkDocs)."""

# Site metadata
site_name: str
Expand All @@ -327,7 +293,6 @@ class SiteConfig:

# Build options
generate_mkdocs: bool
generate_mdbook: bool

# Asset handling
dynamic_css_files: Tuple[str, ...]
Expand All @@ -341,7 +306,6 @@ def default(cls) -> SiteConfig:
site_description="Formal ledger specification and documentation.",
site_url="https://intersectmbo.github.io/formal-ledger-specifications/",
generate_mkdocs=True,
generate_mdbook=False, # Not yet fully supported
dynamic_css_files=("css/Agda.css", "css/custom.css"),
dynamic_js_files=("js/custom.js", "js/katex-config.js")
)
Expand Down
5 changes: 4 additions & 1 deletion build-tools/scripts/md/modules/content_staging.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,10 @@ def stage_content(config: BuildConfig, processed_files: List[Path]) -> List[Path
# or pass through from BuildConfig if you wire mkdocs extras through.
"index.md": "README.md",
"guide.md": "CONTRIBUTING.md",
"Notation.md": "build-tools/static/md/common/src/Notation.md",
"Notation.md": "build-tools/static/md/mkdocs/docs/Notation.md",
"Definitions.md": "build-tools/static/md/mkdocs/docs/Definitions.md",
"ConwayBootstrap.md": "build-tools/static/md/mkdocs/docs/ConwayBootstrap.md",
"ConwayBootstrapEnact.md": "build-tools/static/md/mkdocs/docs/ConwayBootstrapEnact.md",
}

# Ensure each staged file has a correct source_path header
Expand Down
4 changes: 2 additions & 2 deletions build-tools/scripts/md/modules/latex_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ def _extract_labels_from_markdown_file(md_file: Path, config: BuildConfig) -> Di
for match in pattern.finditer(content):
title, label_id = match.group(1).strip(), match.group(2)
label_map[label_id] = {
"file": get_flat_filename(md_file.relative_to(config.source_paths.md_common_src_dir)),
"file": get_flat_filename(md_file.relative_to(config.source_paths.mkdocs_docs_dir)),
"anchor": f"#{label_id}",
"caption_text": title,
}
Expand All @@ -384,7 +384,7 @@ def _extract_labels_from_markdown_file(md_file: Path, config: BuildConfig) -> Di

def _handle_static_sources(config: BuildConfig) -> Dict[str, Dict[str, str]]:
label_map = {}
static_md_dir = config.source_paths.md_common_src_dir
static_md_dir = config.source_paths.mkdocs_docs_dir
if static_md_dir.exists():
for md_file in static_md_dir.rglob("*.md"):
label_map.update(_extract_labels_from_markdown_file(md_file, config))
Expand Down
5 changes: 1 addition & 4 deletions build-tools/scripts/md/modules/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ def setup_build_directories(config: BuildConfig) -> Result[List[Path], PipelineE
# Clean directories that should start fresh
dirs_to_clean = [
config.build_paths.mkdocs_dir,
config.build_paths.mdbook_dir,
]

# This functional chain first cleans a list of directories, and_then creates another list.
Expand All @@ -74,7 +73,6 @@ def setup_static_site_structure(config: BuildConfig) -> Result[Dict[str, Path],
"""
copy_operations = [
(config.source_paths.mkdocs_dir, config.build_paths.mkdocs_dir),
(config.source_paths.mdbook_dir, config.build_paths.mdbook_dir),
]

# Create a list of Result objects by applying cp_dir to each operation
Expand All @@ -88,14 +86,13 @@ def setup_static_site_structure(config: BuildConfig) -> Result[Dict[str, Path],

def copy_common_source_files(config: BuildConfig) -> Result[None, PipelineError]:
"""Copies shared files from the common source to all target site directories."""
common_src_dir = config.source_paths.md_common_src_dir
common_src_dir = config.source_paths.mkdocs_docs_dir
if not common_src_dir.exists():
logging.info("No common source directory found. Skipping copy.")
return Result.ok(None)

target_dirs = [
config.build_paths.mkdocs_docs_dir,
config.build_paths.mdbook_src_dir
]

# Create and sequence the results of copying the common directory to each target
Expand Down
5 changes: 0 additions & 5 deletions build-tools/scripts/md/modules/site_assembly.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,11 +280,6 @@ def deploy_mkdocs_assets(config: BuildConfig, nav_files: List[str]) -> List[str]
shutil.copy2(agda_css_path, config.build_paths.mkdocs_css_dir)
logging.info("✅ Deployed generated custom.css and Agda.css.")

# 2. Deploy JS
shutil.copy2(config.source_paths.custom_js_path, config.build_paths.mkdocs_js_dir)
shutil.copy2(config.source_paths.katex_js_path, config.build_paths.mkdocs_js_dir)
logging.info("✅ Deployed custom.js and KaTeX config.")

# 3. Deploy Bibliography
bib_source = config.source_paths.references_bib_path
bib_target_dir = config.build_paths.mkdocs_includes_dir
Expand Down
2 changes: 1 addition & 1 deletion build-tools/scripts/md/modules/source_headers.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

# Add/update a single file on disk (preserve existing header if present):
ensure_source_header_file(Path("_build/md/mkdocs/docs/Notation.md"),
"build-tools/static/md/common/src/Notation.md",
"build-tools/static/md/mkdocs/docs/Notation.md",
"master",
preserve_existing=True)

Expand Down
2 changes: 1 addition & 1 deletion build-tools/scripts/md/test/test_extract_labels.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def extract_labels_from_markdown_file(md_path: Path):

config = load_build_config()
markdown_dirs = [
config.source_paths.md_common_src_dir,
config.source_paths.mkdocs_docs_dir,
config.source_paths.src_dir
]

Expand Down
12 changes: 6 additions & 6 deletions build-tools/static/md/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

This directory is where we place static mkdocs source code for the web docs.

+ `mkdocs/nav.yml` is used by the `scripts/mkdocs/build.py` script to populate
the `nav` section of the final `_build/mkdocs/src/mkdocs.yml` mkdocs site
confiuration file. If the `mkocs/nav.yml` file is not found, `build.py`
generates a new `nav` section in `_build/mkdocs/src/mkdocs.yml` which include
+ `mkdocs/nav.yml` is used by the `scripts/mkdocs/build.py` script to populate
the `nav` section of the final `_build/mkdocs/src/mkdocs.yml` mkdocs site
confiuration file. If the `mkocs/nav.yml` file is not found, `build.py`
generates a new `nav` section in `_build/mkdocs/src/mkdocs.yml` which include
only those files that the script processes.
+ `mkdocs/src/mkdocs.yml` is a template that the `scripts/mkdocs/build.py` script uses
as a starting point on which to build the final `_build/mkdocs/src/mkdocs.yml`
as a starting point on which to build the final `_build/mkdocs/src/mkdocs.yml`
mkdocs site confiuration file.

To add a static markdown file, say, `Example.md`, to the web site documentation,
To add a static markdown file, say, `Example.md`, to the web site documentation,
place that file in `mkdocs/src/docs` and add an entry for it in the `nav.yml` file.

29 changes: 0 additions & 29 deletions build-tools/static/md/mdbook/book.toml

This file was deleted.

Loading