Options
All
  • Public
  • Public/Protected
  • All
Menu

@argdown/core

Index

Modules

Enumerations

Classes

Interfaces

Type aliases

Variables

Functions

Object literals

Type aliases

DefaultSettings

DefaultSettings<T>: object

Type parameters

  • T

Type declaration

IAstNode

IAstNode: IRuleNode | ITokenNode

A node in the abstract syntax tree produced by the ParserPlugin

MapNodeType

The ArgdownTypes members identifying nodes in an argument map.

RelationMember

The data types that can be either source or target of a relation.

Note that IInference can only be a relation target and never be a relation source.

Variables

Const INCOMPLETE_PCS_ERROR

INCOMPLETE_PCS_ERROR: "Incomplete premise-conclusion-structure (pcs). A pcs has to consist of at least one premise (a numbered statement: '(1) Statement Text'), one inference (marked by four hyphens ----) and one conclusion (a numbered statement after an inference). There may no be any empty lines between these elements." = `Incomplete premise-conclusion-structure (pcs). A pcs has to consist of at least one premise (a numbered statement: '(1) Statement Text'), one inference (marked by four hyphens ----) and one conclusion (a numbered statement after an inference). There may no be any empty lines between these elements.`

Const INVALID_INDENTATION_ERROR

INVALID_INDENTATION_ERROR: "Invalid indentation." = `Invalid indentation.`

Const INVALID_INFERENCE_ERROR

INVALID_INFERENCE_ERROR: "Invalid inference. Inferences can either be marked by four hyphens (----) or have the following format:--Inference Rule 1, Inference Rule 2 (my meta data property 1: 1, 2, 3; my meta data property 2: value) --" = `Invalid inference. Inferences can either be marked by four hyphens (----) or have the following format:--Inference Rule 1, Inference Rule 2 (my meta data property 1: 1, 2, 3; my meta data property 2: value) --`

Const INVALID_INFERENCE_POSITION_ERROR

INVALID_INFERENCE_POSITION_ERROR: "Invalid inference position. An inference may only occur within a premise-conclusion-structure, in which it is preceded by a premise and followed by a conclusion (both of which have to be numbered statements: '(1) Statement')." = `Invalid inference position. An inference may only occur within a premise-conclusion-structure, in which it is preceded by a premise and followed by a conclusion (both of which have to be numbered statements: '(1) Statement').`

Const INVALID_PCS_POSITION_ERROR

INVALID_PCS_POSITION_ERROR: "Invalid position of premise conclusion structure (pcs). Make sure the pcs is preceded by an empty line." = `Invalid position of premise conclusion structure (pcs). Make sure the pcs is preceded by an empty line.`

Const INVALID_PCS_STATEMENT_CONTENT_ERROR

INVALID_PCS_STATEMENT_CONTENT_ERROR: "Invalid statement content. An argument reference (<Argument Title>) or definition (<Argument Title>:) can not be used as premise or conclusion within a premise-conclusion-structure. Use statement references ([Statement Title]) or definitions ([Statement Title]:) instead." = `Invalid statement content. An argument reference (<Argument Title>) or definition (<Argument Title>:) can not be used as premise or conclusion within a premise-conclusion-structure. Use statement references ([Statement Title]) or definitions ([Statement Title]:) instead.`

Const INVALID_RELATION_ERROR

INVALID_RELATION_ERROR: "Invalid relation syntax. This may either be caused by a) an invalid relation parent or b) invalid indentation. a) Invalid relation parent: Only statements and arguments can have relations as child elements. b) Invalid Indentation tree: Please check that if there are preceding relations in this paragraph, there is at least one with equal or less indentation." = `Invalid relation syntax. This may either be caused by a) an invalid relation parent or b) invalid indentation. a) Invalid relation parent: Only statements and arguments can have relations as child elements. b) Invalid Indentation tree: Please check that if there are preceding relations in this paragraph, there is at least one with equal or less indentation.`

Const INVALID_TEXT_POSITION_ERROR

INVALID_TEXT_POSITION_ERROR: "Invalid position of text content. Make sure it is not preceded by a statement reference ([Statement Title]) or argument reference (<Argument Title>)." = `Invalid position of text content. Make sure it is not preceded by a statement reference ([Statement Title]) or argument reference (<Argument Title>).`

Const MISSING_CONCLUSION_ERROR

MISSING_CONCLUSION_ERROR: "Missing conclusion. Please add a numbered statement after the inference." = `Missing conclusion. Please add a numbered statement after the inference.`

Const MISSING_INFERENCE_END_ERROR

MISSING_INFERENCE_END_ERROR: "Invalid inference syntax. Please end your inference with two hyphens (--)" = `Invalid inference syntax. Please end your inference with two hyphens (--)`

Const MISSING_INFERENCE_ERROR

MISSING_INFERENCE_ERROR: "Missing inference. Use four hyphens (----) between two numbered statements to insert an inference in your premise-conclusion-structure and mark the latter statement as a conclusion." = `Missing inference. Use four hyphens (----) between two numbered statements to insert an inference in your premise-conclusion-structure and mark the latter statement as a conclusion.`

Const MISSING_RELATION_CONTENT_ERROR

MISSING_RELATION_CONTENT_ERROR: "Missing relation content. Please define or refer to a statement or argument (you can define a statement by simply adding a line of text)." = `Missing relation content. Please define or refer to a statement or argument (you can define a statement by simply adding a line of text).`

Const MISSING_TEXT_CONTENT_ERROR

MISSING_TEXT_CONTENT_ERROR: "Missing text content. Please add a line of text or refer to an existing statement or argument instead by replacing the content in this line with [Statement Title] or <Argument Title> (without a colon). If you want to define a statement ([Statement Title]:) or argument (<Argument Title>:), the defining text content has to follow the defined element title without any empty lines in between." = `Missing text content. Please add a line of text or refer to an existing statement or argument instead by replacing the content in this line with [Statement Title] or <Argument Title> (without a colon). If you want to define a statement ([Statement Title]:) or argument (<Argument Title>:), the defining text content has to follow the defined element title without any empty lines in between.`

Const errorMessageProvider

errorMessageProvider: IArgdownErrorMessageProvider = <IArgdownErrorMessageProvider>{isRelationToken,isRelationRule,getTokenDescription,buildInvalidElementPositionError,buildInvalidParagraphStartError,buildInvalidRelationTextContentError,buildMismatchTokenMessage: (options: {expected: TokenType;actual: IToken;previous: IToken;ruleName: string;}): string => {if (options.ruleName == "inference") {if (options.expected == ArgdownLexer.InferenceStart) {return MISSING_INFERENCE_ERROR;} else if (options.expected == ArgdownLexer.InferenceEnd) {return MISSING_INFERENCE_END_ERROR;}} else if (options.expected == ArgdownLexer.Dedent &&(options.ruleName == "statementRelations" ||options.ruleName == "argumentRelations")) {return buildInvalidRelationTextContentError(options.actual);} else if (options.ruleName == "argumentStatement") {if (options.expected == ArgdownLexer.StatementNumber) {return MISSING_CONCLUSION_ERROR;}} else if (options.ruleName == "bold" || options.ruleName == "italic") {return buildMissingEndError(options.expected);}return defaultParserErrorProvider.buildMismatchTokenMessage!(options);},buildNotAllInputParsedMessage: (options: {firstRedundant: IToken;ruleName: string;}): string => {if (tokenMatcher(options.firstRedundant, ArgdownLexer.Indent) ||isRelationToken(options.firstRedundant)) {return INVALID_RELATION_ERROR;} else if (tokenMatcher(options.firstRedundant, ArgdownLexer.InferenceStart)) {return INVALID_INFERENCE_POSITION_ERROR;} else if (tokenMatcher(options.firstRedundant, ArgdownLexer.StatementNumber)) {return INVALID_PCS_POSITION_ERROR;} else if (tokenMatcher(options.firstRedundant, ArgdownLexer.ArgumentReference)) {return buildInvalidElementPositionError(options.firstRedundant);} else if (tokenMatcher(options.firstRedundant,ArgdownLexer.ArgumentDefinition)) {return buildInvalidElementPositionError(options.firstRedundant);} else if (tokenMatcher(options.firstRedundant,ArgdownLexer.StatementReference)) {return buildInvalidElementPositionError(options.firstRedundant);} else if (tokenMatcher(options.firstRedundant,ArgdownLexer.StatementDefinition)) {return buildInvalidElementPositionError(options.firstRedundant);} else if (tokenMatcher(options.firstRedundant, ArgdownLexer.Freestyle)) {return INVALID_TEXT_POSITION_ERROR;} else {return defaultParserErrorProvider.buildNotAllInputParsedMessage!(options);}},buildNoViableAltMessage: (options: {expectedPathsPerAlt: TokenType[][][];actual: IToken[];previous: IToken;customUserDescription: string;ruleName: string;}): string => {const tokens = options.actual;if (options.ruleName == "argdown" && tokens.length > 0) {if (tokens.length >= 2 &&tokenMatcher(tokens[0], ArgdownLexer.Indent)) {let secondToken = tokens[1];return buildInvalidParagraphStartError(secondToken);} else if (tokens.length > 0) {return buildInvalidParagraphStartError(tokens[0]);}} else if (isRelationRule(options.ruleName)) {return MISSING_RELATION_CONTENT_ERROR;} else if (options.ruleName == "statement") {if (tokens.length > 0 &&(tokenMatcher(tokens[0], ArgdownLexer.ArgumentReference) ||tokenMatcher(tokens[0], ArgdownLexer.ArgumentDefinition))) {return INVALID_PCS_STATEMENT_CONTENT_ERROR;}return MISSING_TEXT_CONTENT_ERROR;}return defaultParserErrorProvider.buildNoViableAltMessage!(options);},buildEarlyExitMessage: (options: {expectedIterationPaths: TokenType[][];actual: IToken[];previous: IToken;customUserDescription: string;ruleName: string;}): string => {var firstToken = options.actual.length > 0 ? options.actual[0] : null;if (options.ruleName == "argdown") {if (firstToken && isRelationToken(firstToken)) {return INVALID_RELATION_ERROR;} else if (firstToken &&tokenMatcher(firstToken, ArgdownLexer.InferenceStart)) {return INVALID_INFERENCE_POSITION_ERROR;}} else if (options.ruleName == "statementContent") {return MISSING_TEXT_CONTENT_ERROR;} else if (options.ruleName == "pcs") {if (firstToken && isRelationToken(firstToken)) {return INVALID_INDENTATION_ERROR;}return INCOMPLETE_PCS_ERROR;} else if (options.ruleName == "data") {return INVALID_INFERENCE_ERROR;} else if (firstToken &&tokenMatcher(firstToken, ArgdownLexer.InferenceEnd)) {return INVALID_INFERENCE_ERROR;}return defaultParserErrorProvider.buildEarlyExitMessage!(options);}}

Functions

Const addLineBreaks

  • addLineBreaks(str: string, measurePixelWidth: boolean, options: object): object
  • Adds line breaks to a string every x pixels, using string-pixel-width for measuring the width.

    Returns an object containing the new string and the number of lines.

    Only fonts measured by the string-pixel-width library are supported.

    Parameters

    • str: string
    • measurePixelWidth: boolean
    • options: object

    Returns object

Const arrayIsEmpty

  • arrayIsEmpty(x: any): boolean

Const astToJsonString

  • astToJsonString(ast: IAstNode[]): string

Const astToString

Const checkResponseFields

  • checkResponseFields(plugin: IArgdownPlugin, response: IArgdownResponse, fields: string[]): void

Const createMissingResponseFieldError

Const deriveImplicitRelations

  • Derives implicit relations from defined equivalence classes and argument premise-conclusion-structures. This will not derive all logically derivable relations, but only those that directly result from equivalence classes being used as premises or main conclusions in arguments:

    Examples: if ec is used as premise in a: derives support of ec for a if ec is used as main conclusion in a: derives support of a for ec if ec attacks/supports a1 and is used as main conclusion in a2: derives attack/support of a2 for a1 if ec1 is contrary/contradictory to ec2, ec1 is used as premise in a1 and ec2 is used as main conclusion in a2: derives attacks of a2 against ec1 and a1.

    Parameters

    • member: RelationMember

      the relation member (argument, equivalence class, inference) for which the implicit relations should be derived

    • statementsMap: object

      the statements field of the ArgdownResponse

    • argumentsMap: object

      the arguments field of the ArgdownResponse

    Returns IRelation[]

    an array of derived implicit relations

