Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
sfm-js
Manage
Activity
Members
Labels
Plan
Issues
2
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TransFem.org
sfm-js
Commits
bc295b0f
Commit
bc295b0f
authored
3 years ago
by
marihachi
Browse files
Options
Downloads
Patches
Plain Diff
update api doc
parent
f6a24dd9
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/api.ts
+5
-5
5 additions, 5 deletions
src/api.ts
with
5 additions
and
5 deletions
src/api.ts
+
5
−
5
View file @
bc295b0f
...
...
@@ -5,7 +5,7 @@ import { stringifyNode, stringifyTree } from './util';
const
parser
:
peg
.
Parser
=
require
(
'
./parser
'
);
/**
*
g
enerate a
n
ode tree from the MFM string.
*
G
enerate
s
a
MfmN
ode tree from the MFM string.
*/
export
function
parse
(
input
:
string
):
MfmNode
[]
{
const
nodes
=
parser
.
parse
(
input
,
{
startRule
:
'
fullParser
'
});
...
...
@@ -13,7 +13,7 @@ export function parse(input: string): MfmNode[] {
}
/**
*
g
enerate a
n
ode tree of plain from the MFM string.
*
G
enerate
s
a
MfmN
ode tree of plain from the MFM string.
*/
export
function
parsePlain
(
input
:
string
):
MfmPlainNode
[]
{
const
nodes
=
parser
.
parse
(
input
,
{
startRule
:
'
plainParser
'
});
...
...
@@ -21,7 +21,7 @@ export function parsePlain(input: string): MfmPlainNode[] {
}
/**
*
g
enerate a MFM string from the
n
ode tree.
*
G
enerate
s
a MFM string from the
MfmN
ode tree.
*/
export
function
toString
(
tree
:
MfmNode
[]):
string
export
function
toString
(
node
:
MfmNode
):
string
...
...
@@ -35,7 +35,7 @@ export function toString(node: MfmNode | MfmNode[]): string {
}
/**
* Inspects the
n
ode tree.
* Inspects the
MfmN
ode tree.
*/
export
function
inspect
(
nodes
:
MfmNode
[],
action
:
(
node
:
MfmNode
)
=>
void
):
void
{
for
(
const
node
of
nodes
)
{
...
...
@@ -47,7 +47,7 @@ export function inspect(nodes: MfmNode[], action: (node: MfmNode) => void): void
}
/**
* Inspects the
n
ode tree and returns as an array the nodes that match the conditions
* Inspects the
MfmN
ode tree and returns as an array the nodes that match the conditions
* of the predicate function.
*/
export
function
extract
(
nodes
:
MfmNode
[],
predicate
:
(
node
:
MfmNode
)
=>
boolean
):
MfmNode
[]
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment