mirror of
https://github.com/mayurankv/Obsidian-Code-Styler.git
synced 2026-07-22 08:10:29 +00:00
Update Readme
This commit is contained in:
parent
0ebda454d7
commit
01737f3a42
2 changed files with 15 additions and 2 deletions
|
|
@ -78,6 +78,8 @@ Example:
|
|||
- ` ```cpp title=example_title fold` (same effect as above line)
|
||||
- ` ``` fold title:example_title` (if no language set)
|
||||
|
||||
The plugin can also parse rmarkdown style codeblock parameters so ` ```{r title, hl=5}` is a recognised opening codeblock line.
|
||||
|
||||
### Line Numbers
|
||||
|
||||
Line numbers can be enabled/disabled within a specific theme in the settings of that theme. In addition to this, whether line numbering is applied can be additionally specified in a codeblock itself using the `ln` parameter.
|
||||
|
|
@ -98,6 +100,12 @@ Example:
|
|||
|
||||

|
||||
|
||||
### References
|
||||
|
||||
To display the title as a link to another page which can be clicked or hovered over, add the `ref:` or `reference:` parameter followed by a wikilink. The title will then show as a link to the referenced note. If no `title:` parameter is given, then the wikilink note name (or alias if given) will be used as the title.
|
||||
|
||||
Note that these links will not show up on the Graph or in Backlinks - this is an upstream issue with Obsidian.
|
||||
|
||||
### Folding
|
||||
|
||||
To specify an initial fold state when the document is opened, use the `fold` parameter. If `fold` is set in a codeblock, then when you open the document, the codeblock will be automatically collapsed, and only the header will be displayed. You can unfold the codeblock by clicking on the header.
|
||||
|
|
|
|||
|
|
@ -206,7 +206,7 @@ function parseCodeblockParameterString(parameterString: string, codeblockParamet
|
|||
codeblockParameters.ignore = true;
|
||||
else if (/^title[:=]/.test(parameterString))
|
||||
manageTitle(parameterString,codeblockParameters);
|
||||
else if (/^ref[:=]/.test(parameterString))
|
||||
else if (/^ref[:=]/.test(parameterString) || /^reference[:=]/.test(parameterString))
|
||||
manageReference(parameterString,codeblockParameters);
|
||||
else if (/^fold[:=]?/.test(parameterString))
|
||||
manageFolding(parameterString,codeblockParameters);
|
||||
|
|
@ -233,7 +233,12 @@ function manageTitle(parameterString: string, codeblockParameters: CodeblockPara
|
|||
}
|
||||
}
|
||||
function manageReference(parameterString: string, codeblockParameters: CodeblockParameters) {
|
||||
const refMatch = /\[\[([^|]*?)(?:\|[^|]*?)?\]\]/.exec(parameterString.slice("ref:".length));
|
||||
if (/^ref[:=]/.test(parameterString))
|
||||
parameterString.slice("ref:".length);
|
||||
else
|
||||
parameterString.slice("reference:".length);
|
||||
|
||||
const refMatch = /\[\[([^|]*?)(?:\|[^|]*?)?\]\]/.exec(parameterString);
|
||||
if (refMatch) {
|
||||
codeblockParameters.reference = refMatch[1].trim();
|
||||
if (codeblockParameters.title === "")
|
||||
|
|
|
|||
Loading…
Reference in a new issue