Skip to content
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

Convert docs to markdown #2080

Merged
merged 30 commits into from
Jul 16, 2023
Merged

Convert docs to markdown #2080

merged 30 commits into from
Jul 16, 2023

Conversation

mvorisek
Copy link
Member

@mvorisek mvorisek commented Jul 7, 2023

regexes used for most of the conversions:

$d = preg_replace("~\n*===+\n(.+?)\n===+\n*~", "\n\n# $1\n\n", $d);
$d = preg_replace("~\n*(.+?)\n===+\n*~", "\n\n## $1\n\n", $d);
$d = preg_replace("~\n*(.+?)\n---+\n*~", "\n\n### $1\n\n", $d);
$d = ltrim($d);

$d = preg_replace_callback("~(?<=\n|^)(?:    .*)(?:\n(?:    .*|))*(?<!\n)~", function ($matches) { return "```\n" . preg_replace("~(?<=\n|^)    ~", 'ůůůů', $matches[0]) . "\n```"; }, $d);
$d = preg_replace("~ůůůů~", "", $d);
$d = preg_replace_callback("~(?<=\n|^)(?:\.\. ?)code-block:: *+(.*)\n*((\n(?:    .*|))*)(?<!\n)~", function ($matches) { return "```" . $matches[1] . preg_replace("~(?<=\n|^)    ~", 'ůůůů', $matches[2]) . "\n```"; }, $d);
$d = preg_replace("~ůůůů~", "", $d);
$d = preg_replace_callback("~(?<=\n|^)(?:\.\. ?)((?!\n|:(?=:)|(?<=:):).+):: *+(.*)\n*((\n(?:   *.*|))*)(?<!\n)~", function ($matches) { return ":::{" .  $matches[1] . "}" . (trim($matches[2]) !== '' ? ' ' . trim($matches[2]) : '') . preg_replace("~(?<=\n|^)   *~", 'ůůůů', $matches[3]) . "\n:::"; }, $d);
$d = preg_replace("~ůůůů~", "", $d);
$d = preg_replace("~::(?=\n+```\n)~", ":", $d);
$d = preg_replace("~(?<!`)``(?!`)~", "`", $d);
$d = preg_replace("~`(.+?) ?<(https?:.*?)>`_~", "[$1]($2)", $d);
$d = preg_replace("~(?<=\n) +(?=(?:-|\d+\.|\*))~", "", $d);
$d = preg_replace("~(?<=\n)> ?~", "", $d);
$d = preg_replace("~:(php:[^: `\n]+):`([^`]+)`~", "{\$1}`$2`", $d);
$d = preg_replace("~:(ref):`([^`]+)`~", "{\$1}`$2`", $d);
$d = preg_replace("~:(.+?):`(.+?)`~", "{\$1}`$2`", $d);
// https://github.com/markstory/sphinxcontrib-phpdomain/issues/55 $d = preg_replace("~(?<=\n)(:\w+[ :].+\n)+~", "```{eval-rst}\n$0```\n", $d);
$d = preg_replace("~(?<=\n|^)\.\. ?_([\w\-]+):(?=\n|$)~", "($1)=", $d);

@mvorisek mvorisek force-pushed the docs_to_markdown branch 11 times, most recently from 0581d4a to 3074d46 Compare July 14, 2023 19:52
mvorisek added a commit that referenced this pull request Jul 15, 2023
for GH-2080, rename in separate commit for better git tracking
mvorisek added a commit that referenced this pull request Jul 16, 2023
for GH-2080, land these changes in separate commit for better git tracking
@mvorisek mvorisek marked this pull request as ready for review July 16, 2023 13:49
@mvorisek mvorisek added the MAJOR label Jul 16, 2023
@mvorisek mvorisek merged commit b6ad7bc into develop Jul 16, 2023
@mvorisek mvorisek deleted the docs_to_markdown branch July 16, 2023 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant