markproc

command module
v0.0.0-...-4a52276 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 10, 2024 License: GPL-3.0 Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Markdown Preprocessor

This project provides a Go-based preprocessor for Markdown files that creates anchors and links for references and headings. The tool is a command-line utility that reads a Markdown file from standard input and writes the processed content to standard output. If the processor encounters any issues, it will return a non-zero exit code.

Features

  • Creates anchor links for lines starting with [REF]:
  • Converts [REF] references to links and validates them
  • Tracks other references and attempts to link them to headings using fuzzy matching
  • Prints warnings for references that cannot be conclusively matched
  • Each section heading gets a unique numeric section identifier and an associated anchor.
  • Internal section references use section numbers, allowing them to be easily distinguished from external references.
  • Final verification ensures all links have valid targets and that there are no duplicate targets.

Usage

To use the preprocessor, run it as a command in your terminal:

go run main.go < your_markdown_file.md > processed_markdown.md

Here, your_markdown_file.md is the Markdown file you want to process, and processed_markdown.md is the output file with processed content.

Example
Input
# A Top-Level Heading

This is the first section.

## A Section Heading

This is a reference to the Section One heading [sec top].

Reference to the anchor below [ref1].

## References

[ref1]: A bibliographic reference.
Output
<a name="sec1"></a>
# 1. A Top-Level Heading

This is the first section.

<a name="sec1_1"></a>
## 1.1. A Section Heading

This is a reference to the Section One heading [<a href="#sec1">sec 1</a>].

Reference to the anchor below [<a href="#ref1">ref1</a>].

## References

<a name="ref1"></a>
[ref1]: A bibliographic reference.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址