Repository navigation
Title feature #19 - #20
Conversation
- Now the title is optional - Pass the option `title` to display the file name - Pass a value to this previous option `title:"An example of custom title"` to display a custom title. Bug/Known issue: - Does not work properly if user write asciidoc pages. See issue azu#18. A workaround for now is to not pass any title, and create in asciidoc. For example ```adoc .This is the title [import](path/to/code.ext) ``` Possible improvment: - Add code caption numbering. (would be useful for pdf format for example).
| * @return {boolean,string} | ||
| */ | ||
| export function parseTitle(label, fileName) { | ||
| let title=[false, undefined]; |
There was a problem hiding this comment.
Tuple mixed data type is not major in JavaScript.
It will be better that separate hasTitle (regExp.test(string) is useful) and parseTitle?
There was a problem hiding this comment.
Ok! (with your suggestion, it is not required anymore anyway) ;)
|
I've written another suggestion to #19 (comment) |
- See pull request azu#19 (comment) for more details
- Asciidoc code title fixed azu#18. - Introduce a code counter for referencing. *Example:* -------------------------- This is a code [import,title:"my title",id:"ref1"](test.cpp) and here another code [import,title:"my title",id:"ref2"](test.cpp) -------------------------- *Result:* -------------------------- This is a code > Code 0: my title // The code ref1 and here another code > Code1: my title // The code ref2 -------------------------- *Cite:* - asciidoc "Now I cite both code <<ref1>>, <<ref2>>" => "Now I cite both code [Code 0], [Code 1] NB: Here we have an automatic text replacement. - markdown Now I cite both code [Code 0](#ref1), [Code 1](#ref2).
|
Code updated! |
| "id":undefined, | ||
| "marker":undefined | ||
| }; | ||
| for(var key in keyvals) { |
There was a problem hiding this comment.
Please use Object.keys(keyvals).forEach(key => { ... }) instead of for..in.
for...in has a trap.
for...in is not bad, but prefer use the other.
Related:
|
@gdolle Thanks for huge update! 👍
|
|
Thanks for your comments. Code updated! |
|
It looks good :) |
|
titles are broken and don't look good. |
|
I wait for updateing #20 (comment)
Hmm, Do you use Asciidoc? Previously, gitbook-plugin-include-codeblock supported only markdown, but this pull request including support asciidoc. |
Pull-request proposal for feature #19
titleto display the file nametitle:"An example of custom title"todisplay a custom title.
Bug/Known issue:
A workaround for now is to not pass any title, and create it directly in asciidoc.
For example
.This is the title [import](path/to/code.ext)Possible improvment:
example).