Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Folder of markdown doc #247

Closed
movrack opened this issue Jun 30, 2016 · 20 comments
Closed

Folder of markdown doc #247

movrack opened this issue Jun 30, 2016 · 20 comments
Labels
enhancement Improved functionality help wanted Contributions are especially encouraged
Milestone

Comments

@movrack
Copy link

movrack commented Jun 30, 2016

Is it possible to include a folder of documents writted in markdown ?
A bit like githubs wiki to be able to write more files than only one readme big file.

@aciccarello
Copy link
Collaborator

Does #63 help at all?

@movrack
Copy link
Author

movrack commented Jul 1, 2016

It look to be a solution but I can't make it work.
I am on v 0.4.4.
I use this command line:

    typedoc -- --options typedoc.json --exclude '**/*.spec.ts' --exclude 'node_modules/**/*' --includes 'docs2/' ./app/

and docs2 contains 2 files
- demo1.md
- demo2.md

typedoc.json is:

{
  "name": "Mobile app",
  "mode": "modules",
  "out": "docs/",
  "theme": "default",
  "ignoreCompilerErrors": "true",
  "includeDeclarations": false,
  "experimentalDecorators": "true",
  "emitDecoratorMetadata": "true",
  "target": "ES5",
  "moduleResolution": "node",
  "preserveConstEnums": "true",
  "stripInternal": "true",
  "suppressExcessPropertyErrors": "true",
  "suppressImplicitAnyIndexErrors": "true",
  "module": "commonjs"
}

But I can't found demo1 or demo2 on generated doc in docs folder.