Const escapeAsHtmlEntities

  • escapeAsHtmlEntities(s: string): string
  • Replaces all non-alphanumeric characters with their unicode html entity

    Parameters

    • s: string

    Returns string

Const escapeHtml

  • escapeHtml(str?: undefined | string): string | undefined
  • Parameters

    • Optional str: undefined | string

    Returns string | undefined

Const getHtmlId

  • getHtmlId(type: string, title: string, htmlIdsSet?: undefined | object): string
  • Parameters

    • type: string
    • title: string
    • Optional htmlIdsSet: undefined | object

    Returns string

Const isConclusion

Const isFunction

  • isFunction(x: any): boolean

Const isGroupMapNode

Const isNumber

  • isNumber(x: any): boolean

Const isObject

  • isObject(x: any): boolean
  • Be careful: This check excludes arrays, even though they are objects in JavaScript.

    Parameters

    • x: any

    Returns boolean

Const isPCSStatement

Const isReconstructed

Const isRuleNode

Const isString

  • isString(x: any): boolean

Const isTokenNode

Const jsonReplacer

  • jsonReplacer(_key: string, value: any): any

Const mergeDefaults

  • mergeDefaults(settings: any, defaults: object): any
  • Merge plugin default settings with incoming config settings.

    Any default setting can be set to an object with a 'merge' custom function. In that case this function is responsible for merging the incoming setting with default settings. The custom merge function will get the incoming setting as first parameter and should return the merged setting.

    Parameters

    • settings: any

      the incoming config settings

    • defaults: object

      the default settings object, possible containing objects with custom merge functions

      • [key: string]: any

    Returns any

Const normalizeLink

  • normalizeLink(url: string): string

Const normalizeLinkText

  • normalizeLinkText(url: string): string

Const objectIsEmpty

  • objectIsEmpty(x: any): boolean

Const other

Const otherRelationMemberIsInSelection

Const prepareForJSON

  • prepareForJSON(obj: any): any

Const reduceToMap

  • reduceToMap<K, V>(a: V[], idProvider: function): Map<K, V>
  • Type parameters

    • K

    • V: object

    Parameters

    • a: V[]
    • idProvider: function
        • (curr: V): K
        • Parameters

          • curr: V

          Returns K

    Returns Map<K, V>

Const relationMemberIsInSelection

splitByCharactersInLine

  • splitByCharactersInLine(s: string, n: number, useSpaces: boolean, a?: string[]): string[]
  • Splits a string at least every x characters. If useSpaces is true,

    Returns an array of substrings.

    Parameters

    • s: string
    • n: number
    • useSpaces: boolean
    • Optional a: string[]

    Returns string[]

Const splitByLineWidth

  • splitByLineWidth(str: string, options: object): string[]
  • Splits a string every x pixels, using string-pixel-width for measuring the width of the current line.

    Returns an array of substrings with width <= maxWidth.

    Only fonts measured by the string-pixel-width library are supported.

    Parameters

    • str: string
    • options: object

    Returns string[]

Const stringIsEmpty

  • stringIsEmpty(x: any): boolean

Const stringToClassName

  • stringToClassName(str: string): string

Const stringToHtmlId

  • stringToHtmlId(str: string): string

Const stringifyArgdownData

  • stringifyArgdownData(obj: object, replacer?: function | undefined | null, space?: undefined | number): string
  • Parameters

    • obj: object
    • Optional replacer: function | undefined | null
    • Optional space: undefined | number

    Returns string

Const tokenLocationsToString

  • tokenLocationsToString(tokens: IToken[]): string

Const tokensToString

  • tokensToString(tokens: IToken[]): string

Const transformToArgumentRelationType

Const validateColorString

  • validateColorString(str: string): boolean

Const validateLink

  • validateLink(url: string, allowFile: boolean): boolean
  • Parameters

    • url: string
    • allowFile: boolean

    Returns boolean

Object literals

Const colorSchemes

colorSchemes: object

colorbrewer-accent

colorbrewer-accent: string[] = ["#7fc97f", "#beaed4", "#fdc086", "#ffff99", "#386cb0", "#f0027f", "#bf5b17", "#666666"]

colorbrewer-category10

colorbrewer-category10: string[] = ["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"]

colorbrewer-dark2

colorbrewer-dark2: string[] = ["#1b9e77", "#d95f02", "#7570b3", "#e7298a", "#66a61e", "#e6ab02", "#a6761d", "#666666"]

colorbrewer-paired

colorbrewer-paired: string[] = ["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"]

colorbrewer-set

colorbrewer-set: string[] = ["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"]

colorbrewer-set2

colorbrewer-set2: string[] = ["#66c2a5", "#fc8d62", "#8da0cb", "#e78ac3", "#a6d854", "#ffd92f", "#e5c494", "#b3b3b3"]

colorbrewer-set3

colorbrewer-set3: string[] = ["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"]

default

default: string[] = ["#1b9e77", "#d95f02", "#7570b3", "#e7298a", "#66a61e", "#e6ab02", "#a6761d", "#666666"]

iwanthue-blue-ocean

iwanthue-blue-ocean: string[] = ["#3a718b", "#002a33", "#2178a3", "#0d353f", "#4c707b", "#214650", "#13526c", "#395e68"]

iwanthue-colorblind-friendly

iwanthue-colorblind-friendly: string[] = ["#ba4761","#b65b37","#c99738","#83a142","#52b77f","#7d89e0","#654397","#bc589e"]

iwanthue-fancy

iwanthue-fancy: string[] = ["#e6afd3", "#9ed2a7", "#aebaeb", "#d2d39d", "#71cdeb", "#e6b197", "#81d6d0", "#baf0d6"]

iwanthue-fluo

iwanthue-fluo: string[] = ["#7fe643", "#f3bb79", "#57e5d6", "#eecb3c", "#69eb8a", "#dbd76f", "#cfe945", "#b0e391"]

iwanthue-green-mint

iwanthue-green-mint: string[] = ["#569a3e", "#dfd84b", "#657443", "#b0e13e", "#c6cc9c", "#61d950", "#a09f40", "#a0de87"]

iwanthue-ice-cube

iwanthue-ice-cube: string[] = ["#48bf8c", "#3e6f5f", "#3ce896", "#68a194", "#71ecb8", "#3d9b76", "#adddc9", "#62e0d3"]

iwanthue-indigo-night

iwanthue-indigo-night: string[] = ["#4c8ae7", "#2d5192", "#829ce5", "#4074e3", "#5794d7", "#2f63ac", "#3295e9", "#607bc2"]

iwanthue-ochre-sand

iwanthue-ochre-sand: string[] = ["#885249", "#ec926e", "#995432", "#e29e96", "#b75f56", "#e0a081", "#ed837b", "#ad766b"]

iwanthue-purple-wine

iwanthue-purple-wine: string[] = ["#5f2cc1", "#504361", "#4033a2", "#27173a", "#77268f", "#403c81", "#321262", "#63306e"]

iwanthue-red-roses

iwanthue-red-roses: string[] = ["#e17892", "#da3db3", "#e0abbf", "#e23b6e", "#9a6276", "#e17cbc", "#aa3d5e", "#b14183"]

iwanthue-yellow-lime

iwanthue-yellow-lime: string[] = ["#ebcba0", "#e28c23", "#a88c68", "#dfb137", "#7e5e31", "#e2ae59", "#aa782a", "#deaa6e"]

Const ensure

ensure: object

Sanitization methods for config settings. These can be used for simple type checking and overwriting config settings.

Plugins should use these methods together with mergeDefaults.

array

  • array(defaultValue: any[]): object

boolean

  • boolean(defaultValue: boolean): object

number

  • number(defaultValue: number): object

object

  • object<T>(defaultValue: T): object
  • Type parameters

    • T

    Parameters

    • defaultValue: T

    Returns object

string

  • string(defaultValue: string): object

Generated using TypeDoc