-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
feat: add JSDoc example #8533
Draft
linonetwo
wants to merge
19
commits into
TiddlyWiki:master
Choose a base branch
from
linonetwo:feat/ast-type
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
feat: add JSDoc example #8533
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
602e5ea
feat: add example
linonetwo 270aeba
chore: add ts file so tsc --noEmit works
linonetwo 492d812
refactor: remove // @ts-check
linonetwo ac308e0
feat: Allow `import('$:/core/modules/...')` instead of `import('../..…
linonetwo b6f219a
feat: make $tw.wiki globally available
linonetwo a5feb38
feat: add an example jsdoc to $tw.wiki.getTiddlerText
linonetwo c5304b4
fix: Declaration emit for this file requires using private name 'Widg…
linonetwo 43eff4e
fix: duplication of types
linonetwo cdceedd
docs: shorten JSDoc comment as requsted
linonetwo 8f0d37e
refactor: move some type to base class
linonetwo 24279cc
feat: allow type in /generated to work
linonetwo e3fc9b4
feat: import base type
linonetwo 18517b6
refactor: generate types to /types/core instead for simplicity
linonetwo c56afea
feat: add ast type that wikiast is using
linonetwo 06204b1
feat: refine the ast type
linonetwo 0c92f1b
Update tw.d.ts
linonetwo 562a308
fix: ignore base file
linonetwo 3cc1849
Update wiki.js
linonetwo 2eaadcd
Update npm-publish.sh
linonetwo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
/** | ||
* @typedef {import('$:/core/modules/parsers/wikiparser/wikiparser.js')["text/vnd.tiddlywiki"]} WikiParser | ||
* @typedef {import('$:/core/modules/widgets/widget.js').widget} Widget | ||
*/ | ||
|
||
/*\ | ||
title: $:/core/modules/wiki.js | ||
type: application/javascript | ||
|
@@ -22,10 +27,6 @@ Adds the following properties to the wiki object: | |
/*global $tw: false */ | ||
"use strict"; | ||
|
||
/** | ||
* @typedef {import('$:/core/modules/widgets/widget.js').widget} Widget | ||
*/ | ||
|
||
/** | ||
* @type {Widget} | ||
*/ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can the 2 comment blocks be merged to 1 block, or do we need 2 of them? |
||
|
@@ -1048,19 +1049,26 @@ exports.initParsers = function(moduleType) { | |
} | ||
}; | ||
|
||
/* | ||
Parse a block of text of a specified MIME type | ||
type: content type of text to be parsed | ||
text: text | ||
options: see below | ||
Options include: | ||
parseAsInline: if true, the text of the tiddler will be parsed as an inline run | ||
_canonical_uri: optional string of the canonical URI of this content | ||
*/ | ||
/** | ||
* Parse a block of text of a specified MIME type. | ||
* | ||
* @param {string} type - The content type of the text to be parsed. | ||
* @param {string} text - The text to be parsed. | ||
* @param {Object} [options] - Options for parsing. | ||
* @param {boolean} [options.parseAsInline=false] - If true, the text will be parsed as an inline run. | ||
* @param {string} [options._canonical_uri] - Optional string of the canonical URI of this content. | ||
* @param {string} [options.defaultType="text/vnd.tiddlywiki"] - The default type to use if no parser is found for the specified type. | ||
* @param {boolean} [options.configTrimWhiteSpace=false] - If true, trims white space according to configuration. | ||
* | ||
* @returns {WikiParser|null} The parser instance or null if no parser is found. | ||
*/ | ||
exports.parseText = function(type,text,options) { | ||
text = text || ""; | ||
options = options || {}; | ||
// Select a parser | ||
/** | ||
* @type WikiParser | ||
* Select a parser | ||
*/ | ||
var Parser = $tw.Wiki.parsers[type]; | ||
if(!Parser && $tw.utils.getFileExtensionInfo(type)) { | ||
Parser = $tw.Wiki.parsers[$tw.utils.getFileExtensionInfo(type).type]; | ||
|
@@ -1150,14 +1158,16 @@ exports.getTextReferenceParserInfo = function(title,field,index,options) { | |
return parserInfo; | ||
} | ||
|
||
/* | ||
Parse a block of text of a specified MIME type | ||
text: text on which to perform substitutions | ||
widget | ||
options: see below | ||
Options include: | ||
substitutions: an optional array of substitutions | ||
*/ | ||
/** | ||
* Parse a block of text of a specified MIME type and perform substitutions. | ||
* | ||
* @param {string} text - The text on which to perform substitutions. | ||
* @param {Widget} widget - The widget context used for variable substitution. | ||
* @param {Object} [options] - Options for substitutions. | ||
* @param {Array<{name: string, value: string}>} [options.substitutions] - An optional array of substitutions. | ||
* | ||
* @returns {string} The text with substitutions applied. | ||
*/ | ||
exports.getSubstitutedText = function(text,widget,options) { | ||
options = options || {}; | ||
text = text || ""; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO the full-stop at the end of the comment text can be removed.
IMO "The" and "the" can be removed -- most of the time. So it does not obscure the important content. eg:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this will be the updated prompt: