Coder Social home page Coder Social logo

typedoc-plugin-replace-text's People

Contributors

krisztianb avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

typedoc-plugin-replace-text's Issues

Feature Request: Replace with contents from a file

I have a folder of examples in my project and I would like to use this plugin to replace references to these example files with the actual code, fx:
::--example: someExample.ts, 15, 32--::
Would become a code block containing lines 15-32 of the someExample.ts file.

The thing that is preventing me from accomplishing it with the current version of this plugin, is that it doesn't seem to support replacing snippets with the contents of other files.

Would you consider supporting this usecase with this plugin? Do you know other non-hacky ways of doing this?

Plugin doesn't work

Question

I have a very special project structure (It's not possible to change this structure) and there I have problems to get typodoc plugins installed.

Info

  • Angular Project with NX
  • I only want to document the lib modules
  • TypeDoc 0.24.6

Directory structure

myProject
--apps
----myProject
------tsconfig.json
--libs
----ui
------common
--------typedoc.json
--------tsconfig.json
------desktop
--------typedoc.json
--------tsconfig.json
----platform
------common
--------typedoc.json
--------tsconfig.json
------access
--------typedoc.json
--------tsconfig.json
--typedoc.json
--typedoc.base.json

Content of myProject\typedoc.base.json

{
	"$schema": "https://typedoc.org/schema.json",
	"includeVersion": true
}

Content of myProject\typedoc.json

{
	"basePath": "./",
	"entryPoints": [
		"libs/platform/*",
		"libs/ui/*"
	],
	"name": "Documentation",
	"entryPointStrategy": "packages",
	"out": "./dist/typedoc",
	"plugin": [
		"typedoc-umlclass",
		"typedoc-plugin-coverage",
		"typedoc-plugin-replace-text"
	],
	"umlClassDiagram": {
		"type": "detailed",
		"location": "local",
		"format": "svg",
		"umlClassDiagramVerboseOutput": true
	},
	"replaceText": {
		"inCodeCommentText": true,
		"inCodeCommentTags": true,
		"inIncludedFiles": true,
		"replacements": [
			{
				"pattern": "King Kong",
				"flags": "gi",
				"replace": "[King Kong](https://github.com/king-kong)"
			}
		]
	}
}

Content of myProject\libs\platform\common\typedoc.json (every typedoc.json in a nx-module looks the same)

{
	"extends": [
		"../../../typedoc.base.json"
	],
	"entryPoints": [
		"src/index.ts"
	]
}

Problem Description

When I run the command npx typedoc, the documentation is generated successfully. However, the string "King Kong" (I inserted it on various places, e.g. param description, class description etc) wasn't replaced.

But the plugin is loaded, which is also displayed during execution. The config entries also seem to be pulled, because if I make a spelling mistake on purpose, this would lead directly to the termination of the generation.

[info] Loaded plugin typedoc-plugin-replace-text

Does anyone knows what the problem here is?

This was the only way I got typedoc working. If there is a better way, I am open to using it. I tried to do everything from the instructions, but everything else didn't work. If any info is needed, I'll be happy to provide it.

Include typings in package

Hi, could you please export the typescript typings (or source) into dist/? This would help me with typing the configuration.

Currently, there are only JS files:
image

Thanks!

Feature Request: Add path to current file in replacer function

I was hoping to use this package to replace the content of a comment with the contents of a file just like #4. I can get something to work using the replacer function, but in order to get the path to the file I want to read I would need the path to the current file being observed. For example, if I have a comment defined in a file located in src/my/location/Test.ts and a corresponding src/my/location/README.md I would like to do something like this:

/**
 * My test class.
 *
 * [[include ./README.md]]
 */
class Test {}

In order to resolve the location of ./README.md, I would need to know I'm located in src/my/location/Test.ts. It looks like the replacer function just gives info about the string match. Would it be feasible to add some more info about the match's file path to the replacer function?

Option inIncludedFiles is too greedy

Using a plugin config like this doesn't produce the expected results:

"replaceText": {
    "inCodeCommentText": false,
    "inCodeCommentTags": false,
    "inIncludedFiles": true,
    "replacements": [
        {
            "pattern": "A",
            "replace": "B"
        }
    ]
}

Expected

Once would expect that A is replaced by B only in the README and other included markdown files as suggested by the plugin's README.

Actual

With the config above A is replaced everywhere by B even in code comment text and code comment tags.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.