Moreover (it's an other error but probably a mess of my config), and because i am writting here all the conf, I always see theses "errors", that i want to exclude:
Error: /Users/.../node_modules/ionic-native/dist/plugins/webintent.d.ts(22) Cannot find name 'Promise'. Error: /Users/.../node_modules/rxjs/Observable.d.ts(9) Cannot find name 'Promise'.

@0815fox
Copy link

0815fox commented Jul 1, 2016

The doc states:

--includes <path/to/includes>
Specifies the location to look for included documents. One may use [[include:FILENAME]] in comments to include documents from this location.

So: do you refer to demo{1|2}.md somewhere in a tsdoc comment in one of your source files? e.g.

/**
 * [[include:demo1.md]]
 */

I did not use the feature myself, but that is what I would expect to work. This should then lead to demo1.md being searched and included into documentation. But maybe that is not even what you originally wanted? I understood it as if you wanted to integrate a complete doc structure, which - if I guess correctly - you want to be inserted e.g. in the navigation, so that you have typedoc and your documentation accessible in one place?

@movrack
Copy link
Author

movrack commented Jul 1, 2016

It's working, I can see the included content on the readme but it's I was expecting.
Here, if i includes all files, I will see all content on a big big big file to scroll on the first page.
I was more thinking about something like a link in on the website generated who can open the directory included. (for example in top right). And who can show md files.

And thee readme is also shown on the git repository first page but the [[include:demo1.md]] will not be shown on it.

@hayk94
Copy link

hayk94 commented Aug 7, 2018

Guys were you able to make the includes work?

I try it like this with no success

here is how I run typedoc

"typedoc --out ./doc/ ./src --externalPattern '**/node_modules/**' --ignoreCompilerErrors --includes 'mdDocs/'"

in my mdDocs I have TypeScriptReactReduxTutorial.md so in my code file I do

// ./src/store/index.ts

/**
 * [[include:TypeScriptReactReduxTutorial.md]]
 */

import { combineReducers } from 'redux'

import { counterReducer } from './counter/reducer'

import { IApplicationState } from './types'

/**
 *  Whenever an action is dispatched, Redux will update each top-level application state property
 * using the reducer with the matching name. It's important that the names match exactly, and that
 * the reducer acts on the corresponding IApplicationState property type.
 */
export const rootReducer = combineReducers<IApplicationState>({
  counter: counterReducer
})

But nothing from my md file is being show in the generated docs only a line like this is being added

Defined in store/rootReducer.ts:18

@cuibonobo
Copy link

Including a MarkDown file by referencing it inside of my API documentation works for me. However, I think the original intent of this issue (and what I'm looking for as well) is to have a folder of MarkDown files that can be listed in the table of contents without being explicitly part of the API.

For example, if you wish to make the output of TypeDoc your complete documentation solution, you may want to include a page for architecture design, acknowledgements, etc. That information could go in the README, but for many projects it would be nice to split up into separate pages.

@Gerrit0 Gerrit0 added enhancement Improved functionality help wanted Contributions are especially encouraged good first issue Easier issue for first time contributors labels Dec 12, 2018
@reyalpsirc
Copy link

Any update on this? Will TypeDoc ever support a folder of Markdown docs together with the code generation?

@nadavhames
Copy link

A very hacky solution:
Make a .ts file with an empty module and put your markdown in the comments for that module.
Note that block comments in your markdown need to be converted to groups of single line comments.

/**
 * ## My Long Markdown File
 * Put your markdown here!
 * ```js 
 * //my
 * //block
 * //comment
 * ``` 
*/
namespace My_Guide {}

Credit goes to jaykaron for the find

@jaykaron
Copy link

jaykaron commented Apr 4, 2019

Heres a quick script that converts Markdown files to one big TS file with empty namespaces.
It does not work if there are lists using * or block comments like /** ....

#!/bin/bash
# takes all the input files and places them within block comments
# on empty namespaces named the same as the filename (without the .md)
# and spits it out into stdout
# usage 'bash markdownToTs.sh *.md > someTsFile.ts'

while test $# -gt 0
do
    echo '/**'
    cat $1 
    echo '*/' 

    file_name=$1
    module_name=${file_name%???}    # remove .md ending
    echo "namespace $module_name {}"
    shift
done

For example for file test1.md:

# Test 1
- a 
- b
- c

it outputs:

/**
# Test 1
- a
- b
- c*/
namespace test1 {}

which is rendered as:
image

@mlzxy
Copy link

mlzxy commented Jul 26, 2019

Another possible solution here:

  1. fork https://github.com/TypeStrong/typedoc-site and put your markdown doc in its _guides folder
  2. put your compiled typedoc output to api folder
  3. customize it for your project and release the whole jekyll site

Not much extra work required but get a perfectly look and unhacky results.

@alexandercerutti
Copy link
Contributor

Any news for a native way for this? This should be a must.

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Feb 15, 2020

This is next on my todo list once library mode (#1184) is done, but unfortunately I only have a couple hours a week to work on this project...

@mipatterson
Copy link

I wrote a TypeDoc plugin that I think might solve this need:
https://github.com/mipatterson/typedoc-plugin-pages
Live demo here

@alexandercerutti
Copy link
Contributor

alexandercerutti commented Nov 25, 2021

Right now, I'm using this system, to convert files in a standard folder documents from markdown to html through marked.

Package.json:

{
	"scripts": {
		"predoc": "for f in $(find documents -type f | grep .md); do npx marked -i $f -o $(echo $f | sed -rne 's/.md/.html/p'); done",
		"doc": "rm -rf ./docs && npx typedoc"
	}
}

typedoc.json

{
    "media": "documents"
}

Then I'm referencing the files through [myFile](media://file.md).
The only drawback is that markdown is not converted with a theme but as pure html.

@tony-scio
Copy link

https://github.com/mipatterson/typedoc-plugin-pages looked perfect, but isn't compatible w/ v0.22 and seems abandoned. Anyone else know of a better alternative that supports pages?

@dzek69
Copy link

dzek69 commented Jul 21, 2022

@tony-scio and all others, this seems to work pretty well: https://www.npmjs.com/package/@knodes/typedoc-plugin-pages

it's not defined as a theme but as a plugin, which is nice, because it actually allows to use any theme with the tutorials addition

@JinYi2000
Copy link

@transitive-bullshit
Copy link

https://github.com/tgreyuk/typedoc-plugin-markdown/tree/master/packages/typedoc-plugin-markdown is another option that looks well maintained. I'm using it for one of my projects at the moment.

@josephearl
Copy link

josephearl commented Sep 7, 2023

I have extra markdown files in my repository like CHANGELOG.md and CONTRIBUTING.md that I'd like to have converted to HTML along with the README.md (and ideally have links between the .md files changed to work - e.g. when README.md links to CHANGELOG.md, when both are converted to HTML the link to the changelog should still work).

@Gerrit0 Gerrit0 added this to the v0.26.0 milestone Oct 15, 2023
Gerrit0 added a commit that referenced this issue May 3, 2024
… site

This is a very large change and needs a significant amount of testing still. It
seems to work correctly for TypeDoc's changelog, but there's still several
TODO items remaining before this goes in a full release.

Closes #247
Closes #1870
Closes #2288
Closes #2565
@Gerrit0 Gerrit0 modified the milestones: v0.27.0, v0.26.0 May 4, 2024
@Gerrit0 Gerrit0 mentioned this issue May 4, 2024
7 tasks
@Gerrit0
Copy link
Collaborator

Gerrit0 commented May 4, 2024

This feature is coming to 0.26, which is available to try in beta now: 🎉 #2567

@Gerrit0 Gerrit0 closed this as completed Jun 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improved functionality help wanted Contributions are especially encouraged
Projects
None yet
Development

No branches or pull requests