-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Documentation in printable format (CSS media queries) #2754
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
Closed
Closed
Changes from 15 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
92426f5
CSS rules added for printing, script added to create chapter-wide doc…
SetTrend c42345a
Merge branch 'master' into printable-doc
SetTrend 2cf4fca
_all.md files removed, .gitigore amened to exclude _all.md files from…
SetTrend 496d442
Merge branch 'printable-doc' of https://github.com/SetTrend/webpack.j…
SetTrend 49901a1
CSS rules added for printing, script added to create chapter-wide doc…
SetTrend c1e40be
_all.md files removed, .gitigore amened to exclude _all.md files from…
SetTrend df53ddd
Merge branch 'printable-doc' of https://github.com/SetTrend/webpack.j…
SetTrend df10358
docs(plugins) IgnorePlugin new syntax and options (#2721)
EugeneHlushko 8793381
docs(plugins): Add title to cacheGroups (#2227)
sharh cf26894
Update split-chunks-plugin.md
montogeek 5b45f87
Update split-chunks-plugin.md
montogeek d74520b
Revert "cacheGroups" (#2725)
EugeneHlushko 96792a0
docs(config) document optimization.chunkIds (#2727)
EugeneHlushko 5c5981d
CSS rules added for printing, script added to create chapter-wide doc…
SetTrend 6603ced
_all.md files removed, .gitigore amened to exclude _all.md files from…
SetTrend d696a31
Merge branch 'master' into printable-doc
SetTrend 2a90c76
Configuration for summarized help files removed from `package.json`.
SetTrend 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 contains hidden or 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 |
---|---|---|
|
@@ -10,3 +10,4 @@ starter-kits-data.json | |
.DS_Store | ||
yarn-error.log | ||
package-lock.json | ||
src/content/**/*_all.md |
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,78 @@ | ||
// start message | ||
console.info("\x1b[0m\x1b[36mConcatenating help files of each directory to create chapter-wide help files to be used for printing help ...\x1b[0m"); | ||
|
||
// ------ various includes ------ | ||
const fs = require("fs"); | ||
const path = require("path"); | ||
const os = require("os"); | ||
const front = require("front-matter"); | ||
|
||
// root path | ||
const rootPath = path.join("src", "content"); | ||
|
||
/* getDirectoryRecursive() recursively walks through | ||
all sub directories of the provided root path, | ||
concatenates the MarkDown files' content in | ||
each directory, sorted by their FrontMatter sort | ||
attribute, and creates a compound MarkDown file | ||
named by using the directory name, prefixed by an | ||
underscore and suffixed by "_all.md" from the | ||
concatenated content in the corresponding directory. | ||
*/ | ||
(function getDirectoryRecursive(basePath) | ||
{ | ||
// log current working directory | ||
console.log("\x1b[0m\x1b[32m " + basePath + "\x1b[0m"); | ||
|
||
// create destination file name of compound file | ||
const targetFilePath = path.join(basePath, `${basePath.substr(rootPath.length).replace(/[/\\]/, "_")}_all.md`); | ||
|
||
if (fs.existsSync(targetFilePath)) fs.unlinkSync(targetFilePath); // delete target file if it already exists | ||
|
||
fs.readdir(basePath, function (err, fileNames) // list current working directory | ||
{ | ||
if (err) throw err; | ||
|
||
let fileContents = []; | ||
|
||
for (let file of fileNames) // for each directory entry ... | ||
{ | ||
const fullPath = path.join(basePath, file); | ||
|
||
if (fs.statSync(fullPath).isDirectory()) getDirectoryRecursive(fullPath); // if the directory entry is a directory, recurse into that directory | ||
else if (fullPath.endsWith(".md")) // if the directory entry is a MarkDown file, add it to the list of files to be processed | ||
{ | ||
let fc = fileContents[fileContents.length] = front(fs.readFileSync(fullPath).toString()); | ||
|
||
if (!fc.attributes.sort) --fileContents.length; // only include files providing a FrontMatter "sort" attribute | ||
} | ||
} | ||
|
||
// sort MarkDown files by FrontMatter "sort" attribute (QuickSort) | ||
for (let i = 0;i < fileContents.length - 1;++i) | ||
for (let j = i + 1;j < fileContents.length;++j) | ||
{ | ||
const left = fileContents[i].attributes, right = fileContents[j].attributes; | ||
|
||
if (left.sort > right.sort | ||
|| left.sort == right.sort && left.title > right.title) | ||
[fileContents[i], fileContents[j]] = [fileContents[j], fileContents[i]]; | ||
} | ||
|
||
// write compound target file | ||
const targetFile = fs.createWriteStream(targetFilePath); | ||
|
||
targetFile.on("error", (error) => { throw error; }); | ||
|
||
for (let file of fileContents) | ||
{ | ||
targetFile.write(os.EOL + os.EOL + "# " + file.attributes.title + os.EOL); // use FrontMatter "title" attribute as main heading of target file | ||
targetFile.write(file.body); | ||
} | ||
|
||
targetFile.end(); | ||
}); | ||
})(rootPath); | ||
|
||
// end message | ||
process.on("exit", () => { console.info("\x1b[0m\x1b[36mSuccessfully created \"_all.md\" help files in each directory within \"" + rootPath + "\".\x1b[0m"); }); |
This file contains hidden or 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 hidden or 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 |
---|---|---|
|
@@ -4,6 +4,10 @@ | |
.footer { | ||
width: 100%; | ||
flex: 0 0 auto; | ||
|
||
@media print { | ||
display: none !important; | ||
} | ||
} | ||
|
||
.footer__inner { | ||
|
This file contains hidden or 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 hidden or 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 |
---|---|---|
|
@@ -29,3 +29,10 @@ | |
padding: 1.5em; | ||
} | ||
} | ||
|
||
.contributors__section, .interactive | ||
{ | ||
@media print { | ||
display: none !important; | ||
} | ||
} |
This file contains hidden or 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 hidden or 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 hidden or 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.
Uh oh!
There was an error while loading. Please reload this page.