npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@4dsas/doc_preprocessing

v1.1.1

Published

Preprocess 4D doc to be built by docusaurus

Downloads

807

Readme

doc_preprocessing

This library helps the markdown writers by adding invisible commands in markdown. Have the possibility to "include" and "ref" any markdown part with invisible commands.

This package can be added in the current project by adding "@4dsas/doc_preprocessing": "^1.0.5" in the package.json It adds special command to help writing markdown All commands will disappear during the preprocess.

Reference and Include

The commands "Reference" and "Include" enables to duplicate markdown

Reference

The command is REF. It is used as:

<!-- REF nameOfReference-->content<!-- END REF -->

with:

  • nameOfReference: is the name of the reference it should be unique
  • content: is any content you wish it includes break lines.

Example:

# Title
<!-- REF reference-->Ref1<!-- END REF-->

The preprocess will remove all commands

Before:

# Title
<!-- REF reference1 -->Ref1<!-- END REF--> *TEST*
<!-- REF reference2 -->Ref2
<!-- END REF-->
<!-- REF reference3 -->
Ref3
<!-- END REF-->

After:

# Title
Ref1 *TEST*
Ref2

Ref3

A reference is generally paired with an include

Include

The command is INCLUDE . It is used as:

<!-- INCLUDE nameOfReference-->

with:

  • nameOfReference: is the name of the reference created by @REF@

Before:

# Title
<!-- REF reference1 -->Ref1<!-- END REF--> *TEST*
<!-- REF reference2 -->Ref2
<!-- END REF-->
<!-- REF reference3 -->
BEFORE <!-- INCLUDE reference1 --> TEST INCLUDE
Ref3
<!-- END REF-->

After:

# Title
Ref1 *TEST*
Ref2

Ref3
BEFORE Ref1 TEST INCLUDE

The reference and include does not have a location restriction, it will work with any markdown file.

How it works?

A first pass will find all the REFERENCE and store them. A reference is stored with it's ID, the file path. But also the start and end index.

A second pass will replace all the INCLUDE by its reference if found. Moreover all the markdown comments will be cleaned up if they are not recognised.

A log message is displayed for any error found.

The program will only search inside ".md" files, the other files are untouched or copied to the new destination depending on their last modification date.

The watch system works the same way but if a REF is changed all files including this REF will be altered.

Settings

List of arguments available:

  • path: where the folder to process is located [obligatory]
  • output: the folder to output all processed files [optional]
  • config: add other Ref from a file [optional]
  • syntax: output folder to write a formated JSON of REF [optional]
  • build_dependencies: folder to build dependencies [optional]
  • watch: watch a folder and all changes will be repercuted to the output folder [optional]
  • settings: settings file to load must be a valid JSON [optional]
  • settings_type: load a specific section [optional]
  • args_dependencies: set arguments to be used by the dependencies [optional]
  • list_args: Object used to pass values between dependencies. Ex {"language": "en"} in the dependency all %language% will eb replaced by "en" [optional]
  • exclude_list: Excludes a list of folder [optional]

A dependency can be loaded via git

    "dependencies":[
      {
        "name":"orda",
        "branch":"main",
        "url":"git:https://github.com/doc4d/orda.git" 
      }

or can be loaded in local:

    "dependencies":[
      {
        "name":"orda",
        "url":"file:../../orda/" 
      }

If a file namaed .doc_preprocessing.json exists it will be loaded. The section default is taken first, can be overloaded by the other sections if selected.

{
    "default": 
    {
        "path":"../docs/",
        "config":"../docs/preprocessing.conf",
        "output":"",
        "syntax":"",
        "build_dependencies":".doc_preprocessing_build/",
        "dependencies":[
            {
                "name":"orda2",
                "url":"git:https://github.com/doc4d/orda.git",
                "branch": "main"
            }
        ]
    },
    "build": {
        "output":"../docs/"
    },
    "build_translate": {
        "path":"translated_docs/*",
        "output":"translated_docs/",
        "args_dependencies":{
            "settings_type": "translation"
        }
    },
    "start_watch" : {
        "watch":true,
        "output":"../docsPostProcessed/"
    },
    "syntax4D": {
        "path":"../docs/API/",
        "syntax":"./syntax/4D/"
    },
    "syntax4D_translate": {
        "path":"translated_docs/*/API/",
        "args_dependencies":{
            "settings_type": "translation"
        },
        "syntax":"./syntax/4D/"
    },
    "syntaxViewPro": {
        "path":"../docs/ViewPro/",
        "syntax":"./syntax/ViewPro/",
        "config":""
    },
    "syntaxViewPro_translate": {
        "path":"translated_docs/*/ViewPro/",
        "syntax":"./syntax/ViewPro/",
        "config":"",
        "args_dependencies":{
            "settings_type": "translation"
        }
    }
}

Example

doc_preprocess --settings-type='syntax_4d' loads default and syntax_4d. Can be overloaded by adding arguments.

doc_preprocess --settings-type='syntax_4d' --path=../../docs will change the path of docs